Class FormProcessor

  • All Implemented Interfaces:
    PacketHandler

    public final class FormProcessor
    extends Agent
    A class to facilitate the loading of XML documents containing an XFA template. It is intended that this class parallels the functionality offered by XFA's "xmlform -pa" application.

    Here's a snippet of code illustrating the use of a FormProcessor().

    
     
      import com.adobe.xfa.formprocessor.FormProcessor;
      ...
      FormProcessor pa = new FormProcessor();
      try  {
          InputStream template = ...
          InputStream config = ...
          InputStream data = ...
          OutputStream out = ...
          OutputStream log = ...
          int ok = pa.execute(template, config, data, null, out, log, null, null);
          if (ok == FAIL) {
              // look at resulting log stream.
          }
                    else {
              // look at resulting out stream.
          }
      } catch (IOException o) {
          ...
      } catch (ExFull e) {
          System.err.println(e.toString());
      }
      
     
    • Field Detail

      • HREF_CACHE_SIZE

        public static final int HREF_CACHE_SIZE
        The default size (51200), in filesystem bytes of memory, for the cache used to hold loaded template fragments.

        Server-based applications may prefer to use custom values instead -- this being a relatively small value.

        See Also:
        FormProcessor(int), Constant Field Values
    • Constructor Detail

      • FormProcessor

        public FormProcessor()
        Instantiates an XFA form processor.
      • FormProcessor

        public FormProcessor​(int cacheSize)
        Instantiates an XFA form processor with a template fragment cache of specified size.
        Parameters:
        cacheSize - the size of the template fragment cache.

        This is the maximal size, in filesize bytes of memory, allowed of all loaded template fragments. Once exceeded, the DOM of loaded template fragments gets discarded on a fifo basis.

    • Method Detail

      • getConfigSchemaName

        public String getConfigSchemaName()
        Description copied from class: Agent
        Retrieve the configuration schema tag name where the config options are stored for this agent.
        Specified by:
        getConfigSchemaName in class Agent
      • execute

        public int execute​(InputStream oTemplate,
                           InputStream oXCI,
                           InputStream oData,
                           InputStream oXDC,
                           OutputStream oOutput,
                           OutputStream oInfo,
                           String masterPassword,
                           String userPassword)
                    throws ExFull
        Executes a form as directed by the specified inputs.
        Parameters:
        oTemplate - the template input stream.
        oXCI - the configuration input stream.
        oData - the data input stream, if available.
        oXDC - the XFA XDC input stream if available. This is not currently supported.
        oOutput - the output stream. Currently, only XDP output is supported.
        oInfo - the info output stream.
        masterPassword - the encrypted PDF master password, if applicable.
        userPassword - the encrypted PDF user password, if applicable.
        Returns:
        the completion code, e.g., Agent.SUCCESS, Agent.FAIL, ...
        Throws:
        ExFull - upon error.
      • loadXDP

        public boolean loadXDP​(InputStream is,
                               String sPackets,
                               boolean bReload)