Package ome.services
Class JobBean
- java.lang.Object
-
- ome.services.AbstractStatefulBean
-
- ome.services.JobBean
-
- All Implemented Interfaces:
java.io.Serializable
,ome.api.JobHandle
,ome.api.ServiceInterface
,ome.api.StatefulServiceInterface
,ProcessCallback
,ome.system.SelfConfigurableService
@Transactional(readOnly=true) public class JobBean extends AbstractStatefulBean implements ome.api.JobHandle, ProcessCallback
Provides methods for submitting asynchronous tasks.- Since:
- 3.0-Beta2
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class ome.services.AbstractStatefulBean
iQuery, iUpdate, modified, sec
-
-
Constructor Summary
Constructors Constructor Description JobBean()
default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
Does almost nothing.ome.model.jobs.JobStatus
attach(long id)
void
cancelJob()
protected void
checkAndRegister()
void
close()
protected void
errorIfInvalidState()
ome.model.jobs.Job
getJob()
java.lang.Class<? extends ome.api.ServiceInterface>
getServiceInterface()
boolean
jobError()
java.sql.Timestamp
jobFinished()
java.lang.String
jobMessage()
boolean
jobRunning()
ome.model.jobs.JobStatus
jobStatus()
void
passivate()
Does nothing.void
processCancelled(Process proc)
void
processFinished(Process proc)
java.lang.String
setMessage(java.lang.String message)
void
setProcessManager(IProcessManager procMgr)
Process Manager Bean injector.java.lang.String
setStatus(java.lang.String status)
java.lang.String
setStatusAndMessage(java.lang.String status, java.lang.String message)
void
setTypesService(ome.api.ITypes typesService)
Types service Bean injector.long
submit(ome.model.jobs.Job newJob)
-
Methods inherited from class ome.services.AbstractStatefulBean
getBeanHelper, getCurrentEventContext, isModified, modified, selfConfigure, setQueryService, setSecuritySystem, setUpdateService
-
-
-
-
Method Detail
-
getServiceInterface
public java.lang.Class<? extends ome.api.ServiceInterface> getServiceInterface()
- Specified by:
getServiceInterface
in interfaceome.system.SelfConfigurableService
-
passivate
@Transactional public void passivate()
Does nothing. The only non-shared state that this instance holds on to is the jobId and resetId -- two longs -- making passivation for the moment unimportant. This method should do what errorIfInvalidState does and reattach the process if we've been passivated. That will wait for larger changes later. At which time, proper locking will be necessary!- Specified by:
passivate
in interfaceome.api.StatefulServiceInterface
-
activate
@Transactional public void activate()
Does almost nothing. Since nothing is passivated, nothing needs to be activated. However, since we are still using errorIfInvalidState, if thejobId
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.)- Specified by:
activate
in interfaceome.api.StatefulServiceInterface
-
close
@Transactional(readOnly=true) public void close()
- Specified by:
close
in interfaceome.api.StatefulServiceInterface
-
submit
@Transactional(readOnly=false) public long submit(ome.model.jobs.Job newJob)
- Specified by:
submit
in interfaceome.api.JobHandle
-
attach
public ome.model.jobs.JobStatus attach(long id)
- Specified by:
attach
in interfaceome.api.JobHandle
-
setTypesService
public void setTypesService(ome.api.ITypes typesService)
Types service Bean injector.- Parameters:
typesService
- anITypes
.
-
setProcessManager
public void setProcessManager(IProcessManager procMgr)
Process Manager Bean injector.- Parameters:
procMgr
- aProcessManager
.
-
errorIfInvalidState
protected void errorIfInvalidState()
-
checkAndRegister
protected void checkAndRegister()
-
getJob
public ome.model.jobs.Job getJob()
- Specified by:
getJob
in interfaceome.api.JobHandle
-
jobFinished
public java.sql.Timestamp jobFinished()
- Specified by:
jobFinished
in interfaceome.api.JobHandle
-
jobStatus
public ome.model.jobs.JobStatus jobStatus()
- Specified by:
jobStatus
in interfaceome.api.JobHandle
-
jobMessage
public java.lang.String jobMessage()
- Specified by:
jobMessage
in interfaceome.api.JobHandle
-
jobRunning
public boolean jobRunning()
- Specified by:
jobRunning
in interfaceome.api.JobHandle
-
jobError
public boolean jobError()
- Specified by:
jobError
in interfaceome.api.JobHandle
-
cancelJob
@Transactional(readOnly=false) public void cancelJob()
- Specified by:
cancelJob
in interfaceome.api.JobHandle
-
setStatus
@Transactional(readOnly=false) public java.lang.String setStatus(java.lang.String status)
- Specified by:
setStatus
in interfaceome.api.JobHandle
-
setMessage
@Transactional(readOnly=false) public java.lang.String setMessage(java.lang.String message)
- Specified by:
setMessage
in interfaceome.api.JobHandle
-
setStatusAndMessage
@Transactional(readOnly=false) public java.lang.String setStatusAndMessage(java.lang.String status, java.lang.String message)
- Specified by:
setStatusAndMessage
in interfaceome.api.JobHandle
-
processCancelled
public void processCancelled(Process proc)
- Specified by:
processCancelled
in interfaceProcessCallback
-
processFinished
public void processFinished(Process proc)
- Specified by:
processFinished
in interfaceProcessCallback
-
-