Description
Process a set of documents with the
Jacson
engine.
This tasks depends on jar files not included in
Ant distribution. You need at least jacson.jar
in classpath. Depending on what you actually do you might
need other jars. See above Jacson homepage for details.
Registering this task into Ant goes like
<taskdef name="jacson"
classname="de.spieleck.app.jacson.ant.JacsonTask"/>
You might use optional classpath attributes or elements to
load Jacson from a special classpath.
Below documentation (as well as the task itself) contains quoted
material from the Ant Core task Style.
It is possible to refine the set of files that are being processed. This can be done with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. With the includes or includesfile attribute you specify the files you want to have included by using patterns. The exclude or excludesfile attribute is used to specify the files you want to have excluded. This is also done with patterns. And finally with the defaultexcludes attribute, you can specify whether you want to use default exclusions or not. See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.
This task forms an implicit FileSet and supports all attributes of <fileset> (dir becomes basedir) as well as the nested <include>, <exclude> and <patternset> elements.
This task is aware of the surrounding Ant environment: Ant
properties are mapped into <se:param/> parameters in the Jacson
configuration. An <se:param/> in a Jacson configuration
will actually create the corresponding property in the Ant project.
This task supports the use of nested <param/> elements
which set values in an <se:param/> declaration. <param/>
elements override values of properties with the same name
and disable Jacson from overriding the
corresponding property in the Ant project.
Parameters
JacsonTask is a subclass of Ant's MatchingTask and can
work on complex filesets. These should be described
elsewhere in the Ant documentation.
Attribute | Description | Required | basedir | where to find the input file, defaults to
project basedir. | No | config | name of the configuration file to use - given either relative
to the project's basedir or as an absolute path.
| Yes | force | Recreate target files, even if they are newer
than their corresponding source files or the stylesheet. | not yet implemented! | in | specifies a single file to be filtered.
This overrides all fileset definitions! | No | out | Specifies an output file. If used this output
file overrides all outputfiles in reports of the configuration.
If the configuration has multiple reports they get merged into
the single outputfile in a deterministic but hard to predict
fashion. XXX If the configuration carries filenames on reports,
these files are created but are then empty after using "out".
The cleanest way to control Jacson output is currently to
use filename="${fname}" in the configuration and
pass the value of fname either as property or param the Task.
| No, not recommended! | includes | comma- or space-separated list of patterns of files that must be included.
All files are included when omitted. | No | includesfile | the name of a file. Each line of this file is taken to be
an include pattern | No | excludes | comma- or space-separated list of patterns of files that must be excluded.
No files (except default excludes) are excluded when omitted. | No | excludesfile | the name of a file. Each line of this file is taken to be
an exclude pattern | No | defaultexcludes | indicates whether default excludes should be used or not
("yes"/"no"). Default excludes are used when omitted. | No | scanincludeddirectories | If any directories are matched by the
includes/excludes patterns, try to transform all files in these
directories. Default is true | No |
Nested Elementsdirectory basedparamParam is used to pass a <se:param/> parameters to the
Jacson configuration. param ParametersAttribute | Description | Required | name | Name of the parameter | Yes | value | The string value to be placed into the param. | Yes |
This example uses the Jacson configuration head.con
to process the single input file data/access.log.gz
and write the result to demo3.txt <target name="topfilter">
<jacson config="head.conf"
out="topfilter.properties"
in="data/access.log.gz"
/>
</target>
If head.conf used Jacsons PrintingReport
then subsequent ant task can refer to the results of Jacson by
reading the topfilter.properties file.
This uses the loganalysis.conf configuration
to analyze a whole hierarchy of files.
<target name="demo1" depends="taskdemo-prepare">
<jacson config="loganalysis.conf">
<include name="logfiles/**"/>
</jacson>
</target>
Since no <out> is specified the output files are
controlled by the configuration. It might still be controlled
by Ant properties which map to parameters in the configuration.
|