Class AbstractJobRepositoryFactoryBean
- java.lang.Object
- org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<JobRepository>
,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
JobRepositoryFactoryBean
,MapJobRepositoryFactoryBean
public abstract class AbstractJobRepositoryFactoryBean extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<JobRepository>, org.springframework.beans.factory.InitializingBean
AFactoryBean
that automates the creation of aSimpleJobRepository
. Declares abstract methods for providing DAO object implementations.- Author:
- Ben Hale, Lucas Ward, Robert Kasanicky
- See Also:
JobRepositoryFactoryBean
,MapJobRepositoryFactoryBean
Constructor Summary
Constructors Constructor Description AbstractJobRepositoryFactoryBean()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterPropertiesSet()
protected abstract ExecutionContextDao
createExecutionContextDao()
protected abstract JobExecutionDao
createJobExecutionDao()
protected abstract JobInstanceDao
createJobInstanceDao()
protected abstract StepExecutionDao
createStepExecutionDao()
JobRepository
getJobRepository()
Deprecated.usegetObject()
insteadJobRepository
getObject()
java.lang.Class<JobRepository>
getObjectType()
The type of object to be returned fromgetObject()
.org.springframework.transaction.PlatformTransactionManager
getTransactionManager()
The transaction manager used in this factory.boolean
isSingleton()
void
setIsolationLevelForCreate(java.lang.String isolationLevelForCreate)
public setter for the isolation level to be used for the transaction when job execution entities are initially created.void
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Public setter for thePlatformTransactionManager
.void
setValidateTransactionState(boolean validateTransactionState)
Flag to determine whether to check for an existing transaction when a JobExecution is created.
Method Detail
createJobInstanceDao
protected abstract JobInstanceDao createJobInstanceDao() throws java.lang.Exception
- Returns:
- fully configured
JobInstanceDao
implementation. - Throws:
java.lang.Exception
- thrown if error occurs creating JobInstanceDao.
createJobExecutionDao
protected abstract JobExecutionDao createJobExecutionDao() throws java.lang.Exception
- Returns:
- fully configured
JobExecutionDao
implementation. - Throws:
java.lang.Exception
- thrown if error occurs creating JobExecutionDao.
createStepExecutionDao
protected abstract StepExecutionDao createStepExecutionDao() throws java.lang.Exception
- Returns:
- fully configured
StepExecutionDao
implementation. - Throws:
java.lang.Exception
- thrown if error occurs creating StepExecutionDao.
createExecutionContextDao
protected abstract ExecutionContextDao createExecutionContextDao() throws java.lang.Exception
- Returns:
- fully configured
ExecutionContextDao
implementation. - Throws:
java.lang.Exception
- thrown if error occurs creating ExecutionContextDao.
getObjectType
public java.lang.Class<JobRepository> getObjectType()
The type of object to be returned fromgetObject()
.- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<JobRepository>
- Returns:
- JobRepository.class
- See Also:
FactoryBean.getObjectType()
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<JobRepository>
setValidateTransactionState
public void setValidateTransactionState(boolean validateTransactionState)
Flag to determine whether to check for an existing transaction when a JobExecution is created. Defaults to true because it is usually a mistake, and leads to problems with restartability and also to deadlocks in multi-threaded steps.- Parameters:
validateTransactionState
- the flag to set
setIsolationLevelForCreate
public void setIsolationLevelForCreate(java.lang.String isolationLevelForCreate)
public setter for the isolation level to be used for the transaction when job execution entities are initially created. The default is ISOLATION_SERIALIZABLE, which prevents accidental concurrent execution of the same job (ISOLATION_REPEATABLE_READ would work as well).- Parameters:
isolationLevelForCreate
- the isolation level name to set- See Also:
SimpleJobRepository.createJobExecution(String, org.springframework.batch.core.JobParameters)
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Public setter for thePlatformTransactionManager
.- Parameters:
transactionManager
- the transactionManager to set
getTransactionManager
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
The transaction manager used in this factory. Useful to inject into steps and jobs, to ensure that they are using the same instance.- Returns:
- the transactionManager
getJobRepository
@Deprecated public JobRepository getJobRepository() throws java.lang.Exception
Deprecated.usegetObject()
insteadConvenience method for clients to grab theJobRepository
without a cast.- Returns:
- the
JobRepository
fromgetObject()
- Throws:
java.lang.Exception
- if the repository could not be created
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
getObject
public JobRepository getObject() throws java.lang.Exception
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<JobRepository>
- Throws:
java.lang.Exception