Save This Page
Home » apache-ant-1.8.1 » org.apache.tools » ant » [javadoc | source]
org.apache.tools.ant
abstract public class: Task [javadoc | source]
java.lang.Object
   org.apache.tools.ant.ProjectComponent
      org.apache.tools.ant.Task

All Implemented Interfaces:
    Cloneable

Base class for all tasks. Use Project.createTask to create a new task instance rather than using this class directly for construction.
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. 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.
       
      protected  String taskType    Type of this task.
         
        protected  RuntimeConfigurable wrapper    Wrapper for this object, used to configure it at runtime.
           
          Fields inherited from org.apache.tools.ant.ProjectComponent:
          project,  location,  description
          Constructor:
           public Task() 
          Method from org.apache.tools.ant.Task Summary:
          bindToOwner,   execute,   getOwningTarget,   getRuntimeConfigurableWrapper,   getTaskName,   getTaskType,   getWrapper,   handleErrorFlush,   handleErrorOutput,   handleFlush,   handleInput,   handleOutput,   init,   isInvalid,   log,   log,   log,   log,   markInvalid,   maybeConfigure,   perform,   reconfigure,   setOwningTarget,   setRuntimeConfigurableWrapper,   setTaskName,   setTaskType
          Methods from org.apache.tools.ant.ProjectComponent:
          clone,   getDescription,   getLocation,   getProject,   log,   log,   setDescription,   setLocation,   setProject
          Methods from java.lang.Object:
          clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
          Method from org.apache.tools.ant.Task Detail:
           public final  void bindToOwner(Task owner) 
            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.
           public  void execute() throws BuildException 
            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.
           public Target getOwningTarget() 
            Returns the container target of this task.
           public RuntimeConfigurable getRuntimeConfigurableWrapper() 
            Returns 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.
           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) throws IOException 
            Handle an input request by this task.
           protected  void handleOutput(String output) 
            Handles output by logging it with the INFO priority.
           public  void init() throws BuildException 
            Called by the project to let the task initialize properly. The default implementation is a no-op.
           protected final boolean isInvalid() 
            Has this task been marked invalid?
           public  void log(String msg) 
            Logs a message with the default (INFO) priority.
           public  void log(String msg,
              int msgLevel) 
            Logs a message with the given priority. This delegates the actual logging to the project.
           public  void log(Throwable t,
              int msgLevel) 
            Logs a message with the given priority. This delegates the actual logging to the project.
           public  void log(String msg,
              Throwable t,
              int msgLevel) 
            Logs a message with the given priority. This delegates the actual logging to the project.
           final  void markInvalid() 
            Marks this task as invalid. Any further use of this task will go through a replacement with the updated definition.
           public  void maybeConfigure() throws BuildException 
            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.
           public final  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. If a runtime exception is thrown, the task finished event is still fired, but with the exception as the cause.
           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. 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.
           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.