Package ome.services

Class 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
    • Constructor Detail

      • JobBean

        public JobBean()
        default constructor
    • Method Detail

      • getServiceInterface

        public java.lang.Class<? extends ome.api.ServiceInterface> getServiceInterface()
        Specified by:
        getServiceInterface in interface ome.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 interface ome.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 the 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.)
        Specified by:
        activate in interface ome.api.StatefulServiceInterface
      • close

        @Transactional(readOnly=true)
        public void close()
        Specified by:
        close in interface ome.api.StatefulServiceInterface
      • submit

        @Transactional(readOnly=false)
        public long submit​(ome.model.jobs.Job newJob)
        Specified by:
        submit in interface ome.api.JobHandle
      • attach

        public ome.model.jobs.JobStatus attach​(long id)
        Specified by:
        attach in interface ome.api.JobHandle
      • setTypesService

        public void setTypesService​(ome.api.ITypes typesService)
        Types service Bean injector.
        Parameters:
        typesService - an ITypes.
      • setProcessManager

        public void setProcessManager​(IProcessManager procMgr)
        Process Manager Bean injector.
        Parameters:
        procMgr - a ProcessManager.
      • errorIfInvalidState

        protected void errorIfInvalidState()
      • checkAndRegister

        protected void checkAndRegister()
      • getJob

        public ome.model.jobs.Job getJob()
        Specified by:
        getJob in interface ome.api.JobHandle
      • jobFinished

        public java.sql.Timestamp jobFinished()
        Specified by:
        jobFinished in interface ome.api.JobHandle
      • jobStatus

        public ome.model.jobs.JobStatus jobStatus()
        Specified by:
        jobStatus in interface ome.api.JobHandle
      • jobMessage

        public java.lang.String jobMessage()
        Specified by:
        jobMessage in interface ome.api.JobHandle
      • jobRunning

        public boolean jobRunning()
        Specified by:
        jobRunning in interface ome.api.JobHandle
      • jobError

        public boolean jobError()
        Specified by:
        jobError in interface ome.api.JobHandle
      • cancelJob

        @Transactional(readOnly=false)
        public void cancelJob()
        Specified by:
        cancelJob in interface ome.api.JobHandle
      • setStatus

        @Transactional(readOnly=false)
        public java.lang.String setStatus​(java.lang.String status)
        Specified by:
        setStatus in interface ome.api.JobHandle
      • setMessage

        @Transactional(readOnly=false)
        public java.lang.String setMessage​(java.lang.String message)
        Specified by:
        setMessage in interface ome.api.JobHandle
      • setStatusAndMessage

        @Transactional(readOnly=false)
        public java.lang.String setStatusAndMessage​(java.lang.String status,
                                                    java.lang.String message)
        Specified by:
        setStatusAndMessage in interface ome.api.JobHandle