org.apache.dvsl
Class DVSLTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.tools.ant.taskdefs.MatchingTask
              extended by 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.MatchingTask

A Task to process via DVSL a set of XML documents. This is useful for building views of XML based documentation. arguments:

Of these arguments, the sourcedir and destdir are required, or, in and out are required.

Following are the supported nested elements:

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.

Author:
Keith Visco, Sam Ruby, Russell Gold, Stefan Bodewig, Geir Magnusson Jr., Bill Burton.

Nested Class Summary
 class DVSLTask.Tool
           
 class DVSLTask.VelocityConfig
           
 
Field Summary
private  java.io.File baseDir
           
private  java.lang.ClassLoader classLoader
           
private  org.apache.tools.ant.types.Path classpath
           
private  java.io.File destDir
           
private  DVSL dvsl
           
private  boolean force
           
private  java.io.File inFile
           
static java.lang.String INFILENAME
          Supported app values
private  java.io.File logFile
           
private  java.io.File outFile
           
static java.lang.String OUTFILENAME
           
private  java.lang.String outputEncoding
           
private  java.io.File stylesheet
           
private  java.lang.String stylesheetEncoding
           
private  java.lang.String targetExtension
           
private  java.util.Vector toolAttr
           
private  java.io.File toolboxFile
           
private  java.util.Properties toolboxProps
           
private  boolean validatingParser
           
private  java.util.Vector velConfigAttr
           
private  java.lang.String velConfigClass
           
private  java.util.Map velConfigMap
           
 
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
DVSLTask()
          Creates a new DVSLTask Task.
 
Method Summary
 org.apache.tools.ant.types.Path createClasspath()
          Set the classpath to load the Processor through (nested element).
 DVSLTask.Tool createTool()
          support for <tool> nested element
 DVSLTask.VelocityConfig createVelConfig()
          support for <velconfig> nested element
private  void ensureDirectoryFor(java.io.File targetFile)
           
 void execute()
          Executes the task.
private  void process(java.io.File inFile, java.io.File outFile, java.io.File stylesheet)
           
private  void process(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.
 void putAppValue(java.lang.String name, java.lang.Object o)
          Sets an application value from outside of the DVSL task
 void setBasedir(java.io.File dir)
          Set the base directory.
 void setClasspath(org.apache.tools.ant.types.Path classpath)
          Set the classpath to load the Processor through (attribute).
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
          Set the classpath to load the Processor through via reference (attribute).
 void setDestdir(java.io.File dir)
          Set the destination directory where the generated files should be directed.
 void setExtension(java.lang.String name)
          Set the desired file extension to be used for the target files.
 void setForce(boolean force)
          Set whether to check dependencies, or always generate.
 void setIn(java.io.File inFile)
          Sets an input xml file to be styled
 void setLogFile(java.io.File logFile)
          Sets the file to use for logging.
 void setOut(java.io.File outFile)
          Sets an output file
 void setOutputEncoding(java.lang.String encoding)
          Sets the character encoding for output files.
 void setStyle(java.io.File dvslFile)
          Sets the file to use for stylesheet.
 void setStyleEncoding(java.lang.String dvslFileEncoding)
          Sets the encoding of stylesheet file.
 void setToolbox(java.lang.String toolboxFile)
          Deprecated. use setToolboxFile instead
 void setToolboxFile(java.io.File toolboxFile)
          Sets the Toolbox properties file to use.
 void setValidatingParser(boolean validating)
          Sets the flag to have DVSL use a validating parser for the input documents
 void setVelocityConfigClass(java.lang.String classname)
          Allows the user to specify a class that implements Properties that will have user properties to be used when setting up DVSL.
private  long transform(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
 
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
 

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
Constructor Detail

DVSLTask

public DVSLTask()
Creates a new DVSLTask Task.

Method Detail

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

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 instead

Sets 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 implements Properties that 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.BuildException
Processes 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.Exception

Does the actual transform

Parameters:
inFile - XML document source
outFile - 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



Copyright (c) 2001-2007 Apache Software Foundation