public abstract class Task extends ProjectComponent
Project.createTask(java.lang.String)| Modifier and Type | Field and Description |
|---|---|
protected Target |
target
Deprecated.
since 1.6.x.
You should not be accessing this variable directly.
Please use the
getOwningTarget() method. |
protected java.lang.String |
taskName
Deprecated.
since 1.6.x.
You should not be accessing this variable directly.
Please use the
getTaskName() method. |
protected java.lang.String |
taskType
Deprecated.
since 1.6.x.
You should not be accessing this variable directly.
Please use the
getTaskType() method. |
protected RuntimeConfigurable |
wrapper
Deprecated.
since 1.6.x.
You should not be accessing this variable directly.
Please use the
getWrapper() method. |
description, location, project| Constructor and Description |
|---|
Task() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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 WARN 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 |
log(java.lang.String msg,
java.lang.Throwable t,
int msgLevel)
Logs a message with the given priority.
|
void |
log(java.lang.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(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.
|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject@Deprecated protected Target target
getOwningTarget() method.@Deprecated protected java.lang.String taskName
getTaskName() method.@Deprecated protected java.lang.String taskType
getTaskType() method.@Deprecated protected RuntimeConfigurable wrapper
getWrapper() method.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 init()
throws BuildException
BuildException - if something goes wrong with the buildpublic void execute()
throws BuildException
BuildException - if something goes wrong with the build.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 read.protected 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 ProjectComponentmsg - The message to be logged. Should not be null.public void log(java.lang.String msg,
int msgLevel)
log in class ProjectComponentmsg - The message to be logged. Should not be null.msgLevel - The message priority at which this message is to
be logged.public void log(java.lang.Throwable t,
int msgLevel)
t - The exception to be logged. Should not be null.msgLevel - The message priority at which this message is to
be logged.public void log(java.lang.String msg,
java.lang.Throwable t,
int msgLevel)
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.public final void perform()
protected final boolean isInvalid()
public java.lang.String getTaskType()
protected RuntimeConfigurable getWrapper()
public final void bindToOwner(Task owner)
init().
If you are creating a task to delegate work to, call init()
to initialize it.owner - owning target