|
Version: ${maven.project.version} | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.soaplab.services.AbstractJob
public abstract class AbstractJob
A convenient parent of other Job's implementations.
Field Summary | |
---|---|
static java.lang.String |
INTERNAL_ERROR
|
Method Summary | |
---|---|
void |
destroy()
Destroy resources related to this job. |
long |
getCreated()
Job created - returns number of millis from the BOE. |
long |
getElapsed()
Job time elapsed - returns number in milliseconds. |
long |
getEnded()
Job ended - returns number of millis from the BOE. |
java.lang.String |
getId()
Return this job identity (an ID). |
java.io.File |
getJobDir()
The job directory is created in a SANDBOX (see more in getSandbox()). |
java.lang.String |
getLastEvent()
Get the last event. |
MetadataAccessor |
getMetadataAccessor()
Get metadata accessor. |
Reporter |
getReporter()
Get reporter. |
java.util.Map<java.lang.String,java.lang.Object> |
getResults()
Return all (available) results. |
java.util.Map<java.lang.String,java.lang.Object> |
getResults(java.lang.String[] resultNames)
Return all wanted (and available) results. |
java.util.Map<java.lang.String,java.lang.String>[] |
getResultsInfo()
|
long |
getStarted()
Job started - returns number of millis from the BOE. |
java.lang.String |
getStatus()
Get job status. |
boolean |
isDataReferenceSafe(java.lang.String dataRef,
ParamDef paramDef)
Check if the 'dataRef' (which is a file name or a URL) is safe for this job. |
boolean |
isRecreated()
Checks if the job is re-created |
void |
run()
The meat of Soaplab. |
void |
setId(java.lang.String jobId)
Set this job ID. |
void |
setInputs(java.util.Map<java.lang.String,java.lang.Object> inputs)
Set input data into this job. |
void |
setInputValue(java.lang.String inputName,
java.lang.Object value)
Set an input value, given by its name. |
void |
setMetadataAccessor(MetadataAccessor metadataAccessor)
Set metadata accessor. |
void |
setReporter(Reporter reporter)
Set reporter. |
void |
setSharedAttributes(java.util.Map<java.lang.String,java.lang.Object> sharedAttributes)
Shared attributes are any objects that are shared by more job instances. |
void |
terminate()
Terminate this running job. |
void |
waitFor()
Block and wait until job completes. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String INTERNAL_ERROR
Method Detail |
---|
public void setId(java.lang.String jobId)
setId
in interface Job
public void setReporter(Reporter reporter)
setReporter
in interface Job
public Reporter getReporter()
getReporter
in interface Job
public void setMetadataAccessor(MetadataAccessor metadataAccessor)
setMetadataAccessor
in interface Job
public MetadataAccessor getMetadataAccessor()
getMetadataAccessor
in interface Job
public java.lang.String getId()
getId
in interface Job
public void destroy()
It does *not* include results in persistent storages. These will be taken care of by the JobManager (the creator and creamatorium for Jobs).
destroy
in interface Job
public java.io.File getJobDir() throws SoaplabException
getJobDir
in interface Job
SoaplabException
- if the directory creation failedpublic boolean isDataReferenceSafe(java.lang.String dataRef, ParamDef paramDef)
- It is an empty reference, or - It is a URL with any protocol except of 'file', or - The path of the URL with the 'file' protocol or an ordinary file name point to a non-existent file, or - The path of the URL with the 'file' protocol or an ordinary file name have an absolute path starting in SANDBOX directory (see getSandbox()) and it does not contain anywhere '..'.
isDataReferenceSafe
in interface Job
dataRef
- is a data reference (file name, URL) to be
checked paramDef
- is a metadata definition of the input parameter
whose data reference is being checked; an implementation can
use it, for example, if inputs have different policy what is
safe and what not (but this AbstractJob class does not use it)
public void setInputs(java.util.Map<java.lang.String,java.lang.Object> inputs) throws SoaplabException
setInputs
in interface Job
SoaplabException
- if the job's status does not allow to
set new inputs anymore, or if 'inputs' are nullpublic void setInputValue(java.lang.String inputName, java.lang.Object value) throws SoaplabException
setInputValue
in interface Job
SoaplabException
- if the job's status does not allow to
set new inputs anymore, or if 'value' is nullpublic void run() throws SoaplabException
It is very probable, almost indisputable, that this method needs to be overridden in order to do something useful. Or, override only the 'realRun' method.
run
in interface Job
SoaplabException
public void waitFor() throws SoaplabException
Be sure that it is correctly synchronized with your own run()
method. By default, it waits for "notify()" executer on
the 'reporter' instance.
waitFor
in interface Job
SoaplabException
public void terminate() throws SoaplabException
terminate
in interface Job
SoaplabException
public long getCreated()
getCreated
in interface Job
public long getStarted()
getStarted
in interface Job
public long getEnded()
getEnded
in interface Job
public long getElapsed()
getElapsed
in interface Job
public java.lang.String getStatus()
Job
getStatus
in interface Job
public java.lang.String getLastEvent()
Job
getLastEvent
in interface Job
public java.util.Map<java.lang.String,java.lang.Object> getResults() throws SoaplabException
getResults
in interface Job
SoaplabException
public java.util.Map<java.lang.String,java.lang.Object> getResults(java.lang.String[] resultNames) throws SoaplabException
getResults
in interface Job
SoaplabException
public java.util.Map<java.lang.String,java.lang.String>[] getResultsInfo() throws SoaplabException
getResultsInfo
in interface Job
SoaplabException
public void setSharedAttributes(java.util.Map<java.lang.String,java.lang.Object> sharedAttributes)
Job
setSharedAttributes
in interface Job
public boolean isRecreated()
Job
isRecreated
in interface Job
|
Version: ${maven.project.version} | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |