RESOLVED - BATCH-844: Lacking of DAO's property setting in JobRepositoryFactoryBean
Pulled up the default value for exitMessageLength to AbstractJdbcBatchMetadataDao. Factory bean declares just one setter and applies the value to both job and step execution daos.
This commit is contained in:
@@ -17,6 +17,8 @@ public abstract class AbstractJdbcBatchMetadataDao implements InitializingBean {
|
||||
* Default value for the table prefix property.
|
||||
*/
|
||||
public static final String DEFAULT_TABLE_PREFIX = "BATCH_";
|
||||
|
||||
public static final int DEFAULT_EXIT_MESSAGE_LENGTH = 2500;
|
||||
|
||||
private String tablePrefix = DEFAULT_TABLE_PREFIX;
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
|
||||
private static final Log logger = LogFactory.getLog(JdbcJobExecutionDao.class);
|
||||
|
||||
private static final int DEFAULT_EXIT_MESSAGE_LENGTH = 2500;
|
||||
|
||||
private static final String GET_JOB_EXECUTION_COUNT = "SELECT count(JOB_EXECUTION_ID) from %PREFIX%JOB_EXECUTION "
|
||||
+ "where JOB_INSTANCE_ID = ?";
|
||||
|
||||
|
||||
@@ -58,8 +58,6 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
|
||||
private static final String CURRENT_VERSION_STEP_EXECUTION = "SELECT VERSION FROM %PREFIX%STEP_EXECUTION WHERE STEP_EXECUTION_ID=?";
|
||||
|
||||
private static final int DEFAULT_EXIT_MESSAGE_LENGTH = 2500;
|
||||
|
||||
private int exitMessageLength = DEFAULT_EXIT_MESSAGE_LENGTH;
|
||||
|
||||
private LobHandler lobHandler = new DefaultLobHandler();
|
||||
|
||||
@@ -54,6 +54,19 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean {
|
||||
|
||||
private DataFieldMaxValueIncrementerFactory incrementerFactory;
|
||||
|
||||
private int exitMessageLength = AbstractJdbcBatchMetadataDao.DEFAULT_EXIT_MESSAGE_LENGTH;
|
||||
|
||||
/**
|
||||
* Public setter for the exit message length in database. Do not set this if
|
||||
* you haven't modified the schema. Note this value will be used for both
|
||||
* {@link JdbcJobExecutionDao} and {@link JdbcStepExecutionDao}.
|
||||
*
|
||||
* @param exitMessageLength the exitMessageLength to set
|
||||
*/
|
||||
public void setExitMessageLength(int exitMessageLength) {
|
||||
this.exitMessageLength = exitMessageLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the {@link DataSource}.
|
||||
* @param dataSource a {@link DataSource}
|
||||
@@ -64,7 +77,8 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean {
|
||||
|
||||
/**
|
||||
* Sets the database type.
|
||||
* @param dbType as specified by {@link DefaultDataFieldMaxValueIncrementerFactory}
|
||||
* @param dbType as specified by
|
||||
* {@link DefaultDataFieldMaxValueIncrementerFactory}
|
||||
*/
|
||||
public void setDatabaseType(String dbType) {
|
||||
this.databaseType = dbType;
|
||||
@@ -113,6 +127,7 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean {
|
||||
dao.setJobExecutionIncrementer(incrementerFactory.getIncrementer(databaseType, tablePrefix
|
||||
+ "JOB_EXECUTION_SEQ"));
|
||||
dao.setTablePrefix(tablePrefix);
|
||||
dao.setExitMessageLength(exitMessageLength);
|
||||
dao.afterPropertiesSet();
|
||||
return dao;
|
||||
}
|
||||
@@ -123,6 +138,7 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean {
|
||||
dao.setStepExecutionIncrementer(incrementerFactory.getIncrementer(databaseType, tablePrefix
|
||||
+ "STEP_EXECUTION_SEQ"));
|
||||
dao.setTablePrefix(tablePrefix);
|
||||
dao.setExitMessageLength(exitMessageLength);
|
||||
dao.afterPropertiesSet();
|
||||
return dao;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user