public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements JobInstanceDao, org.springframework.beans.factory.InitializingBean
JobInstanceDao. Uses sequences (via Spring's
DataFieldMaxValueIncrementer abstraction) to create all primary keys
before inserting a new row. Objects are checked to ensure all mandatory
fields to be stored are not null. If any are found to be null, an
IllegalArgumentException will be thrown. This could be left to JdbcTemplate,
however, the exception will be fairly vague, and fails to highlight which
field caused the exception.DEFAULT_EXIT_MESSAGE_LENGTH, DEFAULT_TABLE_PREFIX| Constructor and Description |
|---|
JdbcJobInstanceDao() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
JobInstance |
createJobInstance(java.lang.String jobName,
JobParameters jobParameters)
In this JDBC implementation a job id is obtained by asking the
jobIncrementer (which is likely a sequence) for the next long value, and
then passing the Id and parameter values into an INSERT statement.
|
java.util.List<JobInstance> |
findJobInstancesByName(java.lang.String jobName,
int start,
int count)
Fetch the last job instances with the provided name, sorted backwards by
primary key, using a 'like' criteria
|
JobInstance |
getJobInstance(JobExecution jobExecution)
Fetch the JobInstance for the provided JobExecution.
|
JobInstance |
getJobInstance(java.lang.Long instanceId)
Fetch the job instance with the provided identifier.
|
JobInstance |
getJobInstance(java.lang.String jobName,
JobParameters jobParameters)
The job table is queried for any jobs that match the
given identifier, adding them to a list via the RowMapper callback.
|
int |
getJobInstanceCount(java.lang.String jobName)
Query the repository for the number of unique
JobInstances
associated with the supplied job name. |
java.util.List<JobInstance> |
getJobInstances(java.lang.String jobName,
int start,
int count)
Fetch the last job instances with the provided name, sorted backwards by
primary key.
|
java.util.List<java.lang.String> |
getJobNames()
Retrieve the names of all job instances sorted alphabetically - i.e.
|
void |
setJobIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobIncrementer)
Setter for
DataFieldMaxValueIncrementer to be used when
generating primary keys for JobInstance instances. |
getClobTypeToUse, getJdbcTemplate, getQuery, getTablePrefix, setClobTypeToUse, setJdbcTemplate, setTablePrefixpublic JobInstance createJobInstance(java.lang.String jobName, JobParameters jobParameters)
createJobInstance in interface JobInstanceDaojava.lang.IllegalArgumentException - if any JobParameters fields are null.JobInstanceDao.createJobInstance(String, JobParameters)public JobInstance getJobInstance(java.lang.String jobName, JobParameters jobParameters)
getJobInstance in interface JobInstanceDaojobName - the name of the jobjobParameters - the parameters with which the job was executedJobInstance object matching the job name and
JobParameters or nulljava.lang.IllegalArgumentException - if any JobParameters fields are null.JobInstanceDao.getJobInstance(String, JobParameters)public JobInstance getJobInstance(java.lang.Long instanceId)
JobInstanceDaogetJobInstance in interface JobInstanceDaoinstanceId - the job identifierpublic java.util.List<java.lang.String> getJobNames()
JobInstanceDaogetJobNames in interface JobInstanceDaopublic java.util.List<JobInstance> getJobInstances(java.lang.String jobName, int start, int count)
JobInstanceDaogetJobInstances in interface JobInstanceDaojobName - the job namestart - the start index of the instances to returncount - the maximum number of objects to returnpublic JobInstance getJobInstance(JobExecution jobExecution)
JobInstanceDaogetJobInstance in interface JobInstanceDaojobExecution - the JobExecutionpublic int getJobInstanceCount(java.lang.String jobName)
throws NoSuchJobException
JobInstanceDaoJobInstances
associated with the supplied job name.getJobInstanceCount in interface JobInstanceDaojobName - the name of the job to query forJobInstances that exist within the
associated job repositoryNoSuchJobExceptionpublic void setJobIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobIncrementer)
DataFieldMaxValueIncrementer to be used when
generating primary keys for JobInstance instances.jobIncrementer - the DataFieldMaxValueIncrementerpublic void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanafterPropertiesSet in class AbstractJdbcBatchMetadataDaojava.lang.Exceptionpublic java.util.List<JobInstance> findJobInstancesByName(java.lang.String jobName, int start, int count)
JobInstanceDaofindJobInstancesByName in interface JobInstanceDao