Interface JobRepository
- All Superinterfaces:
JobExplorer
- All Known Implementing Classes:
ResourcelessJobRepository, SimpleJobRepository
Repository responsible for persistence of batch meta-data entities.
- Author:
- Lucas Ward, Dave Syer, Robert Kasanicky, David Turanski, Michael Minella, Mahmoud Ben Hassine, Parikshit Dutta
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault JobExecutioncreateJobExecution(JobInstance jobInstance, JobParameters jobParameters, ExecutionContext executionContext) createJobInstance(String jobName, JobParameters jobParameters) Create a newJobInstancewith the name and job parameters provided.default StepExecutioncreateStepExecution(String stepName, JobExecution jobExecution) Create aStepExecutionfor a givenJobExecutionand step name.default voiddeleteJobExecution(JobExecution jobExecution) Delete the job execution object graph (ie the job execution with its execution context, all related step executions and their executions contexts, as well as associated job parameters)default voiddeleteJobInstance(JobInstance jobInstance) Delete the job instance object graph (ie the job instance with all associated job executions along with their respective object graphs as specified indeleteJobExecution(JobExecution)).default voiddeleteStepExecution(StepExecution stepExecution) Delete the step execution along with its execution context.default List<JobInstance> findJobInstances(String jobName) Fetch allJobInstancevalues for a given job name.default Set<JobExecution> findRunningJobExecutions(String jobName) Retrieve running job executions.default @Nullable JobExecutiongetJobExecution(long executionId) Retrieve aJobExecutionby its ID.default List<JobExecution> getJobExecutions(JobInstance jobInstance) Retrieve job executions by their job instance.default @Nullable JobInstancegetJobInstance(long jobInstanceId) default @Nullable JobInstancegetJobInstance(String jobName, JobParameters jobParameters) default longgetJobInstanceCount(String jobName) Query the repository for the number of uniqueJobInstanceobjects associated with the supplied job name.default List<JobInstance> getJobInstances(String jobName, int start, int count) FetchJobInstancevalues in descending order of creation (and, therefore, usually, of first execution).Query the repository for all uniqueJobInstancenames (sorted alphabetically).default @Nullable JobExecutiongetLastJobExecution(String jobName, JobParameters jobParameters) default @Nullable JobExecutiongetLastJobExecution(JobInstance jobInstance) Find the lastJobExecutionthat has been created for a givenJobInstance.default @Nullable JobInstancegetLastJobInstance(String jobName) Find the last job instance, by ID, for the given job.default @Nullable StepExecutiongetLastStepExecution(JobInstance jobInstance, String stepName) default @Nullable StepExecutiongetStepExecution(long stepExecutionId) Retrieve aStepExecutionby its ID.default @Nullable StepExecutiongetStepExecution(long jobExecutionId, long stepExecutionId) Deprecated, for removal: This API element is subject to removal in a future version.default longgetStepExecutionCount(JobInstance jobInstance, String stepName) voidupdate(JobExecution jobExecution) Update theJobExecution(but not itsExecutionContext).voidupdate(StepExecution stepExecution) Update theStepExecution(but not itsExecutionContext).voidupdateExecutionContext(JobExecution jobExecution) Persist the updatedExecutionContextof the givenJobExecution.voidupdateExecutionContext(StepExecution stepExecution) Persist the updatedExecutionContexts of the givenStepExecution.Methods inherited from interface JobExplorer
findJobExecutions, findJobInstancesByJobName, findJobInstancesByName, isJobInstanceExists
-
Method Details
-
getJobNames
Query the repository for all uniqueJobInstancenames (sorted alphabetically).- Specified by:
getJobNamesin interfaceJobExplorer- Returns:
- the list of job names that have been executed.
-
getJobInstances
FetchJobInstancevalues in descending order of creation (and, therefore, usually, of first execution).- Specified by:
getJobInstancesin interfaceJobExplorer- Parameters:
jobName- The name of the job to query.start- The start index of the instances to return.count- The maximum number of instances to return.- Returns:
- the
JobInstancevalues up to a maximum of count values.
-
findJobInstances
Fetch allJobInstancevalues for a given job name.- Parameters:
jobName- The name of the job.- Returns:
- the
JobInstancevalues. - Since:
- 6.0
-
getJobInstance
- Specified by:
getJobInstancein interfaceJobExplorer- Parameters:
jobInstanceId- The ID for theJobInstanceto obtain.- Returns:
- the
JobInstancethat has this ID, ornullif not found.
-
getLastJobInstance
Find the last job instance, by ID, for the given job.- Specified by:
getLastJobInstancein interfaceJobExplorer- Parameters:
jobName- The name of the job.- Returns:
- the last job instance by Id if any or
nullotherwise. - Since:
- 4.2
-
getJobInstance
- Specified by:
getJobInstancein interfaceJobExplorer- Parameters:
jobName-Stringname of the job.jobParameters-JobParametersparameters for the job instance.- Returns:
- the
JobInstancewith the given name and parameters, ornull. - Since:
- 5.0
-
getJobInstanceCount
Query the repository for the number of uniqueJobInstanceobjects associated with the supplied job name.- Specified by:
getJobInstanceCountin interfaceJobExplorer- Parameters:
jobName- The name of the job for which to query.- Returns:
- the number of
JobInstances that exist within the associated job repository. - Throws:
NoSuchJobException- thrown when there is noJobInstancefor the jobName specified.
-
getJobExecution
Retrieve aJobExecutionby its ID. The complete object graph for this execution should be returned (unless otherwise indicated), including the parentJobInstanceand associatedExecutionContextandStepExecutioninstances (also including their execution contexts).- Specified by:
getJobExecutionin interfaceJobExplorer- Parameters:
executionId- The job execution ID.- Returns:
- the
JobExecutionthat has this ID ornullif not found.
-
getJobExecutions
Retrieve job executions by their job instance. The corresponding step executions may not be fully hydrated (for example, their execution context may be missing), depending on the implementation. In that case, usegetStepExecution(long)to hydrate them.- Specified by:
getJobExecutionsin interfaceJobExplorer- Parameters:
jobInstance- TheJobInstanceto query.- Returns:
- the list of all executions for the specified
JobInstance.
-
getLastJobExecution
Find the lastJobExecutionthat has been created for a givenJobInstance.- Specified by:
getLastJobExecutionin interfaceJobExplorer- Parameters:
jobInstance- TheJobInstancefor which to find the lastJobExecution.- Returns:
- the last
JobExecutionthat has been created for this instance ornullif no job execution is found for the given job instance. - Since:
- 4.2
-
getLastJobExecution
- Specified by:
getLastJobExecutionin interfaceJobExplorer- Parameters:
jobName- the name of the job that might have runjobParameters- parameters identifying theJobInstance- Returns:
- the last execution of job if exists, null otherwise
-
findRunningJobExecutions
Retrieve running job executions. The corresponding step executions may not be fully hydrated (for example, their execution context may be missing), depending on the implementation. In that case, usegetStepExecution(long)to hydrate them.- Specified by:
findRunningJobExecutionsin interfaceJobExplorer- Parameters:
jobName- The name of the job.- Returns:
- the set of running executions for jobs with the specified name.
-
getStepExecution
@Deprecated(since="6.0", forRemoval=true) default @Nullable StepExecution getStepExecution(long jobExecutionId, long stepExecutionId) Deprecated, for removal: This API element is subject to removal in a future version.since 6.0 in favor ofgetStepExecution(long)Retrieve aStepExecutionby its ID and parentJobExecutionID. The execution context for the step should be available in the result, and the parent job execution should have its primitive properties, but it may not contain the job instance information.- Specified by:
getStepExecutionin interfaceJobExplorer- Parameters:
jobExecutionId- The parent job execution ID.stepExecutionId- The step execution ID.- Returns:
- the
StepExecutionthat has this ID ornullif not found. - See Also:
-
getStepExecution
Retrieve aStepExecutionby its ID. The execution context for the step should be available in the result, and the parent job execution should have its primitive properties, but it may not contain the job instance information.- Parameters:
stepExecutionId- The step execution ID.- Returns:
- the
StepExecutionthat has this ID ornullif not found. - Since:
- 6.0
-
getLastStepExecution
- Specified by:
getLastStepExecutionin interfaceJobExplorer- Parameters:
jobInstance-JobInstanceinstance containing the step executions.stepName- the name of the step execution that might have run.- Returns:
- the last execution of step for the given job instance.
-
getStepExecutionCount
default long getStepExecutionCount(JobInstance jobInstance, String stepName) throws NoSuchStepException - Specified by:
getStepExecutionCountin interfaceJobExplorer- Parameters:
jobInstance-JobInstanceinstance containing the step executions.stepName- the name of the step execution that might have run.- Returns:
- the execution count of the step within the given job instance.
- Throws:
NoSuchStepException
-
createJobInstance
Create a newJobInstancewith the name and job parameters provided.- Parameters:
jobName- logical name of the jobjobParameters- parameters used to execute the job- Returns:
- the new
JobInstance
-
deleteJobInstance
Delete the job instance object graph (ie the job instance with all associated job executions along with their respective object graphs as specified indeleteJobExecution(JobExecution)).- Parameters:
jobInstance- the job instance to delete- Since:
- 5.0
-
createJobExecution
default JobExecution createJobExecution(JobInstance jobInstance, JobParameters jobParameters, ExecutionContext executionContext) Create aJobExecutionfor a givenJobInstance,JobParametersandExecutionContext. TheJobInstancemust already exist. The returnedJobExecutionwill be associated with theJobInstance(ie. should be added to the list ofJobInstance.getJobExecutions().- Parameters:
jobInstance- the job instance to which the execution belongsjobParameters- the runtime parameters for the jobexecutionContext- the execution context to associate with the job execution- Returns:
- a valid
JobExecutionfor the arguments provided - Since:
- 6.0
-
update
Update theJobExecution(but not itsExecutionContext).Preconditions:
JobExecutionmust contain a validJobInstanceand be saved (have an id assigned).- Parameters:
jobExecution-JobExecutioninstance to be updated in the repo.
-
updateExecutionContext
Persist the updatedExecutionContextof the givenJobExecution.- Parameters:
jobExecution-JobExecutioninstance to be used to update the context.
-
deleteJobExecution
Delete the job execution object graph (ie the job execution with its execution context, all related step executions and their executions contexts, as well as associated job parameters)- Parameters:
jobExecution- the job execution to delete- Since:
- 5.0
-
createStepExecution
Create aStepExecutionfor a givenJobExecutionand step name. TheJobExecutionmust already exist. The returnedStepExecutionshould be associated with theJobExecution(ie. should be added to the list ofJobExecution.getStepExecutions().- Parameters:
stepName- the name of the stepjobExecution- the job execution to which the step execution belongs- Returns:
- a valid
StepExecutionfor the arguments provided - Since:
- 6.0
-
update
Update theStepExecution(but not itsExecutionContext).Preconditions:
StepExecutionmust be saved (have an id assigned).- Parameters:
stepExecution-StepExecutioninstance to be updated in the repo.
-
updateExecutionContext
Persist the updatedExecutionContexts of the givenStepExecution.- Parameters:
stepExecution-StepExecutioninstance to be used to update the context.
-
deleteStepExecution
Delete the step execution along with its execution context.- Parameters:
stepExecution- the step execution to delete- Since:
- 5.0
-
getStepExecution(long)