org.barracudamvc.taskdefs
Class EventBuilder

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.barracudamvc.taskdefs.EventBuilder

public class EventBuilder
extends org.apache.tools.ant.Task

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

Author:
Christian Cryder [christianc@granitepeaks.com], Thorsten M�ller - ThorstenMoeller(at)web.de

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

parserClass

protected String parserClass

xmlFile

protected File xmlFile

templateFile

protected File templateFile

sourceOutDir

protected File sourceOutDir
Constructor Detail

EventBuilder

public EventBuilder()
Method Detail

setDescriptor

public void setDescriptor(File xmlFile)
Sets the xml event descriptor file.


setSourceout

public void setSourceout(String sourceOutDir)
Sets directory where source is generated.


setTemplate

public void setTemplate(File templateFile)
Sets the Java class template.


execute

public void execute()
             throws org.apache.tools.ant.BuildException
Parse the specified event.xml file, generate event classes from it, and then compile the resulting classes.

Throws:
org.apache.tools.ant.BuildException


Copyright © 2004 BarracudaMVC.org All Rights Reserved.