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:
robokaso
2008-09-22 11:00:14 +00:00
parent 265d914fec
commit 9acbaef7dd
4 changed files with 17 additions and 4 deletions

View File

@@ -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;

View File

@@ -37,8 +37,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 SAVE_JOB_EXECUTION = "INSERT into %PREFIX%JOB_EXECUTION(JOB_EXECUTION_ID, JOB_INSTANCE_ID, START_TIME, "
+ "END_TIME, STATUS, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE, VERSION, CREATE_TIME, LAST_UPDATED) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

View File

@@ -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 DataFieldMaxValueIncrementer stepExecutionIncrementer;

View File

@@ -79,6 +79,19 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean i
private DataFieldMaxValueIncrementerFactory incrementerFactory;
private PlatformTransactionManager transactionManager;
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 isolation level to be used for the transaction when
@@ -191,6 +204,7 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean i
dao.setJobExecutionIncrementer(incrementerFactory.getIncrementer(databaseType, tablePrefix
+ "JOB_EXECUTION_SEQ"));
dao.setTablePrefix(tablePrefix);
dao.setExitMessageLength(exitMessageLength);
dao.afterPropertiesSet();
return dao;
}
@@ -202,6 +216,7 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean i
dao.setStepExecutionIncrementer(incrementerFactory.getIncrementer(databaseType, tablePrefix
+ "STEP_EXECUTION_SEQ"));
dao.setTablePrefix(tablePrefix);
dao.setExitMessageLength(exitMessageLength);
dao.afterPropertiesSet();
return dao;
}