com.massimo.tools.scriptrunner.context
Class AbstractExecutionContext

java.lang.Object
  extended by com.massimo.tools.scriptrunner.context.AbstractExecutionContext
All Implemented Interfaces:
ExecutionContext
Direct Known Subclasses:
FileExecutionContext, OracleExecutionContext, PostgresExecutionContext

public abstract class AbstractExecutionContext
extends Object
implements ExecutionContext

Abstract base class for ExecutionContext implementations.


Field Summary
protected  Exception lastException
          The last exception, as saved by a Task
protected  String runId
          The current run identifier
 
Constructor Summary
protected AbstractExecutionContext()
          Constructor
 
Method Summary
protected abstract  String generateRunIdentifier(Map<String,String> properties)
           
 Exception getLastException()
          Exception that caused Task failure
protected abstract  org.apache.log4j.Logger getLogger()
           
 String getRunIdentifier(Map<String,String> properties)
          
If the runId is not set, look for a run identifier in properties.
 void log(String taskName, int log_code, String message)
          Log informational messages
 void setLastException(Exception lastException)
          Exception that caused Task failure
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.massimo.tools.scriptrunner.context.ExecutionContext
finished, isFinished, log, progress, start
 

Field Detail

lastException

protected Exception lastException
The last exception, as saved by a Task


runId

protected String runId
The current run identifier

Constructor Detail

AbstractExecutionContext

protected AbstractExecutionContext()
Constructor

Method Detail

generateRunIdentifier

protected abstract String generateRunIdentifier(Map<String,String> properties)
                                         throws SRException
Parameters:
properties -
Returns:
a newly generate run identifier
Throws:
SRException

getLastException

public Exception getLastException()
Exception that caused Task failure

Specified by:
getLastException in interface ExecutionContext
Returns:
The last exception

getLogger

protected abstract org.apache.log4j.Logger getLogger()
Returns:
The concrete class's Logger

getRunIdentifier

public String getRunIdentifier(Map<String,String> properties)
                        throws SRException

If the runId is not set, look for a run identifier in properties.
If not found, call generateRunIdentifier(Map).

Specified by:
getRunIdentifier in interface ExecutionContext
Parameters:
properties -
Returns:
String The existing or a new run identifier.
Throws:
SRException - if unable to find or generate a run identifier

log

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

Specified by:
log in interface ExecutionContext
log_code - The Task constants or an error code
Throws:
SRException

setLastException

public void setLastException(Exception lastException)
Exception that caused Task failure

Specified by:
setLastException in interface ExecutionContext

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()