| java.lang.Object org.apache.tools.ant.ProjectComponent org.apache.tools.ant.Task
All known Subclasses: org.apache.tools.ant.taskdefs.optional.Javah, org.apache.tools.ant.taskdefs.optional.Script, org.apache.tools.ant.taskdefs.Tstamp, org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut, org.apache.tools.ant.taskdefs.Filter, org.apache.tools.ant.taskdefs.Exec, org.apache.tools.ant.taskdefs.KeySubst, org.apache.tools.ant.taskdefs.Concat, org.apache.tools.ant.taskdefs.optional.ANTLR, org.apache.tools.ant.taskdefs.optional.ejb.WLRun, org.apache.tools.ant.DummyTaskAbstract, org.apache.tools.ant.taskdefs.optional.net.RExecTask, org.apache.tools.ant.UnknownElement, org.apache.tools.ant.taskdefs.optional.ssh.SSHBase, org.apache.tools.ant.taskdefs.BuildNumber, org.apache.tools.ant.taskdefs.Input, org.apache.tools.ant.DummyTaskWithoutPublicConstructor, org.apache.tools.ant.taskdefs.optional.javacc.JJTree, org.apache.tools.ant.taskdefs.PathConvert, org.apache.tools.ant.taskdefs.optional.starteam.StarTeamTask, org.apache.tools.ant.taskdefs.TempFile, org.apache.tools.ant.taskdefs.optional.extension.JarLibAvailableTask, org.apache.tools.ant.taskdefs.Javadoc, org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy, org.apache.tools.ant.taskdefs.Get, org.apache.tools.ant.taskdefs.Property, org.apache.tools.ant.taskdefs.optional.ejb.WLStop, org.apache.tools.ant.taskdefs.MatchingTask, org.apache.tools.ant.taskdefs.optional.pvcs.Pvcs, org.apache.tools.ant.taskdefs.optional.javacc.JavaCC, org.apache.tools.ant.taskdefs.Dirname, org.apache.tools.ant.taskdefs.Patch, org.apache.tools.ant.taskdefs.SubAnt, org.apache.tools.ant.taskdefs.optional.splash.SplashTask, org.apache.tools.ant.taskdefs.LoadProperties, org.apache.tools.ant.taskdefs.Antlib, org.apache.tools.ant.taskdefs.ManifestTask, org.apache.tools.ant.taskdefs.CallTarget, org.apache.tools.ant.taskdefs.Echo, org.apache.tools.ant.taskdefs.Recorder, org.apache.tools.ant.taskdefs.optional.Rpm, org.apache.tools.ant.dispatch.DispatchTask, org.apache.tools.ant.taskdefs.optional.net.TelnetTask, org.apache.tools.ant.taskdefs.Mkdir, org.apache.tools.ant.taskdefs.Java, org.apache.tools.ant.taskdefs.Sleep, org.apache.tools.ant.taskdefs.email.EmailTask, org.apache.tools.ant.taskdefs.Ant, org.apache.tools.ant.taskdefs.optional.net.FTP, org.apache.tools.ant.taskdefs.Nice, org.apache.tools.ant.DummyTaskOk, org.apache.tools.ant.taskdefs.optional.ccm.Continuus, org.apache.tools.ant.taskdefs.Exit, org.apache.tools.ant.taskdefs.AbstractJarSignerTask, org.apache.tools.ant.taskdefs.optional.junit.JUnitTask, org.apache.tools.ant.taskdefs.optional.net.SetProxy, org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask, org.apache.tools.ant.taskdefs.optional.extension.JarLibDisplayTask, org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet, org.apache.tools.ant.taskdefs.Sequential, task.BaseTask, org.apache.tools.ant.taskdefs.Copy, org.apache.tools.ant.taskdefs.DiagnosticsTask, org.apache.tools.ant.taskdefs.Length, org.apache.tools.ant.taskdefs.Classloader, org.apache.tools.ant.taskdefs.Sync, org.apache.tools.ant.taskdefs.optional.javacc.JJDoc, org.apache.tools.ant.taskdefs.Copyfile, org.apache.tools.ant.taskdefs.GenerateKey, org.apache.tools.ant.taskdefs.CVSPass, org.apache.tools.ant.taskdefs.DefaultExcludes, org.apache.tools.ant.taskdefs.ManifestClassPath, org.apache.tools.ant.taskdefs.ResourceCount, org.apache.tools.ant.taskdefs.DynamicTask, org.apache.tools.ant.taskdefs.optional.perforce.P4Base, org.apache.tools.ant.DummyTaskWithoutDefaultConstructor, task.EchoLocation, org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase, org.apache.tools.ant.taskdefs.Pack, org.apache.tools.ant.taskdefs.JDBCTask, org.apache.tools.ant.taskdefs.ExecTask, org.apache.tools.ant.taskdefs.Unpack, org.apache.tools.ant.taskdefs.optional.sos.SOS, org.apache.tools.ant.taskdefs.optional.EchoProperties, org.apache.tools.ant.taskdefs.optional.clearcase.ClearCase, org.apache.tools.ant.taskdefs.Deltree, org.apache.tools.ant.taskdefs.Touch, org.apache.tools.ant.taskdefs.optional.ReplaceRegExp, org.apache.tools.ant.taskdefs.Available, org.apache.tools.ant.taskdefs.optional.dotnet.ImportTypelib, org.apache.tools.ant.taskdefs.optional.PropertyFile, org.apache.tools.ant.taskdefs.AbstractCvsTask, org.apache.tools.ant.taskdefs.DemuxOutputTask, org.apache.tools.ant.taskdefs.XmlProperty, org.apache.tools.ant.taskdefs.optional.dotnet.Ildasm, org.apache.tools.ant.taskdefs.Rename, org.apache.tools.ant.taskdefs.optional.vss.MSVSS, org.apache.tools.ant.taskdefs.WhichResource, org.apache.tools.ant.TaskAdapter, org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator, org.apache.tools.ant.taskdefs.optional.sound.SoundTask, org.apache.tools.ant.taskdefs.MacroInstance, org.apache.tools.ant.taskdefs.AntlibDefinition, org.apache.tools.ant.taskdefs.optional.extension.JarLibManifestTask, org.apache.tools.ant.taskdefs.Expand, org.apache.tools.ant.taskdefs.optional.extension.JarLibResolveTask, org.apache.tools.ant.taskdefs.MakeUrl, org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient, org.apache.tools.ant.types.mappers.MapperResult, org.apache.tools.ant.taskdefs.CopyPath, org.apache.tools.ant.taskdefs.Parallel, org.apache.tools.ant.taskdefs.AntStructure, org.apache.tools.ant.taskdefs.Basename, org.apache.tools.ant.taskdefs.LoadResource, org.apache.tools.ant.taskdefs.UpToDate, org.example.tasks.TaskdefTestSimpleTask, org.apache.tools.ant.taskdefs.ImportTask, org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbcTask, org.apache.tools.ant.taskdefs.optional.XMLValidateTask,
Task | abstract public class Task extends ProjectComponent (Code) | | Base class for all tasks.
Use Project.createTask to create a new task instance rather than
using this class directly for construction.
See Also: Project.createTask |
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.
This defaults to the same as the type, but may be
overridden by the user. | protected String | taskType Type of this task. | protected RuntimeConfigurable | wrapper Wrapper for this object, used to configure it at runtime. |
Constructor Summary | |
public | Task() Sole constructor. |
Method Summary | |
final public void | bindToOwner(Task owner) Bind a task to another; use this when configuring a newly created
task to do work on behalf of another. | public void | execute() Called by the project to let the task do its work. | public Target | getOwningTarget() Returns the container target of this task. | public RuntimeConfigurable | getRuntimeConfigurableWrapper() Returns the wrapper used for runtime configuration.
the wrapper used for runtime configuration. | public String | getTaskName() Returns the name to use in logging messages. | public 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.
Parameters: output - The error output to log. | protected void | handleErrorOutput(String output) Handles an error output by logging it with the WARN priority.
Parameters: output - The error output to log. | protected void | handleFlush(String output) Handles output by logging it with the INFO priority.
Parameters: output - The output to log. | protected int | handleInput(byte[] buffer, int offset, int length) Handle an input request by this task.
Parameters: buffer - the buffer into which data is to be read. Parameters: offset - the offset into the buffer at which data is stored. Parameters: length - the amount of data to read. | protected void | handleOutput(String output) Handles output by logging it with the INFO priority.
Parameters: output - The output to log. | public void | init() Called by the project to let the task initialize properly. | final protected boolean | isInvalid() Has this task been marked invalid?
true if this task is no longer valid. | public void | log(String msg) Logs a message with the default (INFO) priority.
Parameters: msg - The message to be logged. | public void | log(String msg, int msgLevel) Logs a message with the given priority. | public void | log(Throwable t, int msgLevel) Logs a message with the given priority. | public void | log(String msg, Throwable t, int msgLevel) Logs a message with the given priority. | final void | markInvalid() Marks this task as invalid. | public void | maybeConfigure() Configures this task - if it hasn't been done already. | final public void | perform() Performs this task if it's still valid, or gets a replacement
version and performs that otherwise.
Performing a task consists of firing a task started event,
configuring the task, executing it, and then firing task finished
event. | public void | reconfigure() Force the task to be reconfigured from its RuntimeConfigurable. | public void | setOwningTarget(Target target) Sets the target container of this task. | public void | setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper) Sets the wrapper to be used for runtime configuration. | public void | setTaskName(String name) Sets the name to use in logging messages. | public void | setTaskType(String type) Sets the name with which the task has been invoked. |
taskName | protected String taskName(Code) | | 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.
Task.getTaskName() |
Task | public Task()(Code) | | Sole constructor.
|
bindToOwner | final public void bindToOwner(Task owner)(Code) | | Bind a task to another; use this when configuring a newly created
task to do work on behalf of another.
Project, OwningTarget, TaskName, Location and Description are all copied
Important: this method does not call
Task.init .
If you are creating a task to delegate work to, call
Task.init to initialize it.
Parameters: owner - owning target since: Ant1.7 |
execute | public void execute() throws BuildException(Code) | | Called by the project to let the task do its work. This method may be
called more than once, if the task is invoked more than once.
For example,
if target1 and target2 both depend on target3, then running
"ant target1 target2" will run all tasks in target3 twice.
exception: BuildException - if something goes wrong with the build. |
getOwningTarget | public Target getOwningTarget()(Code) | | Returns the container target of this task.
The target containing this task, or null ifthis task is a top-level task. |
getRuntimeConfigurableWrapper | public RuntimeConfigurable getRuntimeConfigurableWrapper()(Code) | | Returns the wrapper used for runtime configuration.
the wrapper used for runtime configuration. Thismethod will generate a new wrapper (and cache it)if one isn't set already. |
getTaskName | public String getTaskName()(Code) | | Returns the name to use in logging messages.
the name to use in logging messages. |
getTaskType | public String getTaskType()(Code) | | Return the type of task.
the type of task. |
getWrapper | protected RuntimeConfigurable getWrapper()(Code) | | Return the runtime configurable structure for this task.
the runtime structure for this task. |
handleErrorFlush | protected void handleErrorFlush(String output)(Code) | | Handles an error line by logging it with the WARN priority.
Parameters: output - The error output to log. Should not be null . since: Ant 1.5.2 |
handleErrorOutput | protected void handleErrorOutput(String output)(Code) | | Handles an error output by logging it with the WARN priority.
Parameters: output - The error output to log. Should not be null . |
handleFlush | protected void handleFlush(String output)(Code) | | Handles output by logging it with the INFO priority.
Parameters: output - The output to log. Should not be null . since: Ant 1.5.2 |
handleInput | protected int handleInput(byte[] buffer, int offset, int length) throws IOException(Code) | | Handle an input request by this task.
Parameters: buffer - the buffer into which data is to be read. Parameters: offset - the offset into the buffer at which data is stored. Parameters: length - the amount of data to read. the number of bytes read. exception: IOException - if the data cannot be read. since: Ant 1.6 |
handleOutput | protected void handleOutput(String output)(Code) | | Handles output by logging it with the INFO priority.
Parameters: output - The output to log. Should not be null . |
init | public void init() throws BuildException(Code) | | Called by the project to let the task initialize properly.
The default implementation is a no-op.
exception: BuildException - if something goes wrong with the build |
isInvalid | final protected boolean isInvalid()(Code) | | Has this task been marked invalid?
true if this task is no longer valid. A new task should beconfigured in this case. since: Ant 1.5 |
log | public void log(String msg)(Code) | | Logs a message with the default (INFO) priority.
Parameters: msg - The message to be logged. Should not be null . |
log | public void log(String msg, int msgLevel)(Code) | | Logs a message with the given priority. This delegates
the actual logging to the project.
Parameters: msg - The message to be logged. Should not be null . Parameters: msgLevel - The message priority at which this message is tobe logged. |
log | public void log(Throwable t, int msgLevel)(Code) | | Logs a message with the given priority. This delegates
the actual logging to the project.
Parameters: t - The exception to be logged. Should not be null . Parameters: msgLevel - The message priority at which this message is tobe logged. since: 1.7 |
log | public void log(String msg, Throwable t, int msgLevel)(Code) | | Logs a message with the given priority. This delegates
the actual logging to the project.
Parameters: msg - The message to be logged. Should not be null . Parameters: t - The exception to be logged. May be null . Parameters: msgLevel - The message priority at which this message is tobe logged. since: 1.7 |
markInvalid | final void markInvalid()(Code) | | Marks this task as invalid. Any further use of this task
will go through a replacement with the updated definition.
|
maybeConfigure | public void maybeConfigure() throws BuildException(Code) | | Configures this task - if it hasn't been done already.
If the task has been invalidated, it is replaced with an
UnknownElement task which uses the new definition in the project.
exception: BuildException - if the task cannot be configured. |
perform | final public void perform()(Code) | | Performs this task if it's still valid, or gets a replacement
version and performs that otherwise.
Performing a task consists of firing a task started event,
configuring the task, executing it, and then firing task finished
event. If a runtime exception is thrown, the task finished event
is still fired, but with the exception as the cause.
|
reconfigure | public void reconfigure()(Code) | | Force the task to be reconfigured from its RuntimeConfigurable.
|
setOwningTarget | public void setOwningTarget(Target target)(Code) | | Sets the target container of this task.
Parameters: target - Target in whose scope this task belongs.May be null , indicating a top-level task. |
setRuntimeConfigurableWrapper | public void setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)(Code) | | Sets the wrapper to be used for runtime configuration.
This method should be used only by the ProjectHelper and Ant internals.
It is public to allow helper plugins to operate on tasks, normal tasks
should never use it.
Parameters: wrapper - The wrapper to be used for runtime configuration.May be null , in which case the next callto getRuntimeConfigurableWrapper will generate a newwrapper. |
setTaskName | public void setTaskName(String name)(Code) | | Sets the name to use in logging messages.
Parameters: name - The name to use in logging messages.Should not be null . |
setTaskType | public void setTaskType(String type)(Code) | | Sets the name with which the task has been invoked.
Parameters: type - The name the task has been invoked as.Should not be null . |
|
|