Class SimpleJobExplorer
java.lang.Object
org.springframework.batch.core.explore.support.SimpleJobExplorer
- All Implemented Interfaces:
JobExplorer
Implementation of
JobExplorer that uses the injected DAOs.- Since:
- 2.0
- Author:
- Dave Syer, Lucas Ward, Michael Minella, Will Schipp, Mahmoud Ben Hassine, Parikshit Dutta
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleJobExplorer(JobInstanceDao jobInstanceDao, JobExecutionDao jobExecutionDao, StepExecutionDao stepExecutionDao, ExecutionContextDao ecDao) Constructor to initialize the jobSimpleJobExplorer. -
Method Summary
Modifier and TypeMethodDescriptionfindJobInstancesByJobName(String jobName, int start, int count) FetchJobInstancevalues in descending order of creation (and, therefore, usually of first execution) with a 'like' or 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) getJobInstance(String jobName, JobParameters jobParameters) longgetJobInstanceCount(String jobName) Query the repository for the number of uniqueJobInstanceobjects 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) Constructor to initialize the jobSimpleJobExplorer.- Parameters:
jobInstanceDao- TheJobInstanceDaoto be used by the repository.jobExecutionDao- TheJobExecutionDaoto be used by the repository.stepExecutionDao- TheStepExecutionDaoto be used by the repository.ecDao- TheExecutionContextDaoto be used by the repository.
-
-
Method Details
-
getJobExecutions
Description copied from interface:JobExplorerRetrieve 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, useJobExplorer.getStepExecution(Long, Long)to hydrate them.- Specified by:
getJobExecutionsin interfaceJobExplorer- Parameters:
jobInstance- TheJobInstanceto query.- Returns:
- the list 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- 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.
-
findRunningJobExecutions
Description copied from interface:JobExplorerRetrieve 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, useJobExplorer.getStepExecution(Long, 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.
-
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
JobExecutionthat has this ID ornullif 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 it may not contain the job instance information.- Specified by:
getStepExecutionin interfaceJobExplorer- Parameters:
jobExecutionId- The parent job execution ID.executionId- The step execution ID.- Returns:
- the
StepExecutionthat has this ID ornullif not found. - See Also:
-
getJobInstance
- Specified by:
getJobInstancein interfaceJobExplorer- Parameters:
instanceId-LongThe ID for theJobInstanceto obtain.- Returns:
- the
JobInstancethat has this ID, ornullif not found.
-
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.
-
getLastJobInstance
Description copied from interface:JobExplorerFind 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.
-
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 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.
-
getJobNames
Description copied from interface:JobExplorerQuery the repository for all uniqueJobInstancenames (sorted alphabetically).- Specified by:
getJobNamesin interfaceJobExplorer- Returns:
- the list of job names that have been executed.
-
getJobInstanceCount
Description copied from interface:JobExplorerQuery 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.
-
findJobInstancesByJobName
Description copied from interface:JobExplorerFetchJobInstancevalues in descending order of creation (and, therefore, usually of first execution) with a 'like' or wildcard criteria.- Specified by:
findJobInstancesByJobNamein interfaceJobExplorer- Parameters:
jobName- The name of the job for which to query.start- The start index of the instances to return.count- The maximum number of instances to return.- Returns:
- a list of
JobInstancefor the requested job name.
-