Class MIBatchJobManager


  • public class MIBatchJobManager
    extends Object
    The psi mi enricher
    Since:
    02/08/13
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • MIBatchJobManager

        public MIBatchJobManager()

        Constructor for MIBatchJobManager.

    • Method Detail

      • main

        public static void main​(String[] args)
                         throws org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException,
                                org.springframework.batch.core.launch.NoSuchJobException,
                                org.springframework.batch.core.JobParametersInvalidException,
                                org.springframework.batch.core.repository.JobRestartException,
                                org.springframework.batch.core.launch.JobInstanceAlreadyExistsException,
                                org.springframework.batch.core.launch.NoSuchJobInstanceException,
                                org.springframework.batch.core.launch.NoSuchJobExecutionException

        main.

        Parameters:
        args - an array of String objects.
        Throws:
        org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException - if any.
        org.springframework.batch.core.launch.NoSuchJobException - if any.
        org.springframework.batch.core.JobParametersInvalidException - if any.
        org.springframework.batch.core.repository.JobRestartException - if any.
        org.springframework.batch.core.launch.JobInstanceAlreadyExistsException - if any.
        org.springframework.batch.core.launch.NoSuchJobInstanceException - if any.
        org.springframework.batch.core.launch.NoSuchJobExecutionException - if any.
      • findLastJobExecutionFor

        public org.springframework.batch.core.JobExecution findLastJobExecutionFor​(String jobName,
                                                                                   String jobId)
        Find the last JobExecution having this name and this id
        Parameters:
        jobName - a String object.
        jobId - a String object.
        Returns:
        a JobExecution object.
      • restartJob

        public Long restartJob​(String jobName,
                               String jobId)
                        throws org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException,
                               org.springframework.batch.core.JobParametersInvalidException,
                               org.springframework.batch.core.launch.NoSuchJobExecutionException,
                               org.springframework.batch.core.repository.JobRestartException,
                               org.springframework.batch.core.launch.NoSuchJobException,
                               org.springframework.batch.core.launch.NoSuchJobInstanceException
        This method will restart the last job which has been executed with a given name
        Parameters:
        jobName - a String object.
        jobId - : jobid generated for the job
        Returns:
        the new job execution id
        Throws:
        org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException - if any.
        org.springframework.batch.core.JobParametersInvalidException - if any.
        org.springframework.batch.core.launch.NoSuchJobExecutionException - if any.
        org.springframework.batch.core.repository.JobRestartException - if any.
        org.springframework.batch.core.launch.NoSuchJobException - if any.
        org.springframework.batch.core.launch.NoSuchJobInstanceException - if any.
      • findJobIdsByName

        public List<Long> findJobIdsByName​(String jobName,
                                           int start,
                                           int numberJobs)
                                    throws org.springframework.batch.core.launch.NoSuchJobException
        Find all job ids having a given name. Start will allow to search jobs from a certain starting index and numberJobs indicates the number of job ids to return
        Parameters:
        jobName - a String object.
        start - a int.
        numberJobs - a int.
        Returns:
        a List object.
        Throws:
        org.springframework.batch.core.launch.NoSuchJobException - if any.
      • restartJob

        public Long restartJob​(long executionId)
                        throws org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException,
                               org.springframework.batch.core.JobParametersInvalidException,
                               org.springframework.batch.core.launch.NoSuchJobExecutionException,
                               org.springframework.batch.core.repository.JobRestartException,
                               org.springframework.batch.core.launch.NoSuchJobException
        Restart a job with a given execution id
        Parameters:
        executionId - a long.
        Returns:
        the new job execution id
        Throws:
        org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException - if any.
        org.springframework.batch.core.JobParametersInvalidException - if any.
        org.springframework.batch.core.launch.NoSuchJobExecutionException - if any.
        org.springframework.batch.core.repository.JobRestartException - if any.
        org.springframework.batch.core.launch.NoSuchJobException - if any.
      • startJob

        public String startJob​(String jobName)
                        throws org.springframework.batch.core.JobParametersInvalidException,
                               org.springframework.batch.core.launch.JobInstanceAlreadyExistsException,
                               org.springframework.batch.core.launch.NoSuchJobException
        This method will start a job having a specific name and no job parameters. It will return the generated job id of the job that have been started
        Parameters:
        jobName - a String object.
        Returns:
        a String object.
        Throws:
        org.springframework.batch.core.JobParametersInvalidException - if any.
        org.springframework.batch.core.launch.JobInstanceAlreadyExistsException - if any.
        org.springframework.batch.core.launch.NoSuchJobException - if any.
      • startJobWithParameters

        public String startJobWithParameters​(String jobName,
                                             String parameters)
                                      throws org.springframework.batch.core.JobParametersInvalidException,
                                             org.springframework.batch.core.launch.JobInstanceAlreadyExistsException,
                                             org.springframework.batch.core.launch.NoSuchJobException

        startJobWithParameters.

        Parameters:
        jobName - a String object.
        parameters - the parameters of type key-value separated by comma
        Returns:
        a String object.
        Throws:
        org.springframework.batch.core.JobParametersInvalidException - if any.
        org.springframework.batch.core.launch.JobInstanceAlreadyExistsException - if any.
        org.springframework.batch.core.launch.NoSuchJobException - if any.
      • getJobStatusFor

        public org.springframework.batch.core.BatchStatus getJobStatusFor​(String jobName,
                                                                          String jobId)
        The job status of a given job name and id
        Parameters:
        jobName - a String object.
        jobId - a String object.
        Returns:
        null if the job does not exist, the job batchStatus if
      • stopJob

        public boolean stopJob​(String jobName,
                               String jobId)
                        throws org.springframework.batch.core.launch.NoSuchJobExecutionException,
                               org.springframework.batch.core.launch.JobExecutionNotRunningException
        Stop a give job name and id.
        Parameters:
        jobName - a String object.
        jobId - a String object.
        Returns:
        true if the job does not exist or has been stopped, false otherwise
        Throws:
        org.springframework.batch.core.launch.NoSuchJobExecutionException - if any.
        org.springframework.batch.core.launch.JobExecutionNotRunningException - if any.
      • abandonJob

        public org.springframework.batch.core.JobExecution abandonJob​(String jobName,
                                                                      String jobId)
                                                               throws org.springframework.batch.core.launch.NoSuchJobExecutionException,
                                                                      org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
        Stops a job and returns the jobexecution
        Parameters:
        jobName - a String object.
        jobId - a String object.
        Returns:
        a JobExecution object.
        Throws:
        org.springframework.batch.core.launch.NoSuchJobExecutionException - if any.
        org.springframework.batch.core.repository.JobExecutionAlreadyRunningException - if any.
      • setJobRepository

        public void setJobRepository​(org.springframework.batch.core.repository.JobRepository jobRepository)

        Setter for the field jobRepository.

        Parameters:
        jobRepository - a JobRepository object.
      • setJobOperator

        public void setJobOperator​(org.springframework.batch.core.launch.JobOperator jobOperator)

        Setter for the field jobOperator.

        Parameters:
        jobOperator - a JobOperator object.
      • getJobRepository

        public org.springframework.batch.core.repository.JobRepository getJobRepository()

        Getter for the field jobRepository.

        Returns:
        a JobRepository object.
      • getJobOperator

        public org.springframework.batch.core.launch.JobOperator getJobOperator()

        Getter for the field jobOperator.

        Returns:
        a JobOperator object.