com.massimo.tools.scriptrunner
Interface Task

All Known Implementing Classes:
AbstractCompoundTask, AbstractGenerator, AbstractTask, DataSourcesTask, IfTask, OptionalTask, OracleFileCheckTask, ParallelTask, PauseTask, PollTask, PrintTask, ProcessTask, PropertiesTask, SerialTask, SleepTask, SpawnTask, SQLFunctionTask, SQLGeneratorTask, SQLTask, TemplateTask, ThreadedSQLTask, ThreadsTask, XSLTask

public interface Task

An interface for generic tasks.
Unlike a Runnable, a Task should not process indefinitely. It has some finite work to do; it does it; and returns a result.
A Task can be interrupted, although this does not garrantee that it will return immediately.


Field Summary
static int DATA_ERROR
          A data error has halted Task processing
static int ERROR
          An error has halted Task processing
static int FINISHED
          Task has finished processing
static int INTERRUPTED
          Task was been interrupted
static int PROMPT
          Task is prompting, waiting for input
static int RUNNING
          Task is processing
static int START
          Task has started processing
static int SUCCESS
          Task has finished processing successfully
 
Method Summary
 Element getDefinition()
           
 String getName()
           
 Task getParent()
           
 Map<String,String> getProperties()
           
 String getType()
           
 void interrupt()
          Tells the Task to stop processing.
 int process(ExecutionContext context)
          The central work method.
 int validate(ValidationContext context)
          Check whether this task should be able to run.
 

Field Detail

DATA_ERROR

static final int DATA_ERROR
A data error has halted Task processing

See Also:
Constant Field Values

ERROR

static final int ERROR
An error has halted Task processing

See Also:
Constant Field Values

FINISHED

static final int FINISHED
Task has finished processing

See Also:
Constant Field Values

INTERRUPTED

static final int INTERRUPTED
Task was been interrupted

See Also:
Constant Field Values

PROMPT

static final int PROMPT
Task is prompting, waiting for input

See Also:
Constant Field Values

RUNNING

static final int RUNNING
Task is processing

See Also:
Constant Field Values

START

static final int START
Task has started processing

See Also:
Constant Field Values

SUCCESS

static final int SUCCESS
Task has finished processing successfully

See Also:
Constant Field Values
Method Detail

getDefinition

Element getDefinition()
Returns:
The XML Element defining the Task

getName

String getName()
Returns:
Task name

getParent

Task getParent()
Returns:
The parent Task or null for the root task

getProperties

Map<String,String> getProperties()
Returns:
Map of properties known by this Task

getType

String getType()
Returns:
Task type

interrupt

void interrupt()
Tells the Task to stop processing. This does not garrantee that the task will return immediately.


process

int process(ExecutionContext context)
            throws Exception
The central work method.

Parameters:
context - A concrete ExecutionContext
Returns:
O for success. Anything else is a failure.
Throws:
Exception

validate

int validate(ValidationContext context)
Check whether this task should be able to run.
Implementations should check for the prescence of files, parameters, bind variables,... Each object is responsible for adding itself to the context and reporting errors through the context.

Parameters:
context - A concrete ValidationContext
Returns:
O for success. Anything else is a failure.