|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.ProjectComponent | +--org.apache.tools.ant.Task
Base class for all tasks. Use Project.createTask to create a new task instance rather than using this class directly for construction.
Project.createTask(java.lang.String)
Field Summary | |
protected java.lang.String |
description
Deprecated. You should not be accessing this variable directly. |
protected Location |
location
Deprecated. You should not be accessing this variable directly. Please use the getLocation() method. |
protected Target |
target
Deprecated. You should not be accessing this variable directly. Please use the getOwningTarget() method. |
protected java.lang.String |
taskName
Deprecated. You should not be accessing this variable directly. Please use the getTaskName() method. |
protected java.lang.String |
taskType
Deprecated. You should not be accessing this variable directly. Please use the getTaskType() method. |
protected RuntimeConfigurable |
wrapper
Deprecated. You should not be accessing this variable directly. Please use the getWrapper() method. |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary | |
Task()
Sole constructor. |
Method Summary | |
void |
execute()
Called by the project to let the task do its work. |
java.lang.String |
getDescription()
Returns the description of the current action. |
Location |
getLocation()
Returns the file/location where this task was defined. |
Target |
getOwningTarget()
Returns the container target of this task. |
RuntimeConfigurable |
getRuntimeConfigurableWrapper()
Returns the wrapper used for runtime configuration. |
java.lang.String |
getTaskName()
Returns the name to use in logging messages. |
java.lang.String |
getTaskType()
Return the type of task |
protected RuntimeConfigurable |
getWrapper()
Return the runtime configurable structure for this task |
protected void |
handleErrorFlush(java.lang.String output)
Handles an error line by logging it with the ERR priority. |
protected void |
handleErrorOutput(java.lang.String output)
Handles an error output by logging it with the WARN priority. |
protected void |
handleFlush(java.lang.String output)
Handles output by logging it with the INFO priority. |
protected int |
handleInput(byte[] buffer,
int offset,
int length)
Handle an input request by this task |
protected void |
handleOutput(java.lang.String output)
Handles output by logging it with the INFO priority. |
void |
init()
Called by the project to let the task initialize properly. |
protected boolean |
isInvalid()
Has this task been marked invalid? |
void |
log(java.lang.String msg)
Logs a message with the default (INFO) priority. |
void |
log(java.lang.String msg,
int msgLevel)
Logs a message with the given priority. |
void |
maybeConfigure()
Configures this task - if it hasn't been done already. |
void |
perform()
Performs this task if it's still valid, or gets a replacement version and performs that otherwise. |
void |
reconfigure()
Force the task to be reconfigured from it's RuntimeConfigurable |
void |
setDescription(java.lang.String desc)
Sets a description of the current action. |
void |
setLocation(Location location)
Sets the file/location where this task was defined. |
void |
setOwningTarget(Target target)
Sets the target container of this task. |
void |
setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)
Sets the wrapper to be used for runtime configuration. |
void |
setTaskName(java.lang.String name)
Sets the name to use in logging messages. |
void |
setTaskType(java.lang.String type)
Sets the name with which the task has been invoked. |
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 Target target
getOwningTarget()
method.
protected java.lang.String description
protected Location location
getLocation()
method.
protected java.lang.String taskName
getTaskName()
method.
protected java.lang.String taskType
getTaskType()
method.
protected RuntimeConfigurable wrapper
getWrapper()
method.
Constructor Detail |
public Task()
Method Detail |
public void setOwningTarget(Target target)
target
- Target in whose scope this task belongs.
May be null
, indicating a top-level task.public Target getOwningTarget()
null
if
this task is a top-level task.public void setTaskName(java.lang.String name)
name
- The name to use in logging messages.
Should not be null
.public java.lang.String getTaskName()
public void setTaskType(java.lang.String type)
type
- The name the task has been invoked as.
Should not be null
.public void setDescription(java.lang.String desc)
desc
- Description of the current action.
May be null
, indicating that no description is
available.public java.lang.String getDescription()
null
if
no description is available.public void init() throws BuildException
BuildException
- if something goes wrong with the buildpublic void execute() throws BuildException
BuildException
- if something goes wrong with the buildpublic Location getLocation()
null
. Location.UNKNOWN_LOCATION
is used for unknown locations.Location.UNKNOWN_LOCATION
public void setLocation(Location location)
location
- The file/location where this task was defined.
Should not be null
- use
Location.UNKNOWN_LOCATION if the location isn't known.Location.UNKNOWN_LOCATION
public RuntimeConfigurable getRuntimeConfigurableWrapper()
public void setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)
wrapper
- The wrapper to be used for runtime configuration.
May be null
, in which case the next call
to getRuntimeConfigurableWrapper will generate a new
wrapper.public void maybeConfigure() throws BuildException
BuildException
- if the task cannot be configured.public void reconfigure()
protected void handleOutput(java.lang.String output)
output
- The output to log. Should not be null
.protected void handleFlush(java.lang.String output)
output
- The output to log. Should not be null
.protected int handleInput(byte[] buffer, int offset, int length) throws java.io.IOException
buffer
- the buffer into which data is to be read.offset
- the offset into the buffer at which data is stored.length
- the amount of data to read
java.io.IOException
- if the data cannot be readprotected void handleErrorOutput(java.lang.String output)
output
- The error output to log. Should not be null
.protected void handleErrorFlush(java.lang.String output)
output
- The error output to log. Should not be null
.public void log(java.lang.String msg)
log
in class ProjectComponent
msg
- The message to be logged. Should not be null
.public void log(java.lang.String msg, int msgLevel)
log
in class ProjectComponent
msg
- The message to be logged. Should not be null
.msgLevel
- The message priority at which this message is to
be logged.public final void perform()
protected final boolean isInvalid()
public java.lang.String getTaskType()
protected RuntimeConfigurable getWrapper()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |