com.xmlcalabash.drivers
Class CalabashTask

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 com.xmlcalabash.drivers.CalabashTask
All Implemented Interfaces:
java.lang.Cloneable, org.apache.tools.ant.types.selectors.SelectorContainer

public class CalabashTask
extends org.apache.tools.ant.taskdefs.MatchingTask

Ant task to run Calabash.

Owes a lot to Ant's <xslt> task, but this task can't become part of Ant because this task relies on Calabash, which is licensed under LGPL.

Author:
MenteaXML

Nested Class Summary
static class CalabashTask.Namespace
          The Namespace inner class represents a namespace binding.
static class CalabashTask.Option
          The Option inner class represents a pipeline option.
static class CalabashTask.Parameter
          The Parameter inner class represents a pipeline parameter, which looks a lot like an option sent to a parameter port (or ports).
static class CalabashTask.Port
          The Port inner class used to represent input and output ports.
 
Field Summary
 
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
CalabashTask()
           
 
Method Summary
 void add(org.apache.tools.ant.util.FileNameMapper fileNameMapper)
          Adds a nested filenamemapper.
 void add(org.apache.tools.ant.types.ResourceCollection rc)
          Adds a collection of resources to process in addition to the given file or the implicit fileset.
 void addConfiguredInput(CalabashTask.Port i)
          Work with an instance of an element already configured by Ant.
 void addConfiguredNamespace(CalabashTask.Namespace n)
          Work with an instance of a element already configured by Ant.
 void addConfiguredOption(CalabashTask.Option o)
          Work with an instance of a
 void addConfiguredOutput(CalabashTask.Port o)
          Work with an instance of an element already configured by Ant.
 void addConfiguredParameter(CalabashTask.Parameter p)
          Work with an instance of a element already configured by Ant.
 void addConfiguredPipeline(org.apache.tools.ant.types.resources.Resources rc)
          Add a nested <pipeline> element.
 void addMapper(org.apache.tools.ant.types.Mapper mapper)
          Defines the mapper to map source to destination files.
 void addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)
          A system property to set during transformation.
 void addSyspropertyset(org.apache.tools.ant.types.PropertySet sysp)
          A set of system properties to set during transformation.
 void execute()
          Do the work.
protected  void handleError(java.lang.String msg)
          Throws an exception with the given message if failOnError is true, otherwise logs the message using the WARN level.
protected  void handleError(java.lang.Throwable ex)
          Throws an exception with the given nested exception if failOnError is true, otherwise logs the message using the WARN level.
 void setBasedir(java.io.File dir)
          Set the base directory; optional, default is the project's basedir.
 void setDebug(boolean debug)
          Set whether to enable debugging output; optional, default is false.
 void setDestdir(java.io.File dir)
          Set the destination directory into which the XSL result files should be copied to; required, unless in and out are specified.
 void setExtension(java.lang.String name)
          Set the desired file extension to be used for the target; optional, default is '-out.xml'.
 void setFailOnError(boolean b)
          Whether any errors should make the build fail.
 void setFailOnNoResources(boolean b)
          Whether the build should fail if the nested resource collection is empty.
 void setForce(boolean force)
          Set whether to check dependencies, or always generate; optional, default is false.
 void setGeneralValues(boolean generalValues)
          Set whether to enable general values; optional, default is false.
 void setIn(org.apache.tools.ant.types.Resource inResource)
          Set the input resource.
 void setinPort(java.lang.String port)
          Set the input port name.
 void setJSONFlavor(java.lang.String jsonFlavor)
          Set whether to automatically translate between JSON and XML; optional, default is false.
 void setOut(org.apache.tools.ant.types.Resource outResource)
          Set the output resource.
 void setOutPort(java.lang.String port)
          Set the output port name.
 void setPipeline(java.lang.String uri)
          Set the pipeline.
 void setPipelineResource(org.apache.tools.ant.types.Resource pipelineResource)
          API method to set the pipeline Resource.
 void setScanIncludedDirectories(boolean b)
          Whether to process all files in the included directories as well; optional, default is true.
 void setTransparentJSON(boolean transparentJSON)
          Set whether to automatically translate between JSON and XML; optional, default is false.
 void setUseImplicitFileset(boolean useimplicitfileset)
          Whether to use the implicit fileset.
 void setUseXslt10(boolean useXslt10)
          Set whether to enable use of XSLT 1.0; optional, default is false.
 void setXPointerOnText(boolean xpointerOnText)
          Set whether xpointer attribute on an XInclude element can be used when parse="text"; optional, default is false.
 
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 Detail

CalabashTask

public CalabashTask()
Method Detail

setBasedir

public void setBasedir(java.io.File dir)
Set the base directory; optional, default is the project's basedir.

Parameters:
dir - the base directory

setinPort

public void setinPort(java.lang.String port)
Set the input port name. optional, default is the first unmatched pipeline input port.

Parameters:
port - the port name

setIn

public void setIn(org.apache.tools.ant.types.Resource inResource)
Set the input resource. optional, implicit and/or explicit filest will be used if this and outResource are not set.

Parameters:
inResource - the Resource

addConfiguredInput

public void addConfiguredInput(CalabashTask.Port i)
Work with an instance of an element already configured by Ant.

Parameters:
i - the configured input Port

setFailOnNoResources

