com.judoscript.util
Class AntFacade

java.lang.Object
  extended by org.apache.tools.ant.Project
      extended by com.judoscript.util.AntFacade
All Implemented Interfaces:
org.apache.tools.ant.types.ResourceFactory

public class AntFacade
extends org.apache.tools.ant.Project

The study is to programmatically construct a Task and execute it.

The topics includes:

The runtime Project includes these issues:
  1. System.out and System.err redirected to another agent's.
  2. System properties shared with another agent.
  3. Exception and return values.


Field Summary
 
Fields inherited from class org.apache.tools.ant.Project
JAVA_1_0, JAVA_1_1, JAVA_1_2, JAVA_1_3, JAVA_1_4, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, TOKEN_END, TOKEN_START
 
Constructor Summary
AntFacade()
           
AntFacade(java.io.PrintWriter out, java.io.PrintWriter err)
           
 
Method Summary
 void executeTask()
          Executes the task, if the task is not null.
 void newTask(java.lang.String name)
          Creates a new task for this project.
 void objectAddText(java.lang.Object o, java.lang.String text)
          A helper method to set text for an embedded object.
 java.lang.Object objectCreateElement(java.lang.Object o, java.lang.String name)
          A helper method to create a child element for an embedded object.
 void objectSetAttribute(java.lang.Object o, java.lang.String name, java.lang.String value)
          A helper method to set attribute for an embedded object.
 void taskAddText(java.lang.String text)
          Adds text to the task, if task is not null.
 java.lang.Object taskCreateElement(java.lang.String name)
          Creates an element for the named element in task, if the task is not null.
 void taskSetAttribute(java.lang.String name, java.lang.String value)
          Sets the attribute for the task, if task is not null.
 
Methods inherited from class org.apache.tools.ant.Project
addBuildListener, addDataTypeDefinition, addFilter, addIdReference, addOrReplaceTarget, addOrReplaceTarget, addReference, addTarget, addTarget, addTaskDefinition, checkTaskClass, copyFile, copyFile, copyFile, copyFile, copyFile, copyFile, copyFile, copyFile, copyInheritedProperties, copyUserProperties, createClassLoader, createClassLoader, createDataType, createSubProject, createTask, defaultInput, demuxFlush, demuxInput, demuxOutput, executeSortedTargets, executeTarget, executeTargets, fireBuildFinished, fireBuildStarted, fireMessageLogged, fireMessageLogged, fireMessageLogged, fireMessageLogged, fireMessageLogged, fireMessageLogged, fireSubBuildFinished, fireSubBuildStarted, fireTargetFinished, fireTargetStarted, fireTaskFinished, fireTaskStarted, getBaseDir, getBuildListeners, getCopyOfDataTypeDefinitions, getCopyOfReferences, getCopyOfTargets, getCopyOfTaskDefinitions, getCoreLoader, getDataTypeDefinitions, getDefaultInputStream, getDefaultTarget, getDescription, getElementName, getExecutor, getFilters, getGlobalFilterSet, getInheritedProperties, getInputHandler, getJavaVersion, getName, getProject, getProperties, getProperty, getReference, getReferences, getResource, getTargets, getTaskDefinitions, getThreadTask, getUserProperties, getUserProperty, hasReference, inheritIDReferences, init, initProperties, initSubProject, isKeepGoingMode, log, log, log, log, log, log, log, registerThreadTask, removeBuildListener, replaceProperties, resolveFile, resolveFile, setBaseDir, setBasedir, setCoreLoader, setDefault, setDefaultInputStream, setDefaultTarget, setDescription, setExecutor, setFileLastModified, setInheritedProperty, setInputHandler, setJavaVersionProperty, setKeepGoingMode, setName, setNewProperty, setProjectReference, setProperty, setSystemProperties, setUserProperty, toBoolean, topoSort, topoSort, topoSort, translatePath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntFacade

public AntFacade()

AntFacade

public AntFacade(java.io.PrintWriter out,
                 java.io.PrintWriter err)
Method Detail

newTask

public void newTask(java.lang.String name)
             throws java.lang.IllegalArgumentException
Creates a new task for this project. The project never have more than one task.

Parameters:
name -
Throws:
java.lang.IllegalArgumentException

taskAddText

public void taskAddText(java.lang.String text)
                 throws java.lang.IllegalArgumentException
Adds text to the task, if task is not null.

Parameters:
text -
Throws:
java.lang.IllegalArgumentException

taskSetAttribute

public void taskSetAttribute(java.lang.String name,
                             java.lang.String value)
                      throws java.lang.IllegalArgumentException
Sets the attribute for the task, if task is not null.

Throws:
java.lang.IllegalArgumentException

taskCreateElement

public java.lang.Object taskCreateElement(java.lang.String name)
                                   throws java.lang.IllegalArgumentException
Creates an element for the named element in task, if the task is not null.

Parameters:
name -
Returns:
the new element created.
Throws:
java.lang.IllegalArgumentException

objectAddText

public void objectAddText(java.lang.Object o,
                          java.lang.String text)
A helper method to set text for an embedded object.

Parameters:
o - the object, typically returned by taskCreateElement(), to be add text to.
text -
See Also:
taskCreateElement(String)

objectSetAttribute

public void objectSetAttribute(java.lang.Object o,
                               java.lang.String name,
                               java.lang.String value)
A helper method to set attribute for an embedded object.

Parameters:
o - the object, typically returned by taskCreateElement(), to be set attribute to.
name -
value -

objectCreateElement

public java.lang.Object objectCreateElement(java.lang.Object o,
                                            java.lang.String name)
A helper method to create a child element for an embedded object.

Parameters:
o - the object, typically returned by taskCreateElement(), to be created a child for.
name -
Returns:

executeTask

public void executeTask()
                 throws java.lang.Throwable
Executes the task, if the task is not null.

Throws:
java.lang.Throwable