@Transactional(readOnly=true) public class JobBean extends AbstractStatefulBean implements JobHandle, ProcessCallback
iQuery, iUpdate, modified, sec
Constructor and Description |
---|
JobBean()
default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Does almost nothing.
|
JobStatus |
attach(long id) |
void |
cancelJob()
Marks a job for cancellation.
|
protected void |
checkAndRegister() |
void |
close()
signals the end of the service lifecycle.
|
protected void |
errorIfInvalidState() |
Job |
getJob() |
java.lang.Class<? extends ServiceInterface> |
getServiceInterface() |
boolean |
jobError()
Returns true if the
Job has thrown an error. |
java.sql.Timestamp |
jobFinished() |
java.lang.String |
jobMessage() |
boolean |
jobRunning()
Returns true if the
Job is running, i.e. has an attached
Process . |
JobStatus |
jobStatus() |
void |
passivate()
Does nothing.
|
void |
processCancelled(Process proc) |
void |
processFinished(Process proc) |
java.lang.String |
setMessage(java.lang.String message)
Sets the job's message string, and returns the previous value.
|
void |
setProcessManager(IProcessManager procMgr)
Process Manager Bean injector.
|
java.lang.String |
setStatus(java.lang.String status)
Updates the
JobStatus for the current job. |
java.lang.String |
setStatusAndMessage(java.lang.String status,
java.lang.String message)
Like
JobHandle.setStatus(String) but also sets the message. |
void |
setTypesService(ITypes typesService)
Types service Bean injector.
|
long |
submit(Job newJob)
Submits a
Job and returns its database id. |
getBeanHelper, getCurrentEventContext, isModified, modified, selfConfigure, setQueryService, setSecuritySystem, setUpdateService
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCurrentEventContext
public java.lang.Class<? extends ServiceInterface> getServiceInterface()
getServiceInterface
in interface SelfConfigurableService
@Transactional public void passivate()
passivate
in interface StatefulServiceInterface
@Transactional public void activate()
jobId
is non-null, then
this instance will need to handle re-loading on first
access. (Previously it could not be done here, because the
security system was not configured for transactions during
JavaEE callbacks. This is no longer true.)activate
in interface StatefulServiceInterface
@Transactional(readOnly=true) public void close()
StatefulServiceInterface
close
in interface StatefulServiceInterface
@Transactional(readOnly=false) public long submit(Job newJob)
JobHandle
Job
and returns its database id. The only fields
directly on status which are editable are message,
scheduledFor and status. The latter two must be
sensible.public JobStatus attach(long id)
public void setTypesService(ITypes typesService)
typesService
- an ITypes
.public void setProcessManager(IProcessManager procMgr)
procMgr
- a ProcessManager
.protected void errorIfInvalidState()
protected void checkAndRegister()
public java.sql.Timestamp jobFinished()
jobFinished
in interface JobHandle
Job
is not finished, otherwise the
Timestamp
for when it completed.public JobStatus jobStatus()
public java.lang.String jobMessage()
jobMessage
in interface JobHandle
public boolean jobRunning()
JobHandle
Job
is running, i.e. has an attached
Process
.jobRunning
in interface JobHandle
public boolean jobError()
JobHandle
Job
has thrown an error.@Transactional(readOnly=false) public void cancelJob()
JobHandle
@Transactional(readOnly=false) public java.lang.String setStatus(java.lang.String status)
JobHandle
JobStatus
for the current job. The previous status
is returned as a string. If the status is JobHandle.CANCELLED
, this
method is equivalent to JobHandle.cancelJob()
.@Transactional(readOnly=false) public java.lang.String setMessage(java.lang.String message)
JobHandle
setMessage
in interface JobHandle
@Transactional(readOnly=false) public java.lang.String setStatusAndMessage(java.lang.String status, java.lang.String message)
JobHandle
JobHandle.setStatus(String)
but also sets the message.setStatusAndMessage
in interface JobHandle
public void processCancelled(Process proc)
processCancelled
in interface ProcessCallback
public void processFinished(Process proc)
processFinished
in interface ProcessCallback
Version: 5.4.4-ice35-b82
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.