Class Fop

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.fop.tools.anttasks.Fop
All Implemented Interfaces:
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 File
     
    private List<org.apache.tools.ant.types.FileSet>
     
    private File
     
    private boolean
     
    private String
     
    private boolean
     
    private int
     
    private File
     
    private File
     
    private boolean
     
    private boolean
     
    private File
     
    private File
     
    private File
     
    private String
     

    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

    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
    Gets the base directory.
    Returns the current list of filesets.
    Gets the input XSL-FO file.
    boolean
    Gets the force attribute
    Gets the output format (MIME type).
    boolean
    Returns True if the filename of each file processed should be logged.
    int
    Returns the message type corresponding to Project.MSG_* representing the current message level.
    Gets the output directory.
    Gets the output file.
    boolean
    Gets the relative base attribute
    boolean
    Gets the throw exceptions attribute
    Returns the file for the userconfig.xml.
    Gets the input XML file.
    Gets the input XSLT file.
    Gets the XSLT parameters
    void
    setBasedir(File baseDir)
    Sets the base directory for single FO file (non-fileset) usage
    void
    setFofile(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(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(String messageLevel)
    Sets the message level to be used while processing.
    void
    setOutdir(File outDir)
    Sets the output directory.
    void
    setOutfile(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(File userConfig)
    Sets the filename for the userconfig.xml.
    void
    setXmlFile(File xmlFile)
    Sets the input XML file.
    void
    setXsltFile(File xsltFile)
    Sets the input XSLT file.
    void
    setXsltParams(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 Details

    • foFile

      private File foFile
    • xmlFile

      private File xmlFile
    • xsltFile

      private File xsltFile
    • xsltParams

      private String xsltParams
    • filesets

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

      private File outFile
    • outDir

      private File outDir
    • format

      private String format
    • baseDir

      private File baseDir
    • userConfig

      private File userConfig
    • messageType

      private int messageType
    • logFiles

      private boolean logFiles
    • force

      private boolean force
    • relativebase

      private boolean relativebase
    • throwExceptions

      private boolean throwExceptions
  • Constructor Details

    • Fop

      public Fop()
  • Method Details

    • setUserconfig

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

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

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

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

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

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

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

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

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

      public void setXsltParams(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 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(File outFile)
      Sets the output file.
      Parameters:
      outFile - File to output to
    • getOutfile

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

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

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

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

      public 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(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(File baseDir)
      Sets the base directory for single FO file (non-fileset) usage
      Parameters:
      baseDir - File to use as a working directory
    • getBasedir

      public 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