com.massimo.tools.scriptrunner.context
Interface ExecutionContext

All Known Implementing Classes:
AbstractExecutionContext, FileExecutionContext, OracleExecutionContext, PostgresExecutionContext

public interface ExecutionContext

Task implementations use the ExecutionContext to:


Method Summary
 void finished(String taskName, int lastStepProcessed)
          Audit trail: record successful finish of Task execution
 Exception getLastException()
          Exception that caused Task failure
 String getRunIdentifier(Map<String,String> properties)
          Find or create the run identifier.
 boolean isFinished(String taskName)
          Audit trail: check whether Task has already been executed in this run
 void log(String taskName, int log_code, String message)
          Log informational messages
 void log(String taskName, int log_code, String message, int lastStepProcessed, String key)
          Log informational messages
 void progress(String taskName, int lastStepProcessed, String key)
          Audit trail: Task has finished executing its lastStepProcessed step
 void setLastException(Exception lastException)
          Exception that caused Task failure
 int start(String taskName)
          Audit trail: start Task execution
 

Method Detail

finished

void finished(String taskName,
              int lastStepProcessed)
              throws SRException
Audit trail: record successful finish of Task execution

Parameters:
taskName -
lastStepProcessed -
Throws:
SRException

getLastException

Exception getLastException()
Exception that caused Task failure

Returns:
The last exception

getRunIdentifier

String getRunIdentifier(Map<String,String> properties)
                        throws SRException
Find or create the run identifier. This may mean a call to, for instance, a database sequence. Each invocation of the ScriptRunner is a single run and has a single run identifier, so subsequent calls will always return the same value.

Parameters:
properties -
Returns:
String The existing or a new run identifier.
Throws:
SRException - if unable to find or generate a run identifier

isFinished

boolean isFinished(String taskName)
                   throws SRException
Audit trail: check whether Task has already been executed in this run

Parameters:
taskName -
Returns:
boolean
Throws:
SRException

log

void log(String taskName,
         int log_code,
         String message)
         throws SRException
Log informational messages

Parameters:
taskName -
log_code - The Task constants or an error code
message -
Throws:
SRException

log

void log(String taskName,
         int log_code,
         String message,
         int lastStepProcessed,
         String key)
         throws SRException
Log informational messages

Parameters:
taskName -
log_code - The Task constants or an error code
message -
lastStepProcessed -
key - A identifier for the last step, e.g. a database row's primary key value. May be empty.
Throws:
SRException

progress

void progress(String taskName,
              int lastStepProcessed,
              String key)
              throws SRException
Audit trail: Task has finished executing its lastStepProcessed step

Parameters:
taskName -
lastStepProcessed - On re-start, this value will returned by start(String)
key - A identifier for the last step, e.g. a database row's primary key value. May be empty.
Throws:
SRException

setLastException

void setLastException(Exception lastException)
Exception that caused Task failure

Parameters:
lastException -

start

int start(String taskName)
          throws SRException
Audit trail: start Task execution

Parameters:
taskName -
Returns:
int The index of the last executed step or 0.
Throws:
SRException