Class JRAntUpdateTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.MatchingTask
net.sf.jasperreports.ant.JRBaseAntTask
net.sf.jasperreports.ant.JRAntUpdateTask
All Implemented Interfaces:
Cloneable, org.apache.tools.ant.types.selectors.SelectorContainer

public class JRAntUpdateTask extends JRBaseAntTask
Ant task for batch-updating JRXML report design files. Works like the built-in javac Ant task.

This task can take the following arguments:

  • src
  • destdir
Of these arguments, the src and destdir are required. When this task executes, it will recursively scan the src and destdir looking for JRXML report design files to update. This task makes its update decision based on timestamp and only JRXML files that have no corresponding file in the target directory or where the destination report design file is older than the source file will be updated.
Author:
Teodor Danciu (teodord@users.sourceforge.net)
  • Field Summary

    Fields inherited from class net.sf.jasperreports.ant.JRBaseAntTask

    jasperReportsContext

    Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask

    fileset

    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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Checks that all required attributes have been set and that the supplied values are valid.
    org.apache.tools.ant.types.Path
    Adds a path to the classpath.
    org.apache.tools.ant.types.Path
    Adds a path for update source.
    Adds an updater.
    void
    Executes the task.
    protected void
    scanDir(File srcdir, File destdir, String[] files)
    Scans the directory looking for source files to be updated.
    protected void
    Scans the source directories looking for source files to be updated.
    void
    setDestdir(File destdir)
    Sets the destination directory into which the XML report design files should be updated.
    void
    setSrcdir(org.apache.tools.ant.types.Path srcdir)
    Sets the source directories to find the XML report design files.
    void
    setXmlvalidation(boolean xmlvalidation)
    Instructs the XML parser to validate the XML report design file during update.
    protected void
    Performs the update of the selected report design files.

    Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask

    add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems

    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

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JRAntUpdateTask

      public JRAntUpdateTask()
  • Method Details

    • setSrcdir

      public void setSrcdir(org.apache.tools.ant.types.Path srcdir)
      Sets the source directories to find the XML report design files.
      Parameters:
      srcdir - source path
    • createSrc

      public org.apache.tools.ant.types.Path createSrc()
      Adds a path for update source.
      Returns:
      source path
    • setDestdir

      public void setDestdir(File destdir)
      Sets the destination directory into which the XML report design files should be updated.
      Parameters:
      destdir - destination directory
    • createClasspath

      public org.apache.tools.ant.types.Path createClasspath()
      Adds a path to the classpath.
      Returns:
      classpath to use when updating the report
    • setXmlvalidation

      public void setXmlvalidation(boolean xmlvalidation)
      Instructs the XML parser to validate the XML report design file during update.
      Parameters:
      xmlvalidation - flag for enabling/disabling the validation feature of the XML parser
    • createUpdater

      public UpdaterElement createUpdater()
      Adds an updater.
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Executes the task.
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException
    • checkParameters

      protected void checkParameters() throws org.apache.tools.ant.BuildException
      Checks that all required attributes have been set and that the supplied values are valid.
      Throws:
      org.apache.tools.ant.BuildException
    • scanSrc

      protected void scanSrc() throws org.apache.tools.ant.BuildException
      Scans the source directories looking for source files to be updated.
      Throws:
      org.apache.tools.ant.BuildException
    • scanDir

      protected void scanDir(File srcdir, File destdir, String[] files)
      Scans the directory looking for source files to be updated. The results are returned in the instance variable reportFilesMap.
      Parameters:
      srcdir - source directory
      destdir - destination directory
      files - included file names
    • update

      protected void update() throws org.apache.tools.ant.BuildException
      Performs the update of the selected report design files.
      Throws:
      org.apache.tools.ant.BuildException