|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.barracudamvc.taskdefs.EventBuilder
This Ant taskdef reads in an xml file that conforms to BarracudaEventBuilder.dtd and generates a set of event classes according to the specified structure. The primary benefit of this is that it makes it very easy to declaratively define event hierarchies that still get compiled to real Java classes (thereby retaining the benefits of strong typing which you get through the manual approach)
This taskdef takes two required parameters: sourceout (which
should point to a location to write generated .java event source files) and
descriptor (which should refer to the location of a valid xml file
describing the event hierarchy).
Second, there is a third optional parameter:
template which should refer to the localtion of the template file
for generating the Java classes. Specifying this parameter will overwrite the
template attribute inside the "build-events" tag in the xml file.
Look at the Barracuda build.xml file for further usage examples.
csc_010404_1 - 2 minor but important enhancements: a) you can now use the template attribute in all parts of the event file, making it possible to specify different templates for individual events, and b) added the ability to replace any key values in the template, simply by including them in the attributes. For instance, if you use a custom attribute which is NOT defined in the dtd (ie. foo="blah"), the task will attempt to replace @foo@ in the specified template with the value 'blah'. For examples of both of these things, see src\org\barracuda\examples\ex1\events.xml
Field Summary | |
protected String |
parserClass
|
protected File |
sourceOutDir
|
protected File |
templateFile
|
protected File |
xmlFile
|
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary | |
EventBuilder()
|
Method Summary | |
void |
execute()
Parse the specified event.xml file, generate event classes from it, and then compile the resulting classes. |
void |
setDescriptor(File xmlFile)
Sets the xml event descriptor file. |
void |
setSourceout(String sourceOutDir)
Sets directory where source is generated. |
void |
setTemplate(File templateFile)
Sets the Java class template. |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String parserClass
protected File xmlFile
protected File templateFile
protected File sourceOutDir
Constructor Detail |
public EventBuilder()
Method Detail |
public void setDescriptor(File xmlFile)
public void setSourceout(String sourceOutDir)
public void setTemplate(File templateFile)
public void execute() throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |