Class SimpleJobExplorer
java.lang.Object
org.springframework.batch.core.explore.support.SimpleJobExplorer
- All Implemented Interfaces:
JobExplorer
Implementation of
JobExplorer using the injected DAOs.- Since:
- 2.0
- Author:
- Dave Syer, Lucas Ward, Michael Minella, Will Schipp, Mahmoud Ben Hassine
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleJobExplorer(JobInstanceDao jobInstanceDao, JobExecutionDao jobExecutionDao, StepExecutionDao stepExecutionDao, ExecutionContextDao ecDao) -
Method Summary
Modifier and TypeMethodDescriptionfindJobInstancesByJobName(String jobName, int start, int count) FetchJobInstancevalues in descending order of creation (and there for usually of first execution) with a 'like'/wildcard criteria.findRunningJobExecutions(String jobName) Retrieve running job executions.getJobExecution(Long executionId) Retrieve aJobExecutionby its id.getJobExecutions(JobInstance jobInstance) Retrieve job executions by their job instance.getJobInstance(Long instanceId) intgetJobInstanceCount(String jobName) Query the repository for the number of uniqueJobInstances associated with the supplied job name.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).getLastJobExecution(JobInstance jobInstance) Find the lastJobExecutionthat has been created for a givenJobInstance.getLastJobInstance(String jobName) Find the last job instance by Id for the given job.getStepExecution(Long jobExecutionId, Long executionId) Retrieve aStepExecutionby its id and parentJobExecutionid.
-
Constructor Details
-
SimpleJobExplorer
public SimpleJobExplorer(JobInstanceDao jobInstanceDao, JobExecutionDao jobExecutionDao, StepExecutionDao stepExecutionDao, ExecutionContextDao ecDao)
-
-
Method Details
-
getJobExecutions
Description copied from interface:JobExplorerRetrieve job executions by their job instance. The corresponding step executions may not be fully hydrated (e.g. their execution context may be missing), depending on the implementation. UseJobExplorer.getStepExecution(Long, Long)to hydrate them in that case.- Specified by:
getJobExecutionsin interfaceJobExplorer- Parameters:
jobInstance- theJobInstanceto query- Returns:
- the set of all executions for the specified
JobInstance
-
getLastJobExecution
Description copied from interface:JobExplorerFind the lastJobExecutionthat has been created for a givenJobInstance.- Specified by:
getLastJobExecutionin interfaceJobExplorer- Parameters:
jobInstance- theJobInstance- Returns:
- the last
JobExecutionthat has been created for this instance ornullif no job execution is found for the given job instance.
-
findRunningJobExecutions
Description copied from interface:JobExplorerRetrieve running job executions. The corresponding step executions may not be fully hydrated (e.g. their execution context may be missing), depending on the implementation. UseJobExplorer.getStepExecution(Long, Long)to hydrate them in that case.- Specified by:
findRunningJobExecutionsin interfaceJobExplorer- Parameters:
jobName- the name of the job- Returns:
- the set of running executions for jobs with the specified name
-
getJobExecution
Description copied from interface:JobExplorerRetrieve 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
JobExecutionwith this id, or null if not found
-
getStepExecution
@Nullable public StepExecution getStepExecution(@Nullable Long jobExecutionId, @Nullable Long executionId) Description copied from interface:JobExplorerRetrieve 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 may not contain the job instance information.- Specified by:
getStepExecutionin interfaceJobExplorer- Parameters:
jobExecutionId- the parent job execution idexecutionId- the step execution id- Returns:
- the
StepExecutionwith this id, or null if not found - See Also:
-
getJobInstance
- Specified by:
getJobInstancein interfaceJobExplorer- Parameters:
instanceId-Longid for the jobInstance to obtain.- Returns:
- the
JobInstancewith this id, or null
-
getLastJobInstance
Description copied from interface:JobExplorerFind the last job instance by Id for the given job.- Specified by:
getLastJobInstancein interfaceJobExplorer- Parameters:
jobName- name of the job- Returns:
- the last job instance by Id if any or null otherwise
-
getJobInstances
Description copied from interface:JobExplorerFetchJobInstancevalues in descending order of creation (and therefore usually of first execution).- Specified by:
getJobInstancesin interfaceJobExplorer- Parameters:
jobName- the name of the job to querystart- the start index of the instances to returncount- the maximum number of instances to return- Returns:
- the
JobInstancevalues up to a maximum of count values
-
getJobNames
Description copied from interface:JobExplorerQuery the repository for all uniqueJobInstancenames (sorted alphabetically).- Specified by:
getJobNamesin interfaceJobExplorer- Returns:
- the set of job names that have been executed
-
getJobInstanceCount
Description copied from interface:JobExplorerQuery the repository for the number of uniqueJobInstances associated with the supplied job name.- Specified by:
getJobInstanceCountin interfaceJobExplorer- Parameters:
jobName- the name of the job to query for- Returns:
- the number of
JobInstances that exist within the associated job repository - Throws:
NoSuchJobException- thrown when there is noJobInstancefor the jobName specified.
-
findJobInstancesByJobName
Description copied from interface:JobExplorerFetchJobInstancevalues in descending order of creation (and there for usually of first execution) with a 'like'/wildcard criteria.- Specified by:
findJobInstancesByJobNamein interfaceJobExplorer- Parameters:
jobName- the name of the job to query for.start- the start index of the instances to return.count- the maximum number of instances to return.- Returns:
- a list of
JobInstancefor the job name requested.
-