org.oddjob.ant
Class AntJob

java.lang.Object
  extended byorg.oddjob.framework.BaseComponent
      extended byorg.oddjob.framework.BasePrimary
          extended byorg.oddjob.framework.SimpleJob
              extended byorg.oddjob.ant.AntJob
All Implemented Interfaces:
Iconic, Resetable, java.lang.Runnable, Stateful

public class AntJob
extends SimpleJob

Description:
Run a series of Ant tasks. This job doesn't run Ant, instead it uses the ant tasks directly. Oddjob creates and configures the tasks and this has some side affects: Not all tasks will work and not all have been tested.
Example:
Please see the ant example in the provided examples.

Field Summary
 
Fields inherited from class org.oddjob.framework.BasePrimary
stop
 
Fields inherited from class org.oddjob.framework.BaseComponent
changes, destroyed, iconHelper, location, lock, stateHandler
 
Constructor Summary
AntJob()
           
 
Method Summary
 void addComponent(org.apache.tools.ant.ProjectComponent component)
          Add an Ant ProjectComponent to this job.
protected  int execute()
          Execute the tasks.
 java.lang.String getMessageLevel()
           
 java.io.OutputStream getOutput()
          Return the ant tasks output.
 org.apache.tools.ant.Project getProject()
          Get the project used for the tasks.
 ArooaHandler handlerFor(ArooaContext context)
          Provide a handler to parse children.
 void onDestroy()
          Destroy.
 void setMessageLevel(java.lang.String messageLevel)
           
 void setOutput(java.io.OutputStream out)
           
 void setProject(org.apache.tools.ant.Project project)
          Set the project to use for the tasks.
 
Methods inherited from class org.oddjob.framework.SimpleJob
hardReset, independant, onStop, run, softReset, stop
 
Methods inherited from class org.oddjob.framework.BasePrimary
configurationComplete, getLogger, getName, logger, setContext, setJobStateReady, setLogger, setName, sleep, toString
 
Methods inherited from class org.oddjob.framework.BaseComponent
addIconListener, addJobStateListener, addPropertyChangeListener, arooaRuntime, arooaRuntime, canHardReset, canSoftReset, configure, destroy, getLocation, iconForId, lastJobStateEvent, removeIconListener, removeJobStateListener, removePropertyChangeListener, setJobStateComplete, setJobStateException, setJobStateNotComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Stateful
addJobStateListener, removeJobStateListener
 

Constructor Detail

AntJob

public AntJob()
Method Detail

handlerFor

public ArooaHandler handlerFor(ArooaContext context)
Provide a handler to parse children.


addComponent

public void addComponent(org.apache.tools.ant.ProjectComponent component)
Add an Ant ProjectComponent to this job.

Parameters:
component - The project component.

setOutput

public void setOutput(java.io.OutputStream out)

getOutput

public java.io.OutputStream getOutput()
Return the ant tasks output.

Returns:
The output as a string.

getProject

public org.apache.tools.ant.Project getProject()
Get the project used for the tasks.

Returns:
The project.

setProject

public void setProject(org.apache.tools.ant.Project project)
                throws OddjobException
Set the project to use for the tasks. Can only be set once. It is assumed the project is already initialised.

Parameters:
project - The project.
Throws:
OddjobException - if the project is already set.

setMessageLevel

public void setMessageLevel(java.lang.String messageLevel)

getMessageLevel

public java.lang.String getMessageLevel()

execute

protected int execute()
               throws java.lang.Exception
Execute the tasks.

Specified by:
execute in class SimpleJob
Returns:
0 if the job is complete, anything else otherwise.
Throws:
java.lang.Exception - If the unexpected occurs.

onDestroy

public void onDestroy()
Destroy.

Overrides:
onDestroy in class BaseComponent