org.apache.ant.tasks
Interface Task


public interface Task

Task is the core interface for all structures that will be processed by the TaskEngine.


Field Summary
static int EXECUTION_MODE_EXPLICIT
           
static int EXECUTION_MODE_IMPLICIT
           
static int EXECUTION_MODE_PRIORITY
           
static char NAME_SEPARATOR
           
 
Method Summary
 void execute(org.apache.ant.engine.TaskEngine engine)
          Causes the existing Task implementation to execute.
 java.lang.String getAttributeValue(java.lang.String name)
          Each Task will hold its attributes in some manner.
 Task[] getChildren()
          Returns the an array of Task objects that are subordinate to this Task.
 int getExecutionMode()
          Determines whether this Task is executed whenever its parent is executed, or if its execution must be specifically requested.
 java.lang.String getFullyQualifiedName()
          The "fully-qualified" name of a Task is the Task's name, prepended by its parent's name, prepended by its parent's name, etc.
 Task getParent()
          Returns this Task's parent Task.
 Task getRootTask()
          Proceed backwards through the nodes until we come across the first Task in the tree.
 Task getTask(java.lang.String taskPath)
          A mechanism for locating a task relative to the current task.
 java.lang.String getTaskName()
          Just a simple name used to identify a Task.
 void init(org.apache.ant.engine.TaskEngine engine)
          Called when the Task first gets "noticed" by the TaskEngine.
 boolean isPropertyContainer()
          Determines whether a Task is suitable for holding property values.
 void setParent(Task parent)
          Sets the Task's parent.
 void validate()
          Each Task should have the ability to validate its state.
 

Field Detail

EXECUTION_MODE_IMPLICIT

public static final int EXECUTION_MODE_IMPLICIT

EXECUTION_MODE_EXPLICIT

public static final int EXECUTION_MODE_EXPLICIT

EXECUTION_MODE_PRIORITY

public static final int EXECUTION_MODE_PRIORITY

NAME_SEPARATOR

public static final char NAME_SEPARATOR
Method Detail

execute

public void execute(org.apache.ant.engine.TaskEngine engine)
             throws org.apache.ant.AntException
Causes the existing Task implementation to execute.

init

public void init(org.apache.ant.engine.TaskEngine engine)
          throws org.apache.ant.AntException
Called when the Task first gets "noticed" by the TaskEngine.

validate

public void validate()
              throws org.apache.ant.AntException
Each Task should have the ability to validate its state. This would be invoked by the TaskEngine prior to commencing an execution cycle.

getTaskName

public java.lang.String getTaskName()
Just a simple name used to identify a Task. This name is only sufficient for simple debugging and GUI output. It does not uniquely identify a Task.
See Also:
getFullyQualifiedName()

getTask

public Task getTask(java.lang.String taskPath)
A mechanism for locating a task relative to the current task. This navigation sceme will mimic a typical OS system. '..' will move back a level in the Task tree. If taskPath begins with '/' then the root node will be used as a starting point.

Returns null of no task is found at this location.

getRootTask

public Task getRootTask()
Proceed backwards through the nodes until we come across the first Task in the tree. This is the root Task.

getFullyQualifiedName

public java.lang.String getFullyQualifiedName()
The "fully-qualified" name of a Task is the Task's name, prepended by its parent's name, prepended by its parent's name, etc. This method may be used by the Task's hashCode() method to calculate a hash that will uniquely identify a Task.

getExecutionMode

public int getExecutionMode()
Determines whether this Task is executed whenever its parent is executed, or if its execution must be specifically requested.

EXECUTION_MODE_EXPLICIT
Requires interaction by the TaskEngine in order to execute.
EXECUTION_MODE_IMPLICIT
This Task is automatically executed when its parent is executed.
EXECUTION_MODE_PRIORITY
These Tasks are executed prior to its parent's execution

The default mode should probably be EXECUTION_MODE_IMPLICIT. In the build domain of Ant, every Task below a Task will normally be executed. The major exception to this is the Target. When a Project Task is executed, all Target Tasks do not automatically fire, however all Property Tasks do execute.

isPropertyContainer

public boolean isPropertyContainer()
Determines whether a Task is suitable for holding property values.

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String name)
Each Task will hold its attributes in some manner. This method will allow the Task implementation to return the value of its attribute.

getParent

public Task getParent()
Returns this Task's parent Task. If this Task is the root Task, then this method will return null.

setParent

public void setParent(Task parent)
Sets the Task's parent.

getChildren

public Task[] getChildren()
Returns the an array of Task objects that are subordinate to this Task.