com.ls.util.taskrun
Class Task

java.lang.Object
  |
  +--com.ls.util.taskrun.Task

public abstract class Task
extends Object

Every object implementing this interface provides can be executed as a task. The particular operations of the task will be implemented by the method run()

Version:
$Revision: 1.0 $
Author:
Last modified by $Author: TZink $

Constructor Summary
Task()
           
 
Method Summary
 Map getEnvironment()
          Returns the environment map used for this task batch.
 ILogger getLogger()
          Returns the logger instance used for reporting information concerning task.
 XMLFragment getParameter()
          Returns the parameters for the current run of the task.
 String getTaskId()
          Returns the id assigned to this task object.
 void reset()
          This method can be overwritten to perform some cleanup operations after the task was executed.
abstract  void run()
          An implementation of this method provides the particular opertations to take when the task is executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Task

public Task()
Method Detail

getTaskId

public final String getTaskId()
Returns the id assigned to this task object.

Returns:
The task id.

getEnvironment

public final Map getEnvironment()
Returns the environment map used for this task batch.

Returns:
The environment map.

getLogger

public final ILogger getLogger()
Returns the logger instance used for reporting information concerning task.

Returns:
The logger instance.

getParameter

public final XMLFragment getParameter()
Returns the parameters for the current run of the task.

Returns:
An xml structure containing parameters.

run

public abstract void run()
                  throws TaskException
An implementation of this method provides the particular opertations to take when the task is executed.

Throws:
TaskException - If the task could not be executed successfully.

reset

public void reset()
This method can be overwritten to perform some cleanup operations after the task was executed. It will be called right after the run() has returned, even with an exception. Resetting a task instance should automatically prepare it for the next execution.