Package psidev.psi.mi.jami.batch
Class MIBatchJobManager
- java.lang.Object
-
- psidev.psi.mi.jami.batch.MIBatchJobManager
-
public class MIBatchJobManager extends Object
The psi mi enricher- Since:
02/08/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description MIBatchJobManager()
Constructor for MIBatchJobManager.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.batch.core.JobExecution
abandonJob(String jobName, String jobId)
Stops a job and returns the jobexecutionList<Long>
findJobIdsByName(String jobName, int start, int numberJobs)
Find all job ids having a given name.org.springframework.batch.core.JobExecution
findLastJobExecutionFor(String jobName, String jobId)
Find the last JobExecution having this name and this idorg.springframework.batch.core.launch.JobOperator
getJobOperator()
Getter for the fieldjobOperator
.org.springframework.batch.core.repository.JobRepository
getJobRepository()
Getter for the fieldjobRepository
.org.springframework.batch.core.BatchStatus
getJobStatusFor(String jobName, String jobId)
The job status of a given job name and idstatic void
main(String[] args)
main.Long
restartJob(long executionId)
Restart a job with a given execution idLong
restartJob(String jobName, String jobId)
This method will restart the last job which has been executed with a given namevoid
setJobOperator(org.springframework.batch.core.launch.JobOperator jobOperator)
Setter for the fieldjobOperator
.void
setJobRepository(org.springframework.batch.core.repository.JobRepository jobRepository)
Setter for the fieldjobRepository
.String
startJob(String jobName)
This method will start a job having a specific name and no job parameters.String
startJobWithParameters(String jobName, String parameters)
startJobWithParameters.boolean
stopJob(String jobName, String jobId)
Stop a give job name and id.
-
-
-
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 ofString
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
-
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
- aString
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
-
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
-
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
- aString
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
-
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
- aString
object.jobId
- aString
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
-
setJobRepository
public void setJobRepository(org.springframework.batch.core.repository.JobRepository jobRepository)
Setter for the field
jobRepository
.- Parameters:
jobRepository
- aJobRepository
object.
-
setJobOperator
public void setJobOperator(org.springframework.batch.core.launch.JobOperator jobOperator)
Setter for the field
jobOperator
.- Parameters:
jobOperator
- aJobOperator
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.
-
-