Class SimpleJobExplorer
- java.lang.Object
- org.springframework.batch.core.explore.support.SimpleJobExplorer
- All Implemented Interfaces:
JobExplorer
public class SimpleJobExplorer extends java.lang.Object implements JobExplorer
Implementation ofJobExplorer
using the injected DAOs.- Since:
- 2.0
- Author:
- Dave Syer, Lucas Ward, Michael Minella, Will Schipp, Mahmoud Ben Hassine
- See Also:
JobExplorer
,JobInstanceDao
,JobExecutionDao
,StepExecutionDao
Constructor Summary
Constructors Constructor Description SimpleJobExplorer(JobInstanceDao jobInstanceDao, JobExecutionDao jobExecutionDao, StepExecutionDao stepExecutionDao, ExecutionContextDao ecDao)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<JobInstance>
findJobInstancesByJobName(java.lang.String jobName, int start, int count)
FetchJobInstance
values in descending order of creation (and there for usually of first execution) with a 'like'/wildcard criteria.java.util.Set<JobExecution>
findRunningJobExecutions(java.lang.String jobName)
Retrieve running job executions.JobExecution
getJobExecution(java.lang.Long executionId)
Retrieve aJobExecution
by its id.java.util.List<JobExecution>
getJobExecutions(JobInstance jobInstance)
Retrieve job executions by their job instance.JobInstance
getJobInstance(java.lang.Long instanceId)
int
getJobInstanceCount(java.lang.String jobName)
Query the repository for the number of uniqueJobInstance
s associated with the supplied job name.java.util.List<JobInstance>
getJobInstances(java.lang.String jobName, int start, int count)
FetchJobInstance
values in descending order of creation (and therefore usually of first execution).java.util.List<java.lang.String>
getJobNames()
Query the repository for all uniqueJobInstance
names (sorted alphabetically).StepExecution
getStepExecution(java.lang.Long jobExecutionId, java.lang.Long executionId)
Retrieve aStepExecution
by its id and parentJobExecution
id.
Constructor Detail
SimpleJobExplorer
public SimpleJobExplorer(JobInstanceDao jobInstanceDao, JobExecutionDao jobExecutionDao, StepExecutionDao stepExecutionDao, ExecutionContextDao ecDao)
Method Detail
getJobExecutions
public java.util.List<JobExecution> getJobExecutions(JobInstance jobInstance)
Description copied from interface:JobExplorer
Retrieve 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:
getJobExecutions
in interfaceJobExplorer
- Parameters:
jobInstance
- theJobInstance
to query- Returns:
- the set of all executions for the specified
JobInstance
findRunningJobExecutions
public java.util.Set<JobExecution> findRunningJobExecutions(java.lang.String jobName)
Description copied from interface:JobExplorer
Retrieve 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:
findRunningJobExecutions
in interfaceJobExplorer
- Parameters:
jobName
- the name of the job- Returns:
- the set of running executions for jobs with the specified name
getJobExecution
public JobExecution getJobExecution(java.lang.Long executionId)
Description copied from interface:JobExplorer
Retrieve aJobExecution
by its id. The complete object graph for this execution should be returned (unless otherwise indicated) including the parentJobInstance
and associatedExecutionContext
andStepExecution
instances (also including their execution contexts).- Specified by:
getJobExecution
in interfaceJobExplorer
- Parameters:
executionId
- the job execution id- Returns:
- the
JobExecution
with this id, or null if not found
getStepExecution
public StepExecution getStepExecution(java.lang.Long jobExecutionId, java.lang.Long executionId)
Description copied from interface:JobExplorer
Retrieve aStepExecution
by its id and parentJobExecution
id. 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:
getStepExecution
in interfaceJobExplorer
- Parameters:
jobExecutionId
- the parent job execution idexecutionId
- the step execution id- Returns:
- the
StepExecution
with this id, or null if not found - See Also:
JobExplorer.getJobExecution(Long)
getJobInstance
public JobInstance getJobInstance(@Nullable java.lang.Long instanceId)
- Specified by:
getJobInstance
in interfaceJobExplorer
- Parameters:
instanceId
-Long
id for the jobInstance to obtain.- Returns:
- the
JobInstance
with this id, or null
getJobInstances
public java.util.List<JobInstance> getJobInstances(java.lang.String jobName, int start, int count)
Description copied from interface:JobExplorer
FetchJobInstance
values in descending order of creation (and therefore usually of first execution).- Specified by:
getJobInstances
in 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
JobInstance
values up to a maximum of count values
getJobNames
public java.util.List<java.lang.String> getJobNames()
Description copied from interface:JobExplorer
Query the repository for all uniqueJobInstance
names (sorted alphabetically).- Specified by:
getJobNames
in interfaceJobExplorer
- Returns:
- the set of job names that have been executed
getJobInstanceCount
public int getJobInstanceCount(@Nullable java.lang.String jobName) throws NoSuchJobException
Description copied from interface:JobExplorer
Query the repository for the number of uniqueJobInstance
s associated with the supplied job name.- Specified by:
getJobInstanceCount
in interfaceJobExplorer
- Parameters:
jobName
- the name of the job to query for- Returns:
- the number of
JobInstance
s that exist within the associated job repository - Throws:
NoSuchJobException
- thrown when there is noJobInstance
for the jobName specified.
findJobInstancesByJobName
public java.util.List<JobInstance> findJobInstancesByJobName(java.lang.String jobName, int start, int count)
Description copied from interface:JobExplorer
FetchJobInstance
values in descending order of creation (and there for usually of first execution) with a 'like'/wildcard criteria.- Specified by:
findJobInstancesByJobName
in 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
JobInstance
for the job name requested.