public void setFailOnNoResources(boolean b)
Whether the build should fail if the nested resource collection is empty.


setPipeline

public void setPipeline(java.lang.String uri)
Set the pipeline. optional, nested <pipeline> will be used if not set.

Parameters:
uri - pipeline location

setPipelineResource

public void setPipelineResource(org.apache.tools.ant.types.Resource pipelineResource)
API method to set the pipeline Resource.

Parameters:
pipelineResource - Resource to set as the pipeline.

addConfiguredPipeline

public void addConfiguredPipeline(org.apache.tools.ant.types.resources.Resources rc)
Add a nested <pipeline> element.

Parameters:
rc - the configured Resources object represented as <pipeline>.

setDestdir

public void setDestdir(java.io.File dir)
Set the destination directory into which the XSL result files should be copied to; required, unless in and out are specified.

Parameters:
dir - the name of the destination directory

setOutPort

public void setOutPort(java.lang.String port)
Set the output port name. optional, default is the first unmatched pipeline output port.

Parameters:
port - the port name

setOut

public void setOut(org.apache.tools.ant.types.Resource outResource)
Set the output resource. optional, implicit and/or explicit filest will be used if this and inResource are not set.

Parameters:
outResource - the Resource

addConfiguredOutput

public void addConfiguredOutput(CalabashTask.Port o)
Work with an instance of an element already configured by Ant.

Parameters:
o - the configured Port

setExtension

public void setExtension(java.lang.String name)
Set the desired file extension to be used for the target; optional, default is '-out.xml'.

Parameters:
name - the extension to use

setFailOnError

public void setFailOnError(boolean b)
Whether any errors should make the build fail.


add

public void add(org.apache.tools.ant.types.ResourceCollection rc)
Adds a collection of resources to process in addition to the given file or the implicit fileset.

Parameters:
rc - the collection of resources to style

setUseImplicitFileset

public void setUseImplicitFileset(boolean useimplicitfileset)
Whether to use the implicit fileset.

Set this to false if you want explicit control with nested resource collections.

Parameters:
useimplicitfileset - set to true if you want to use implicit fileset

setScanIncludedDirectories

public void setScanIncludedDirectories(boolean b)
Whether to process all files in the included directories as well; optional, default is true.

Parameters:
b - true if files in included directories are processed.

addMapper

public void addMapper(org.apache.tools.ant.types.Mapper mapper)
               throws org.apache.tools.ant.BuildException
Defines the mapper to map source to destination files.

Parameters:
mapper - the mapper to use
Throws:
org.apache.tools.ant.BuildException - if more than one mapper is defined

add

public void add(org.apache.tools.ant.util.FileNameMapper fileNameMapper)
         throws org.apache.tools.ant.BuildException
Adds a nested filenamemapper.

Parameters:
fileNameMapper - the mapper to add
Throws:
org.apache.tools.ant.BuildException - if more than one mapper is defined

setForce

public void setForce(boolean force)
Set whether to check dependencies, or always generate; optional, default is false.

Parameters:
force - true if always generate.

addSysproperty

public void addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)
A system property to set during transformation.


addSyspropertyset

public void addSyspropertyset(org.apache.tools.ant.types.PropertySet sysp)
A set of system properties to set during transformation.


addConfiguredNamespace

public void addConfiguredNamespace(CalabashTask.Namespace n)
Work with an instance of a element already configured by Ant.

Parameters:
n - the configured Namespace

addConfiguredOption

public void addConfiguredOption(CalabashTask.Option o)
Work with an instance of a
Parameters:
o - the configured Option

addConfiguredParameter

public void addConfiguredParameter(CalabashTask.Parameter p)
Work with an instance of a element already configured by Ant.

Parameters:
p - the configured Parameter

setDebug

public void setDebug(boolean debug)
Set whether to enable debugging output; optional, default is false.

Parameters:
debug - true if enable debug output

setGeneralValues

public void setGeneralValues(boolean generalValues)
Set whether to enable general values; optional, default is false.

Parameters:
generalValues - true if enable general values
See Also:
General values extension

setXPointerOnText

public void setXPointerOnText(boolean xpointerOnText)
Set whether xpointer attribute on an XInclude element can be used when parse="text"; optional, default is false.

Parameters:
xpointerOnText - true if enable XPointer on text

setUseXslt10

public void setUseXslt10(boolean useXslt10)
Set whether to enable use of XSLT 1.0; optional, default is false.

Parameters:
useXslt10 - true if enable XSLT 1.0 support

setTransparentJSON

public void setTransparentJSON(boolean transparentJSON)
Set whether to automatically translate between JSON and XML; optional, default is false.

Parameters:
transparentJSON - true if enable translation

setJSONFlavor

public void setJSONFlavor(java.lang.String jsonFlavor)
Set whether to automatically translate between JSON and XML; optional, default is false.

Parameters:
jsonFlavor - the flavor of JSON/XML transformation to use

execute

public void execute()
Do the work.

Overrides:
execute in class org.apache.tools.ant.Task

handleError

protected void handleError(java.lang.String msg)
Throws an exception with the given message if failOnError is true, otherwise logs the message using the WARN level.


handleError

protected void handleError(java.lang.Throwable ex)
Throws an exception with the given nested exception if failOnError is true, otherwise logs the message using the WARN level.