Class Fop

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class Fop
    extends org.apache.tools.ant.Task
    Wrapper for FOP which allows it to be accessed from within an Ant task. Accepts the inputs:
    • fofile - formatting objects file to be transformed
    • iffile - intermediate format input file to be transformed
    • outputFormat - MIME type of the format to generate ex. "application/pdf"
    • inputFormat - Input file format (like "fo","xml","if")
    • outfile - output filename
    • baseDir - directory to work from
    • relativebase - (true | false) control whether to use each FO's directory as base directory. false uses the baseDir parameter.
    • userconfig - file with user configuration (same as the "-c" command line option)
    • messagelevel - (error | warn | info | verbose | debug) level to output non-error messages
    • logFiles - Controls whether the names of the files that are processed are logged or not
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File baseDir  
      private java.util.List<org.apache.tools.ant.types.FileSet> filesets  
      private java.io.File foFile  
      private boolean force  
      private java.lang.String format  
      private boolean logFiles  
      private int messageType  
      private java.io.File outDir  
      private java.io.File outFile  
      private boolean relativebase  
      private boolean throwExceptions  
      private java.io.File userConfig  
      private java.io.File xmlFile  
      private java.io.File xsltFile  
      private java.lang.String xsltParams  
      • Fields inherited from class org.apache.tools.ant.Task

        target, taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Constructor Summary

      Constructors 
      Constructor Description
      Fop()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFileset​(org.apache.tools.ant.types.FileSet set)
      Adds a set of XSL-FO files (nested fileset attribute).
      void execute()
      java.io.File getBasedir()
      Gets the base directory.
      java.util.List getFilesets()
      Returns the current list of filesets.
      java.io.File getFofile()
      Gets the input XSL-FO file.
      boolean getForce()
      Gets the force attribute
      java.lang.String getFormat()
      Gets the output format (MIME type).
      boolean getLogFiles()
      Returns True if the filename of each file processed should be logged.
      int getMessageType()
      Returns the message type corresponding to Project.MSG_* representing the current message level.
      java.io.File getOutdir()
      Gets the output directory.
      java.io.File getOutfile()
      Gets the output file.
      boolean getRelativebase()
      Gets the relative base attribute
      boolean getThrowexceptions()
      Gets the throw exceptions attribute
      java.io.File getUserconfig()
      Returns the file for the userconfig.xml.
      java.io.File getXmlFile()
      Gets the input XML file.
      java.io.File getXsltFile()
      Gets the input XSLT file.
      java.lang.String getXsltParams()
      Gets the XSLT parameters
      void setBasedir​(java.io.File baseDir)
      Sets the base directory for single FO file (non-fileset) usage
      void setFofile​(java.io.File foFile)
      Sets the input XSL-FO file.
      void setForce​(boolean force)
      Set whether to check dependencies, or to always generate; optional, default is false.
      void setFormat​(java.lang.String format)
      Sets output format (MIME type).
      void setLogFiles​(boolean logFiles)
      Controls whether the filenames of the files that are processed are logged or not.
      void setMessagelevel​(java.lang.String messageLevel)
      Sets the message level to be used while processing.
      void setOutdir​(java.io.File outDir)
      Sets the output directory.
      void setOutfile​(java.io.File outFile)
      Sets the output file.
      void setRelativebase​(boolean relbase)
      Set whether to include files (external-graphics, instream-foreign-object) from a path relative to the .fo file (true) or the working directory (false, default) only useful for filesets
      void setThrowexceptions​(boolean throwExceptions)
      Set whether exceptions are thrown.
      void setUserconfig​(java.io.File userConfig)
      Sets the filename for the userconfig.xml.
      void setXmlFile​(java.io.File xmlFile)
      Sets the input XML file.
      void setXsltFile​(java.io.File xsltFile)
      Sets the input XSLT file.
      void setXsltParams​(java.lang.String xsltParams)
      Sets the XSLT parameters
      • Methods inherited from class org.apache.tools.ant.Task

        bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • foFile

        private java.io.File foFile
      • xmlFile

        private java.io.File xmlFile
      • xsltFile

        private java.io.File xsltFile
      • xsltParams

        private java.lang.String xsltParams
      • filesets

        private java.util.List<org.apache.tools.ant.types.FileSet> filesets
      • outFile

        private java.io.File outFile
      • outDir

        private java.io.File outDir
      • format

        private java.lang.String format
      • baseDir

        private java.io.File baseDir
      • userConfig

        private java.io.File userConfig
      • messageType

        private int messageType
      • logFiles

        private boolean logFiles
      • force

        private boolean force
      • relativebase

        private boolean relativebase
      • throwExceptions

        private boolean throwExceptions
    • Constructor Detail

      • Fop

        public Fop()
    • Method Detail

      • setUserconfig

        public void setUserconfig​(java.io.File userConfig)
        Sets the filename for the userconfig.xml.
        Parameters:
        userConfig - Configuration to use
      • getUserconfig

        public java.io.File getUserconfig()
        Returns the file for the userconfig.xml.
        Returns:
        the userconfig.xml file
      • setFofile

        public void setFofile​(java.io.File foFile)
        Sets the input XSL-FO file.
        Parameters:
        foFile - input XSL-FO file
      • getFofile

        public java.io.File getFofile()
        Gets the input XSL-FO file.
        Returns:
        input XSL-FO file
      • getXmlFile

        public java.io.File getXmlFile()
        Gets the input XML file.
        Returns:
        the input XML file.
      • setXmlFile

        public void setXmlFile​(java.io.File xmlFile)
        Sets the input XML file.
        Parameters:
        xmlFile - the input XML file.
      • getXsltFile

        public java.io.File getXsltFile()
        Gets the input XSLT file.
        Returns:
        the input XSLT file.
      • setXsltFile

        public void setXsltFile​(java.io.File xsltFile)
        Sets the input XSLT file.
        Parameters:
        xsltFile - the input XSLT file.
      • getXsltParams

        public java.lang.String getXsltParams()
        Gets the XSLT parameters
        Returns:
        the XSLT parameters
      • setXsltParams

        public void setXsltParams​(java.lang.String xsltParams)
        Sets the XSLT parameters
        Parameters:
        xsltParams - the XSLT parameters
      • addFileset

        public void addFileset​(org.apache.tools.ant.types.FileSet set)
        Adds a set of XSL-FO files (nested fileset attribute).
        Parameters:
        set - a fileset
      • getFilesets

        public java.util.List getFilesets()
        Returns the current list of filesets.
        Returns:
        the filesets
      • setRelativebase

        public void setRelativebase​(boolean relbase)
        Set whether to include files (external-graphics, instream-foreign-object) from a path relative to the .fo file (true) or the working directory (false, default) only useful for filesets
        Parameters:
        relbase - true if paths are relative to file.
      • getRelativebase

        public boolean getRelativebase()
        Gets the relative base attribute
        Returns:
        the relative base attribute
      • setForce

        public void setForce​(boolean force)
        Set whether to check dependencies, or to always generate; optional, default is false.
        Parameters:
        force - true if always generate.
      • getForce

        public boolean getForce()
        Gets the force attribute
        Returns:
        the force attribute
      • setOutfile

        public void setOutfile​(java.io.File outFile)
        Sets the output file.
        Parameters:
        outFile - File to output to
      • getOutfile

        public java.io.File getOutfile()
        Gets the output file.
        Returns:
        the output file
      • setOutdir

        public void setOutdir​(java.io.File outDir)
        Sets the output directory.
        Parameters:
        outDir - Directory to output to
      • getOutdir

        public java.io.File getOutdir()
        Gets the output directory.
        Returns:
        the output directory
      • setFormat

        public void setFormat​(java.lang.String format)
        Sets output format (MIME type).
        Parameters:
        format - the output format
      • getFormat

        public java.lang.String getFormat()
        Gets the output format (MIME type).
        Returns:
        the output format
      • setThrowexceptions

        public void setThrowexceptions​(boolean throwExceptions)
        Set whether exceptions are thrown. default is false.
        Parameters:
        throwExceptions - true if exceptions should be thrown
      • getThrowexceptions

        public boolean getThrowexceptions()
        Gets the throw exceptions attribute
        Returns:
        the throw exceptions attribute
      • setMessagelevel

        public void setMessagelevel​(java.lang.String messageLevel)
        Sets the message level to be used while processing.
        Parameters:
        messageLevel - (error | warn| info | verbose | debug)
      • getMessageType

        public int getMessageType()
        Returns the message type corresponding to Project.MSG_* representing the current message level.
        Returns:
        message type
        See Also:
        Project
      • setBasedir

        public void setBasedir​(java.io.File baseDir)
        Sets the base directory for single FO file (non-fileset) usage
        Parameters:
        baseDir - File to use as a working directory
      • getBasedir

        public java.io.File getBasedir()
        Gets the base directory.
        Returns:
        the base directory
      • setLogFiles

        public void setLogFiles​(boolean logFiles)
        Controls whether the filenames of the files that are processed are logged or not.
        Parameters:
        logFiles - True if the feature should be enabled
      • getLogFiles

        public boolean getLogFiles()
        Returns True if the filename of each file processed should be logged.
        Returns:
        True if the filenames should be logged.
      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException