|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao org.springframework.batch.core.repository.dao.JdbcJobInstanceDao
public class JdbcJobInstanceDao
Jdbc implementation of 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.
Field Summary |
---|
Fields inherited from class org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao |
---|
DEFAULT_EXIT_MESSAGE_LENGTH, DEFAULT_TABLE_PREFIX |
Constructor Summary | |
---|---|
JdbcJobInstanceDao()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
JobInstance |
createJobInstance(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. |
protected String |
createJobKey(JobParameters jobParameters)
|
JobInstance |
getJobInstance(JobExecution jobExecution)
Fetch the JobInstance for the provided JobExecution. |
JobInstance |
getJobInstance(Long instanceId)
Fetch the job instance with the provided identifier. |
JobInstance |
getJobInstance(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. |
List<JobInstance> |
getJobInstances(String jobName,
int start,
int count)
Fetch the last job instances with the provided name, sorted backwards by primary key. |
List<String> |
getJobNames()
Retrieve the names of all job instances sorted alphabetically - i.e. jobs that have ever been executed. |
void |
setJobIncrementer(DataFieldMaxValueIncrementer jobIncrementer)
Setter for DataFieldMaxValueIncrementer to be used when
generating primary keys for JobInstance instances. |
Methods inherited from class org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao |
---|
getClobTypeToUse, getJdbcTemplate, getQuery, getTablePrefix, setClobTypeToUse, setJdbcTemplate, setTablePrefix |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JdbcJobInstanceDao()
Method Detail |
---|
public JobInstance createJobInstance(String jobName, JobParameters jobParameters)
createJobInstance
in interface JobInstanceDao
IllegalArgumentException
- if any JobParameters
fields are null.JobInstanceDao.createJobInstance(String, JobParameters)
protected String createJobKey(JobParameters jobParameters)
public JobInstance getJobInstance(String jobName, JobParameters jobParameters)
getJobInstance
in interface JobInstanceDao
jobName
- the name of the jobjobParameters
- the parameters with which the job was executed
JobInstance
object matching the job name and
JobParameters
or null
IllegalArgumentException
- if any JobParameters
fields are null.JobInstanceDao.getJobInstance(String, JobParameters)
public JobInstance getJobInstance(Long instanceId)
JobInstanceDao
getJobInstance
in interface JobInstanceDao
instanceId
- the job identifier
public List<String> getJobNames()
JobInstanceDao
getJobNames
in interface JobInstanceDao
public List<JobInstance> getJobInstances(String jobName, int start, int count)
JobInstanceDao
getJobInstances
in interface JobInstanceDao
jobName
- the job namestart
- the start index of the instances to returncount
- the maximum number of objects to return
public JobInstance getJobInstance(JobExecution jobExecution)
JobInstanceDao
getJobInstance
in interface JobInstanceDao
jobExecution
- the JobExecution
public void setJobIncrementer(DataFieldMaxValueIncrementer jobIncrementer)
DataFieldMaxValueIncrementer
to be used when
generating primary keys for JobInstance
instances.
jobIncrementer
- the DataFieldMaxValueIncrementer
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class AbstractJdbcBatchMetadataDao
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |