org.apache.tools.ant
public abstract class Task extends ProjectComponent
See Also: Project
Field Summary | |
---|---|
protected Target | target
Target this task belongs to, if any. |
protected String | taskName
Name of this task to be used for logging purposes.
|
protected String | taskType
Type of this task.
|
protected RuntimeConfigurable | wrapper
Wrapper for this object, used to configure it at runtime.
|
Constructor Summary | |
---|---|
Task() Sole constructor. |
Method Summary | |
---|---|
void | bindToOwner(Task owner)
Bind a task to another; use this when configuring a newly created
task to do work on behalf of another.
|
void | execute()
Called by the project to let the task do its work. |
Target | getOwningTarget()
Returns the container target of this task.
|
RuntimeConfigurable | getRuntimeConfigurableWrapper()
Returns the wrapper used for runtime configuration.
|
String | getTaskName()
Returns the name to use in logging messages.
|
String | getTaskType()
Return the type of task.
|
protected RuntimeConfigurable | getWrapper()
Return the runtime configurable structure for this task.
|
protected void | handleErrorFlush(String output)
Handles an error line by logging it with the WARN priority.
|
protected void | handleErrorOutput(String output)
Handles an error output by logging it with the WARN priority.
|
protected void | handleFlush(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(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(String msg)
Logs a message with the default (INFO) priority.
|
void | log(String msg, int msgLevel)
Logs a message with the given priority. |
void | log(Throwable t, int msgLevel)
Logs a message with the given priority. |
void | log(String msg, Throwable t, 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 its RuntimeConfigurable. |
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(String name)
Sets the name to use in logging messages.
|
void | setTaskType(String type)
Sets the name with which the task has been invoked.
|
Deprecated: since 1.6.x. You should not be accessing this variable directly. Please use the getOwningTarget method.
Target this task belongs to, if any.Deprecated: since 1.6.x. You should not be accessing this variable directly. Please use the getTaskName method.
Name of this task to be used for logging purposes. This defaults to the same as the type, but may be overridden by the user. For instance, the name "java" isn't terribly descriptive for a task used within another task - the outer task code can probably provide a better one.Deprecated: since 1.6.x. You should not be accessing this variable directly. Please use the getTaskType method.
Type of this task.Deprecated: since 1.6.x. You should not be accessing this variable directly. Please use the getWrapper method.
Wrapper for this object, used to configure it at runtime.Parameters: owner owning target
Since: Ant1.7
Throws: BuildException if something goes wrong with the build.
Returns: The target containing this task, or null
if
this task is a top-level task.
Returns: the wrapper used for runtime configuration. This method will generate a new wrapper (and cache it) if one isn't set already.
Returns: the name to use in logging messages.
Returns: the type of task.
Returns: the runtime structure for this task.
Parameters: output The error output to log. Should not be null
.
Since: Ant 1.5.2
Parameters: output The error output to log. Should not be null
.
Parameters: output The output to log. Should not be null
.
Since: Ant 1.5.2
Parameters: 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.
Returns: the number of bytes read.
Throws: IOException if the data cannot be read.
Since: Ant 1.6
Parameters: output The output to log. Should not be null
.
Throws: BuildException if something goes wrong with the build
Returns: true if this task is no longer valid. A new task should be configured in this case.
Since: Ant 1.5
Parameters: msg The message to be logged. Should not be null
.
Parameters: msg The message to be logged. Should not be null
. msgLevel The message priority at which this message is to
be logged.
Parameters: t The exception to be logged. Should not be null
. msgLevel The message priority at which this message is to
be logged.
Since: 1.7
Parameters: msg The message to be logged. Should not be null
. t The exception to be logged. May be null
. msgLevel The message priority at which this message is to
be logged.
Since: 1.7
Throws: BuildException if the task cannot be configured.
Parameters: target Target in whose scope this task belongs.
May be null
, indicating a top-level task.
Parameters: 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.
Parameters: name The name to use in logging messages.
Should not be null
.
Parameters: type The name the task has been invoked as.
Should not be null
.