com.massimo.tools.scriptrunner.work
Class SleepTask

java.lang.Object
  extended by com.massimo.tools.scriptrunner.AbstractTask
      extended by com.massimo.tools.scriptrunner.work.SleepTask
All Implemented Interfaces:
Task

public class SleepTask
extends AbstractTask

Sleeping is inactive work.
Introduces integer attribute Constants.ATTRIBUTE_SLEEP_RESULT. The body of the task element is the number of seconds to sleep.


Field Summary
 
Fields inherited from class com.massimo.tools.scriptrunner.AbstractTask
definition, name, parent, properties, type
 
Fields inherited from interface com.massimo.tools.scriptrunner.Task
DATA_ERROR, ERROR, FINISHED, INTERRUPTED, PROMPT, RUNNING, START, SUCCESS
 
Constructor Summary
SleepTask(Task parent, String type, Element definition, Map<String,String> connectionProperties)
           
 
Method Summary
protected  int doProcess(ExecutionContext context)
          Implementing classes only need to do their own work and log progress when appropriate.
protected  int doValidate(ValidationContext context)
          Implement Task Check whether this task should be able to run.
protected  org.apache.log4j.Logger getLogger()
           
 void interrupt()
          Tells the Task to stop processing.
 
Methods inherited from class com.massimo.tools.scriptrunner.AbstractTask
getBooleanProperty, getCurrentWorkingDirectory, getDefinition, getIntProperty, getName, getParent, getProperties, getStartProcessingRow, getText, getType, isIgnoreableError, isIgnoreableError, isInterrupted, isLogProgress, postProcess, preProcess, process, resultCodeToString, substituteParameters, toString, validate, validateConnections, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SleepTask

public SleepTask(Task parent,
                 String type,
                 Element definition,
                 Map<String,String> connectionProperties)
Parameters:
parent -
type -
definition -
connectionProperties -
Method Detail

doProcess

protected int doProcess(ExecutionContext context)
                 throws SRException
Implementing classes only need to do their own work and log progress when appropriate.
Puts the current Thread to sleep before returning the value of the result attribute. The body of the task element is the number of seconds to sleep.

Specified by:
doProcess in class AbstractTask
Returns:
O for success. Anything else is a failure.
Throws:
SRException
See Also:
AbstractTask.process(ExecutionContext)

doValidate

protected int doValidate(ValidationContext context)
Implement Task Check whether this task should be able to run. Implementations should check for the prescence of files,...

Specified by:
doValidate in class AbstractTask
Returns:
O for success. Anything else is a failure.

getLogger

protected org.apache.log4j.Logger getLogger()
Specified by:
getLogger in class AbstractTask
Returns:
Class logger
See Also:
AbstractTask.getLogger()

interrupt

public void interrupt()
Description copied from class: AbstractTask
Tells the Task to stop processing. This does not garrantee that the task will return immediately.

Specified by:
interrupt in interface Task
Overrides:
interrupt in class AbstractTask
See Also:
AbstractTask.interrupt()