Class JobRepositoryFactoryBean
java.lang.Object
org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean
org.springframework.batch.core.repository.support.JobRepositoryFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<JobRepository>,org.springframework.beans.factory.InitializingBean
public class JobRepositoryFactoryBean
extends AbstractJobRepositoryFactoryBean
implements org.springframework.beans.factory.InitializingBean
A
FactoryBean that automates the creation of a
SimpleJobRepository using JDBC DAO implementations which persist
batch metadata in database. Requires the user to describe what kind of
database they are using.- Author:
- Ben Hale, Lucas Ward, Dave Syer, Michael Minella, Mahmoud Ben Hassine
-
Field Summary
FieldsFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected ExecutionContextDaoprotected JobExecutionDaoprotected JobInstanceDaoprotected StepExecutionDaovoidsetClobType(int type) voidsetDatabaseType(String dbType) Sets the database type.voidsetDataSource(DataSource dataSource) Public setter for theDataSource.voidsetIncrementerFactory(DataFieldMaxValueIncrementerFactory incrementerFactory) voidsetJdbcOperations(org.springframework.jdbc.core.JdbcOperations jdbcOperations) Public setter for theJdbcOperations.voidsetLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler) A special handler for large objects.voidsetMaxVarCharLength(int maxVarCharLength) Public setter for the length of long string columns in database.voidsetSerializer(ExecutionContextSerializer serializer) A custom implementation of theExecutionContextSerializer.voidsetTablePrefix(String tablePrefix) Sets the table prefix for all the batch meta-data tables.Methods inherited from class org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean
getObject, getObjectType, getTransactionManager, isSingleton, setIsolationLevelForCreate, setIsolationLevelForCreate, setTransactionManager, setValidateTransactionState
-
Field Details
-
logger
protected static final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
JobRepositoryFactoryBean
public JobRepositoryFactoryBean()
-
-
Method Details
-
setClobType
public void setClobType(int type) - Parameters:
type- a value from theTypesclass to indicate the type to use for a CLOB
-
setSerializer
A custom implementation of theExecutionContextSerializer. The default, if not injected, is theJackson2ExecutionContextStringSerializer.- Parameters:
serializer- used to serialize/deserializeExecutionContext- See Also:
-
setLobHandler
public void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler) A special handler for large objects. The default is usually fine, except for some (usually older) versions of Oracle. The default is determined from the data base type.- Parameters:
lobHandler- theLobHandlerto set- See Also:
-
LobHandler
-
setMaxVarCharLength
public void setMaxVarCharLength(int maxVarCharLength) Public setter for the length of long string columns in database. Do not set this if you haven't modified the schema. Note this value will be used for the exit message in bothJdbcJobExecutionDaoandJdbcStepExecutionDaoand also the short version of the execution context inJdbcExecutionContextDao. For databases with multi-byte character sets this number can be smaller (by up to a factor of 2 for 2-byte characters) than the declaration of the column length in the DDL for the tables.- Parameters:
maxVarCharLength- the exitMessageLength to set
-
setDataSource
Public setter for theDataSource.- Parameters:
dataSource- aDataSource
-
setJdbcOperations
public void setJdbcOperations(org.springframework.jdbc.core.JdbcOperations jdbcOperations) Public setter for theJdbcOperations. If this property is not set explicitly, a newJdbcTemplatewill be created for the configured DataSource by default.- Parameters:
jdbcOperations- aJdbcOperations
-
setDatabaseType
Sets the database type.- Parameters:
dbType- as specified byDefaultDataFieldMaxValueIncrementerFactory
-
setTablePrefix
Sets the table prefix for all the batch meta-data tables.- Parameters:
tablePrefix- prefix prepended to batch meta-data tables
-
setIncrementerFactory
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classAbstractJobRepositoryFactoryBean- Throws:
Exception
-
createJobInstanceDao
- Specified by:
createJobInstanceDaoin classAbstractJobRepositoryFactoryBean- Returns:
- fully configured
JobInstanceDaoimplementation. - Throws:
Exception- thrown if error occurs creating JobInstanceDao.
-
createJobExecutionDao
- Specified by:
createJobExecutionDaoin classAbstractJobRepositoryFactoryBean- Returns:
- fully configured
JobExecutionDaoimplementation. - Throws:
Exception- thrown if error occurs creating JobExecutionDao.
-
createStepExecutionDao
- Specified by:
createStepExecutionDaoin classAbstractJobRepositoryFactoryBean- Returns:
- fully configured
StepExecutionDaoimplementation. - Throws:
Exception- thrown if error occurs creating StepExecutionDao.
-
createExecutionContextDao
- Specified by:
createExecutionContextDaoin classAbstractJobRepositoryFactoryBean- Returns:
- fully configured
ExecutionContextDaoimplementation. - Throws:
Exception- thrown if error occurs creating ExecutionContextDao.
-