java.lang.Cloneable
AbstractCvsTask
, AbstractJarSignerTask
, Ant
, Antlib
, AntlibDefinition
, ANTLR
, AntStructure
, AntVersion
, AugmentReference
, Available
, Basename
, BindTargets
, BorlandGenerateClient
, BuildNumber
, CallTarget
, Classloader
, ClearCase
, CloseResources
, CommandLauncherTask
, Concat
, Continuus
, Copy
, Copyfile
, CopyPath
, CVSPass
, DefaultExcludes
, Deltree
, DiagnosticsTask
, Dirname
, DispatchTask
, Echo
, EchoProperties
, EmailTask
, Exec
, ExecTask
, Exit
, Expand
, Filter
, FTP
, FTPTask
, Funtest
, GenerateKey
, Get
, HostInfo
, ImportTask
, Input
, IPlanetEjbcTask
, JarLibAvailableTask
, JarLibDisplayTask
, JarLibManifestTask
, JarLibResolveTask
, Java
, JavaCC
, Javadoc
, Javah
, JDBCTask
, JDependTask
, JJDoc
, JJTree
, JUnitLauncherTask
, JUnitTask
, KeySubst
, Length
, LoadProperties
, LoadResource
, Local
, MacroInstance
, MakeUrl
, ManifestClassPath
, ManifestTask
, MatchingTask
, Mkdir
, MSVSS
, Nice
, Pack
, Parallel
, Patch
, PathConvert
, ProjectHelperTask
, Property
, PropertyFile
, PropertyHelperTask
, Pvcs
, Recorder
, Rename
, ReplaceRegExp
, ResourceCount
, Retry
, RExecTask
, Rpm
, Script
, ScriptDefBase
, Sequential
, ServerDeploy
, SetPermissions
, SetProxy
, Sleep
, SOS
, SoundTask
, SplashTask
, SSHBase
, SubAnt
, Sync
, TaskAdapter
, TelnetTask
, TempFile
, Touch
, Truncate
, Tstamp
, UnknownElement
, Unpack
, UpToDate
, WhichResource
, XmlProperty
, XMLResultAggregator
, XMLValidateTask
public abstract class Task extends ProjectComponent
Project.createTask(java.lang.String)
Modifier and Type | Field | Description |
---|---|---|
protected Target |
target |
Deprecated.
since 1.6.x.
|
protected java.lang.String |
taskName |
Deprecated.
since 1.6.x.
|
protected java.lang.String |
taskType |
Deprecated.
since 1.6.x.
|
protected RuntimeConfigurable |
wrapper |
Deprecated.
since 1.6.x.
|
description, location, project
Constructor | Description |
---|---|
Task() |
Modifier and Type | Method | 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.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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 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 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