Package org.apache.dvsl
Class DVSLTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- org.apache.tools.ant.taskdefs.MatchingTask
-
- org.apache.dvsl.DVSLTask
-
- All Implemented Interfaces:
java.lang.Cloneable,org.apache.tools.ant.types.selectors.SelectorContainer
public class DVSLTask extends org.apache.tools.ant.taskdefs.MatchingTaskA Task to process via DVSL a set of XML documents. This is useful for building views of XML based documentation. arguments:- basedir
- destdir
- style
- in
- out
- logfile
- includes
- excludes
- force
- extension
- outputencoding
- classpath
- classpathref
- toolboxfile
- velocityconfigclass
Of these arguments, the sourcedir and destdir are required, or, in and out are required.
Following are the supported nested elements:
- <include>
- <exclude>
- <classpath>
- <tool name="toolbox-property" value="value-or-object" />
- <velconfig name="velocity-config-name" value="config-value" />
This task will recursively scan the sourcedir and destdir looking for XML documents to process via DVSL.
This task was adapted from Ant's <style> task (XSLTProcess class) from the 1.4.1 release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDVSLTask.ToolclassDVSLTask.VelocityConfig
-
Field Summary
Fields Modifier and Type Field Description private java.io.FilebaseDirprivate java.lang.ClassLoaderclassLoaderprivate org.apache.tools.ant.types.Pathclasspathprivate java.io.FiledestDirprivate DVSLdvslprivate booleanforceprivate java.io.FileinFilestatic java.lang.StringINFILENAMESupported app valuesprivate java.io.FilelogFileprivate java.io.FileoutFilestatic java.lang.StringOUTFILENAMEprivate java.lang.StringoutputEncodingprivate java.io.Filestylesheetprivate java.lang.StringstylesheetEncodingprivate java.lang.StringtargetExtensionprivate java.util.VectortoolAttrprivate java.io.FiletoolboxFileprivate java.util.PropertiestoolboxPropsprivate booleanvalidatingParserprivate java.util.VectorvelConfigAttrprivate java.lang.StringvelConfigClassprivate java.util.MapvelConfigMap
-
Constructor Summary
Constructors Constructor Description DVSLTask()Creates a new DVSLTask Task.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.apache.tools.ant.types.PathcreateClasspath()Set the classpath to load the Processor through (nested element).DVSLTask.ToolcreateTool()support for <tool> nested elementDVSLTask.VelocityConfigcreateVelConfig()support for <velconfig> nested elementprivate voidensureDirectoryFor(java.io.File targetFile)voidexecute()Executes the task.private voidprocess(java.io.File inFile, java.io.File outFile, java.io.File stylesheet)private voidprocess(java.io.File baseDir, java.lang.String xmlFile, java.io.File destDir, java.io.File stylesheet)Processes the given input XML file and stores the result in the given resultFile.voidputAppValue(java.lang.String name, java.lang.Object o)Sets an application value from outside of the DVSL taskvoidsetBasedir(java.io.File dir)Set the base directory.voidsetClasspath(org.apache.tools.ant.types.Path classpath)Set the classpath to load the Processor through (attribute).voidsetClasspathRef(org.apache.tools.ant.types.Reference r)Set the classpath to load the Processor through via reference (attribute).voidsetDestdir(java.io.File dir)Set the destination directory where the generated files should be directed.voidsetExtension(java.lang.String name)Set the desired file extension to be used for the target files.voidsetForce(boolean force)Set whether to check dependencies, or always generate.voidsetIn(java.io.File inFile)Sets an input xml file to be styledvoidsetLogFile(java.io.File logFile)Sets the file to use for logging.voidsetOut(java.io.File outFile)Sets an output filevoidsetOutputEncoding(java.lang.String encoding)Sets the character encoding for output files.voidsetStyle(java.io.File dvslFile)Sets the file to use for stylesheet.voidsetStyleEncoding(java.lang.String dvslFileEncoding)Sets the encoding of stylesheet file.voidsetToolbox(java.lang.String toolboxFile)Deprecated.use setToolboxFile insteadvoidsetToolboxFile(java.io.File toolboxFile)Sets the Toolbox properties file to use.voidsetValidatingParser(boolean validating)Sets the flag to have DVSL use a validating parser for the input documentsvoidsetVelocityConfigClass(java.lang.String classname)Allows the user to specify a class that implementsPropertiesthat will have user properties to be used when setting up DVSL.private longtransform(java.io.File inFile, java.io.File outFile)Does the actual transform-
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
-
-
-
-
Field Detail
-
INFILENAME
public static final java.lang.String INFILENAME
Supported app values- See Also:
- Constant Field Values
-
OUTFILENAME
public static final java.lang.String OUTFILENAME
- See Also:
- Constant Field Values
-
dvsl
private DVSL dvsl
-
destDir
private java.io.File destDir
-
baseDir
private java.io.File baseDir
-
stylesheet
private java.io.File stylesheet
-
stylesheetEncoding
private java.lang.String stylesheetEncoding
-
inFile
private java.io.File inFile
-
outFile
private java.io.File outFile
-
logFile
private java.io.File logFile
-
targetExtension
private java.lang.String targetExtension
-
outputEncoding
private java.lang.String outputEncoding
-
classpath
private org.apache.tools.ant.types.Path classpath
-
classLoader
private java.lang.ClassLoader classLoader
-
force
private boolean force
-
toolAttr
private java.util.Vector toolAttr
-
toolboxFile
private java.io.File toolboxFile
-
toolboxProps
private java.util.Properties toolboxProps
-
velConfigClass
private java.lang.String velConfigClass
-
velConfigMap
private java.util.Map velConfigMap
-
velConfigAttr
private java.util.Vector velConfigAttr
-
validatingParser
private boolean validatingParser
-
-
Method Detail
-
execute
public void execute() throws org.apache.tools.ant.BuildExceptionExecutes the task.- Overrides:
executein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException
-
setForce
public void setForce(boolean force)
Set whether to check dependencies, or always generate.- Parameters:
force- false to check dependencies, true to always generate
-
setBasedir
public void setBasedir(java.io.File dir)
Set the base directory.- Parameters:
dir- name of the base directory
-
setDestdir
public void setDestdir(java.io.File dir)
Set the destination directory where the generated files should be directed.- Parameters:
dir- name of the destination directory
-
setExtension
public void setExtension(java.lang.String name)
Set the desired file extension to be used for the target files. If not specified, ".html" is used.- Parameters:
name- the extension to use
-
setStyle
public void setStyle(java.io.File dvslFile)
Sets the file to use for stylesheet.- Parameters:
dvslFile- stylesheet filename
-
setStyleEncoding
public void setStyleEncoding(java.lang.String dvslFileEncoding)
Sets the encoding of stylesheet file.- Parameters:
dvslFileEncoding- encoding of stylesheet file
-
setLogFile
public void setLogFile(java.io.File logFile)
Sets the file to use for logging. If not specified, all logging is directed through Ant's logging system.- Parameters:
logFile- logging filename
-
setToolbox
public void setToolbox(java.lang.String toolboxFile)
Deprecated.use setToolboxFile insteadSets the Toolbox properties file to use.- Parameters:
toolboxFile- properties file of tools
-
setToolboxFile
public void setToolboxFile(java.io.File toolboxFile)
Sets the Toolbox properties file to use.- Parameters:
toolboxFile- properties file of tools
-
setVelocityConfigClass
public void setVelocityConfigClass(java.lang.String classname)
Allows the user to specify a class that implementsPropertiesthat will have user properties to be used when setting up DVSL.- Parameters:
classname- Velocity configuration class to load
-
setOut
public void setOut(java.io.File outFile)
Sets an output file- Parameters:
outFile- output file
-
setIn
public void setIn(java.io.File inFile)
Sets an input xml file to be styled- Parameters:
inFile- input file
-
setOutputEncoding
public void setOutputEncoding(java.lang.String encoding)
Sets the character encoding for output files. If not specified, output is written with UTF-8 encodin6g.- Parameters:
encoding- Output encoding
-
setClasspath
public void setClasspath(org.apache.tools.ant.types.Path classpath)
Set the classpath to load the Processor through (attribute).- Parameters:
classpath- classpath to set
-
createClasspath
public org.apache.tools.ant.types.Path createClasspath()
Set the classpath to load the Processor through (nested element).
-
setClasspathRef
public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Set the classpath to load the Processor through via reference (attribute).- Parameters:
r- reference to classpath
-
setValidatingParser
public void setValidatingParser(boolean validating)
Sets the flag to have DVSL use a validating parser for the input documents
-
putAppValue
public void putAppValue(java.lang.String name, java.lang.Object o)Sets an application value from outside of the DVSL task
-
process
private void process(java.io.File baseDir, java.lang.String xmlFile, java.io.File destDir, java.io.File stylesheet) throws org.apache.tools.ant.BuildExceptionProcesses the given input XML file and stores the result in the given resultFile.- Throws:
org.apache.tools.ant.BuildException
-
process
private void process(java.io.File inFile, java.io.File outFile, java.io.File stylesheet) throws org.apache.tools.ant.BuildException- Throws:
org.apache.tools.ant.BuildException
-
transform
private long transform(java.io.File inFile, java.io.File outFile) throws java.lang.ExceptionDoes the actual transform
- Parameters:
inFile- XML document sourceoutFile- File for transformed input- Returns:
- elapsed time in ms. for transformation
- Throws:
java.lang.Exception
-
ensureDirectoryFor
private void ensureDirectoryFor(java.io.File targetFile) throws org.apache.tools.ant.BuildException- Throws:
org.apache.tools.ant.BuildException
-
createTool
public DVSLTask.Tool createTool()
support for <tool> nested element
-
createVelConfig
public DVSLTask.VelocityConfig createVelConfig()
support for <velconfig> nested element
-
-