|
Version: ${maven.project.version} | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.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 Jobpublic void setReporter(Reporter reporter)
setReporter in interface Jobpublic Reporter getReporter()
getReporter in interface Jobpublic void setMetadataAccessor(MetadataAccessor metadataAccessor)
setMetadataAccessor in interface Jobpublic MetadataAccessor getMetadataAccessor()
getMetadataAccessor in interface Jobpublic java.lang.String getId()
getId in interface Jobpublic 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 JobSoaplabException - if the directory creation failed
public 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 JobdataRef - 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 JobSoaplabException - if the job's status does not allow to
set new inputs anymore, or if 'inputs' are null
public void setInputValue(java.lang.String inputName,
java.lang.Object value)
throws SoaplabException
setInputValue in interface JobSoaplabException - if the job's status does not allow to
set new inputs anymore, or if 'value' is null
public 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 JobSoaplabException
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 JobSoaplabException
public void terminate()
throws SoaplabException
terminate in interface JobSoaplabExceptionpublic long getCreated()
getCreated in interface Jobpublic long getStarted()
getStarted in interface Jobpublic long getEnded()
getEnded in interface Jobpublic long getElapsed()
getElapsed in interface Jobpublic java.lang.String getStatus()
Job
getStatus in interface Jobpublic 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 JobSoaplabException
public java.util.Map<java.lang.String,java.lang.Object> getResults(java.lang.String[] resultNames)
throws SoaplabException
getResults in interface JobSoaplabException
public java.util.Map<java.lang.String,java.lang.String>[] getResultsInfo()
throws SoaplabException
getResultsInfo in interface JobSoaplabExceptionpublic void setSharedAttributes(java.util.Map<java.lang.String,java.lang.Object> sharedAttributes)
Job
setSharedAttributes in interface Jobpublic 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 | ||||||||