org.apache.tools.ant
Class Task

java.lang.Object
  |
  +--org.apache.tools.ant.Task
Direct Known Subclasses:
Ant, ANTLR, AntStarTeamCheckOut, AntStructure, Available, CallTarget, ClearCase, Copy, Copyfile, Cvs, Deltree, Echo, Exec, ExecTask, Exit, Filter, FTP, GenerateKey, Get, GUnzip, GZip, Java, JavaCC, Javadoc, Javah, JJTree, JUnitTask, KeySubst, MatchingTask, Mkdir, MParse, MSVSS, P4Base, Patch, Property, PropertyFile, Rename, Script, SendEmail, SignJar, SoundTask, SQLExec, TaskAdapter, Taskdef, TelnetTask, Touch, Tstamp, UnknownElement, Untar, VAJExport, VAJImport, VAJLoadProjects, WLRun, WLStop, XMLResultAggregator

public abstract class Task
extends java.lang.Object

Base class for all tasks.

Use Project.createTask to create a new Task.


Field Summary
protected  java.lang.String description
           
protected  Location location
           
protected  Project project
           
protected  Target target
           
protected  java.lang.String taskName
           
protected  java.lang.String taskType
           
protected  RuntimeConfigurable wrapper
           
 
Constructor Summary
Task()
           
 
Method Summary
 void execute()
          Called by the project to let the task do it's work.
 java.lang.String getDescription()
           
 Location getLocation()
          Returns the file location where this task was defined.
 Target getOwningTarget()
          Get the Target to which this task belongs
 Project getProject()
          Get the Project to which this task belongs
 RuntimeConfigurable getRuntimeConfigurableWrapper()
          Returns the wrapper class for runtime configuration.
 java.lang.String getTaskName()
          Get the name to use in logging messages.
 void init()
          Called by the project to let the task initialize properly.
 void log(java.lang.String msg)
          Log a message with the default (INFO) priority.
 void log(java.lang.String msg, int msgLevel)
          Log a mesage with the give priority.
 void maybeConfigure()
          Configure this task - if it hasn't been done already.
 void setDescription(java.lang.String desc)
          Sets a description of the current action.
 void setLocation(Location location)
          Sets the file location where this task was defined.
 void setOwningTarget(Target target)
          Sets the target object of this task.
protected  void setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)
           
 void setTaskName(java.lang.String name)
          Set the name to use in logging messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

protected Project project

target

protected Target target

description

protected java.lang.String description

location

protected Location location

taskName

protected java.lang.String taskName

taskType

protected java.lang.String taskType

wrapper

protected RuntimeConfigurable wrapper
Constructor Detail

Task

public Task()
Method Detail

getProject

public Project getProject()
Get the Project to which this task belongs
Returns:
the task's project.

setOwningTarget

public void setOwningTarget(Target target)
Sets the target object of this task.
Parameters:
target - Target in whose scope this task belongs.

getOwningTarget

public Target getOwningTarget()
Get the Target to which this task belongs
Returns:
the task's target.

setTaskName

public void setTaskName(java.lang.String name)
Set the name to use in logging messages.
Parameters:
name - the name to use in logging messages.

getTaskName

public java.lang.String getTaskName()
Get the name to use in logging messages.
Returns:
the name to use in logging messages.

log

public void log(java.lang.String msg)
Log a message with the default (INFO) priority.
Parameters:
the - message to be logged.

log

public void log(java.lang.String msg,
                int msgLevel)
Log a mesage with the give priority.
Parameters:
the - message to be logged.
msgLevel - the message priority at which this message is to be logged.

setDescription

public void setDescription(java.lang.String desc)
Sets a description of the current action. It will be usefull in commenting what we are doing.

getDescription

public java.lang.String getDescription()

init

public void init()
          throws BuildException
Called by the project to let the task initialize properly.
Throws:
BuildException - if someting goes wrong with the build

execute

public void execute()
             throws BuildException
Called by the project to let the task do it's 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.
Throws:
BuildException - if someting goes wrong with the build

getLocation

public Location getLocation()
Returns the file location where this task was defined.

setLocation

public void setLocation(Location location)
Sets the file location where this task was defined.

getRuntimeConfigurableWrapper

public RuntimeConfigurable getRuntimeConfigurableWrapper()
Returns the wrapper class for runtime configuration.

setRuntimeConfigurableWrapper

protected void setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)

maybeConfigure

public void maybeConfigure()
                    throws BuildException
Configure this task - if it hasn't been done already.


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.