Interface CyJobExecutionService


  • public interface CyJobExecutionService
    The CyJobExecutionService is a stateless service that can be used to provide remote job services, including the execution, cancellation, status checking, and retrieval of results. Implementations of this service should also choose the appropriate CyJobDataService to handle marshalling and unmarshalling of data. It is usually the case that the impelementors of the CyJobExecutionService will also provide implementations of CyJob
    • Method Detail

      • getServiceName

        String getServiceName()
        The name of the service. This is usually the classname and is the name that should be registered with OSGi.
        Returns:
        the service name
      • getDataService

        CyJobDataService getDataService()
        Return the CyJobDataService that is used by service to marshall and unmarshall data for the remote service.
        Returns:
        the data service used
      • createCyJob

        CyJob createCyJob​(String name)
        Create an empty (unsubmitted) CyJob
        Parameters:
        name - the name of the job
        Returns:
        the empty (not yet submitted) CyJob
      • executeJob

        CyJobStatus executeJob​(CyJob job,
                               String basePath,
                               Map<String,​Object> configuration,
                               CyJobData inputData)
        Submit a CyJob for remote execution. If provided, basePath will override the path defined by the CyJob. The configuration Map provides any arguments necessary to successfully submit the job with the appropriate inputData.
        Parameters:
        job - the job to be submitted
        basePath - if provided, this will override the path defined by the CyJob.
        configuration - a Map with all of the configuration parameters necessary to submit the job
        inputData - the data to be sent to the remote service.
        Returns:
        the CyJobStatus that results from the submission. If everything is successful, this should return CyJobStatus.Status.SUBMITTED. If an error occured, the return status should be CyJobStatus.Status.ERROR and CyJobStatus.getMessage() method will return the error message.
      • checkJobStatus

        CyJobStatus checkJobStatus​(CyJob job)
        Check on the status of a running job.
        Parameters:
        job - the submitted job to be checked
        Returns:
        the CyJobStatus of the running job.
      • cancelJob

        CyJobStatus cancelJob​(CyJob job)
        Cancel a running job.
        Parameters:
        job - the submitted job to be cancelled
        Returns:
        the CyJobStatus of the job after being cancelled. If everything is successful, this should return CyJobStatus.Status#CANCELLED. If an error occured, the return status should be CyJobStatus.Status.ERROR and CyJobStatus.getMessage() method will return the error message.
      • saveJobInSession

        void saveJobInSession​(CyJob job,
                              File sessionFile)
        This is method is called by the CyJobManager to save sufficient information as part of the session to be able to restore and reestablish the job with the remote service. It should not be called directly by client apps.
        Parameters:
        job - the job to be saved in the sesion file
        sessionFile -
      • restoreJobFromSession

        CyJob restoreJobFromSession​(CySession session,
                                    File sessionFile)
        This is method is called by the CyJobManager to restore the job and reestablish the job with the remote service. It should not be called directly by client apps.
        Parameters:
        session - the session that is being restored
        sessionFile - the File that was written by the saveJobInSession(CyJob, File) method described above.
        Returns:
        the restored job