|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.massimo.tools.scriptrunner.context.AbstractExecutionContext
com.massimo.tools.scriptrunner.context.FileExecutionContext
public class FileExecutionContext
Implement ExecutionContext in flat files, housed in a directory sruns
.
There are two files per run: a serialized Map of restart data, and a simple log file.
Field Summary |
---|
Fields inherited from class com.massimo.tools.scriptrunner.context.AbstractExecutionContext |
---|
lastException, runId |
Constructor Summary | |
---|---|
FileExecutionContext(Map<String,String> properties)
Get parent directory from properties or assume user directory. |
Method Summary | |
---|---|
protected void |
finalize()
|
void |
finished(String taskName,
int lastStepProcessed)
Audit trail: record successful finish of Task execution |
protected String |
generateRunIdentifier(Map<String,String> properties)
The run identifier is saved in a file as a String. |
protected org.apache.log4j.Logger |
getLogger()
|
String |
getRunIdentifier(Map<String,String> properties)
If the runId is not set, look for a run identifier in properties. |
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,
int lastStepProcessed,
String key)
Log informational messages |
void |
progress(String taskName,
int lastStepProcessed,
String key)
Audit trail: Task has finished executing its lastStepProcessed step |
int |
start(String taskName)
Audit trail: start Task execution |
Methods inherited from class com.massimo.tools.scriptrunner.context.AbstractExecutionContext |
---|
getLastException, log, setLastException, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileExecutionContext(Map<String,String> properties)
properties
-
FileAccessException
Method Detail |
---|
protected void finalize() throws Throwable
finalize
in class Object
Throwable
Object.finalize()
public void finished(String taskName, int lastStepProcessed) throws SRException
SRException
protected String generateRunIdentifier(Map<String,String> properties)
generateRunIdentifier
in class AbstractExecutionContext
NumberFormatException
- if the contents of the run identifier file are not a long.protected org.apache.log4j.Logger getLogger()
getLogger
in class AbstractExecutionContext
public String getRunIdentifier(Map<String,String> properties) throws SRException
getRunIdentifier
in interface ExecutionContext
getRunIdentifier
in class AbstractExecutionContext
SRException
- if unable to find or generate a run identifierpublic boolean isFinished(String taskName) throws SRException
SRException
public void log(String taskName, int log_code, String message, int lastStepProcessed, String key) throws SRException
log_code
- The Task constants or an error codekey
- A identifier for the last step, e.g. a database row's primary key value. May be empty.
SRException
public void progress(String taskName, int lastStepProcessed, String key) throws SRException
lastStepProcessed
- On re-start, this value will returned by ExecutionContext.start(String)key
- A identifier for the last step, e.g. a database row's primary key value. May be empty.
SRException
public int start(String taskName) throws SRException
SRException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |