diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/MapStepDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/MapStepDao.java index caffaf5d5..323e4b4c2 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/MapStepDao.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/MapStepDao.java @@ -98,10 +98,6 @@ public class MapStepDao implements StepDao { stepExecution.setId(new Long(currentId++)); executions.add(stepExecution); } - - public void saveRestartData(Long stepId, StreamContext streamContext) { - restartsById.put(stepId, streamContext); - } public List findStepExecutions(StepInstance step) { Set executions = (Set) executionsById.get(step.getId()); diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java index a7b3c9023..aff02df96 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java @@ -185,9 +185,9 @@ public class SimpleStepExecutor { // the conversation in StepScope stepContext.setAttribute(StepScope.ID_KEY, stepExecution.getJobExecution().getId()); - final boolean saveRestartData = step.isSaveStreamContext(); + final boolean saveStreamContext = step.isSaveStreamContext(); - if (saveRestartData && isRestart) { + if (saveStreamContext && isRestart) { stepContext.setInitialStreamContext(stepInstance.getStreamContext()); } @@ -233,7 +233,7 @@ public class SimpleStepExecutor { // only if chunk was successful stepExecution.apply(contribution); - if (saveRestartData) { + if (saveStreamContext) { stepInstance.setStreamContext(stepContext.getStreamContext()); jobRepository.update(stepInstance); } diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/MockStepDao.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/MockStepDao.java index 3d5f50c2b..fe534129f 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/MockStepDao.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/MockStepDao.java @@ -22,7 +22,6 @@ import org.springframework.batch.core.domain.JobInstance; import org.springframework.batch.core.domain.StepExecution; import org.springframework.batch.core.domain.StepInstance; import org.springframework.batch.execution.repository.dao.StepDao; -import org.springframework.batch.item.StreamContext; public class MockStepDao implements StepDao { @@ -46,10 +45,6 @@ public class MockStepDao implements StepDao { return newSteps; } - public StreamContext getRestartData(Long stepId) { - return null; - } - public int getStepExecutionCount(StepInstance step) { return 1; } @@ -57,9 +52,6 @@ public class MockStepDao implements StepDao { public void save(StepExecution stepExecution) { } - public void saveRestartData(Long stepId, StreamContext streamContext) { - } - public void update(StepInstance step) { } diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java index 42c2c89bc..555542822 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java @@ -396,7 +396,7 @@ public class SimpleJobRepositoryTests extends TestCase { * Test to ensure that if a StepDao returns invalid * restart data, it is corrected. */ - public void testCreateStepsFixesInvalidRestartData() throws Exception{ + public void testCreateStepsFixesInvalidStreamContext() throws Exception{ List jobs = new ArrayList(); @@ -432,7 +432,7 @@ public class SimpleJobRepositoryTests extends TestCase { assertTrue(step.getStreamContext().getProperties().isEmpty()); } - public void testFindStepsFixesInvalidRestartData() throws Exception{ + public void testFindStepsFixesInvalidStreamContext() throws Exception{ List jobs = new ArrayList(); jobDao.findJobInstances(jobConfiguration.getName(), jobParameters); jobs.add(databaseJob); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java index 5ceb44ed7..ea7a9b3bf 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java @@ -139,7 +139,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour assertEquals(step3, tempStep); } - public void testUpdateStepWithoutRestartData(){ + public void testUpdateStepWithoutStreamContext(){ step1.setStatus(BatchStatus.COMPLETED); stepDao.update(step1); @@ -147,7 +147,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour assertEquals(tempStep, step1); } - public void testUpdateStepWithRestartData(){ + public void testUpdateStepWithStreamContext(){ step1.setStatus(BatchStatus.COMPLETED); Properties data = new Properties(); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/MapStepDaoTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/MapStepDaoTests.java index 276e8cc09..369e8b17e 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/MapStepDaoTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/MapStepDaoTests.java @@ -106,7 +106,7 @@ public class MapStepDaoTests extends TestCase { assertEquals(2, dao.getStepExecutionCount(step)); } - public void testSaveRestartData() throws Exception { + public void testSaveStreamContext() throws Exception { assertEquals(null, dao.getStreamContext(step.getId())); step.setStatus(BatchStatus.COMPLETED); Properties data = new Properties(); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepConfigurationTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepConfigurationTests.java index a896f3921..b3226e691 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepConfigurationTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepConfigurationTests.java @@ -101,7 +101,7 @@ public class SimpleStepConfigurationTests extends TestCase { * Test method for * {@link org.springframework.batch.execution.step.simple.AbstractStep#isSaveStreamContext()}. */ - public void testIsSaveRestartData() { + public void testIsSaveStreamContext() { assertEquals(false, configuration.isSaveStreamContext()); configuration.setSaveStreamContext(true); assertEquals(true, configuration.isSaveStreamContext()); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorTests.java index 6a4b3cf2b..f02f8cac0 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorTests.java @@ -277,7 +277,7 @@ public class SimpleStepExecutorTests extends TestCase { /* * make sure a job that has never been executed before, but does have - * saveRestartData = true, doesn't have restoreFrom called on it. + * saveStreamContext = true, doesn't have restoreFrom called on it. */ public void testNonRestartedJob() throws Exception { StepInstance step = new StepInstance(new Long(1)); @@ -290,7 +290,7 @@ public class SimpleStepExecutorTests extends TestCase { stepExecutor.execute(stepExecution); assertFalse(tasklet.isRestoreFromCalled()); - assertTrue(tasklet.isGetRestartDataCalled()); + assertTrue(tasklet.isGetStreamContextCalled()); } /* @@ -312,14 +312,14 @@ public class SimpleStepExecutorTests extends TestCase { assertTrue(tasklet.isRestoreFromCalled()); assertTrue(tasklet.isRestoreFromCalledWithSomeContext()); - assertTrue(tasklet.isGetRestartDataCalled()); + assertTrue(tasklet.isGetStreamContextCalled()); } /* - * Test that a job that is being restarted, but has saveRestartData set to - * false, doesn't have restore or getRestartData called on it. + * Test that a job that is being restarted, but has saveStreamContext set to + * false, doesn't have restore or getStreamContext called on it. */ - public void testNoSaveRestartDataRestartableJob() { + public void testNoSaveStreamContextRestartableJob() { StepInstance step = new StepInstance(new Long(1)); step.setStepExecutionCount(1); MockRestartableTasklet tasklet = new MockRestartableTasklet(); @@ -336,11 +336,11 @@ public class SimpleStepExecutorTests extends TestCase { } assertFalse(tasklet.isRestoreFromCalled()); - assertFalse(tasklet.isGetRestartDataCalled()); + assertFalse(tasklet.isGetStreamContextCalled()); } /* - * Even though the job is restarted, and saveRestartData is true, nothing + * Even though the job is restarted, and saveStreamContext is true, nothing * will be restored because the Tasklet does not implement Restartable. */ public void testRestartJobOnNonRestartableTasklet() throws Exception { @@ -430,7 +430,7 @@ public class SimpleStepExecutorTests extends TestCase { private class MockRestartableTasklet implements Tasklet, ItemStream { - private boolean getRestartDataCalled = false; + private boolean getStreamContextCalled = false; private boolean restoreFromCalled = false; @@ -446,7 +446,7 @@ public class SimpleStepExecutorTests extends TestCase { } public StreamContext getStreamContext() { - getRestartDataCalled = true; + getStreamContextCalled = true; return new GenericStreamContext(PropertiesConverter.stringToProperties("spam=bucket")); } @@ -455,8 +455,8 @@ public class SimpleStepExecutorTests extends TestCase { restoreFromCalledWithSomeContext = data.getProperties().size() > 0; } - public boolean isGetRestartDataCalled() { - return getRestartDataCalled; + public boolean isGetStreamContextCalled() { + return getStreamContextCalled; } public boolean isRestoreFromCalled() { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/HibernateCursorItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/HibernateCursorItemReader.java index ec0fd1a61..2a3deefc8 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/HibernateCursorItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/HibernateCursorItemReader.java @@ -184,7 +184,7 @@ public class HibernateCursorItemReader extends AbstractItemReader implements Ite } /** - * @return the current row number wrapped as RestartData + * @return the current row number wrapped as StreamContext */ public StreamContext getStreamContext() { Properties props = new Properties(); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/JdbcCursorItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/JdbcCursorItemReader.java index 3ff704665..fa6d456e1 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/JdbcCursorItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/JdbcCursorItemReader.java @@ -394,7 +394,7 @@ public class JdbcCursorItemReader extends AbstractTransactionalIoSource implemen /* * (non-Javadoc) * - * @see org.springframework.batch.restart.Restartable#getRestartData() + * @see org.springframework.batch.restart.Restartable#getStreamContext() */ public StreamContext getStreamContext() { String skipped = skippedRows.toString(); @@ -405,10 +405,9 @@ public class JdbcCursorItemReader extends AbstractTransactionalIoSource implemen return context; } - /* - * (non-Javadoc) - * - * @see org.springframework.batch.restart.Restartable#restoreFrom(org.springframework.batch.restart.RestartData) + + /* (non-Javadoc) + * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.StreamContext) */ public void restoreFrom(StreamContext data) { Assert.state(!initialized); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/DrivingQueryItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/DrivingQueryItemReader.java index 72ed88c66..93dad32ec 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/DrivingQueryItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/DrivingQueryItemReader.java @@ -161,7 +161,7 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource * been initialized before calling restore (meaning, read has been called) * then an IllegalStateException will be thrown, since all input sources * should be restored before being read from, otherwise already processed - * data could be returned. The RestartData attempting to be restored from + * data could be returned. The {@link StreamContext} attempting to be restored from * must have been obtained from the same input source as the one * being restored from otherwise it is invalid. * @@ -172,9 +172,9 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource */ public final void restoreFrom(StreamContext data) { - Assert.notNull(data, "RestartData must not be null."); + Assert.notNull(data, "StreamContext must not be null."); Assert.notNull(data.getProperties(), - "RestartData properties must not be null."); + "StreamContext properties must not be null."); Assert.state(!initialized, "Cannot restore when already intialized. Call" + " close() first before restore()"); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/KeyGenerator.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/KeyGenerator.java index 3c35c66bb..3626ba6c8 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/KeyGenerator.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/KeyGenerator.java @@ -20,9 +20,9 @@ public interface KeyGenerator { /** * Restore the keys list based on provided restart data. * - * @param restartData, the restart data to restore the keys list from. + * @param streamContext, the restart data to restore the keys list from. * @return a list of keys. - * @throws IllegalArgumentException is restartData is null. + * @throws IllegalArgumentException is streamContext is null. */ List restoreKeys(StreamContext streamContext); @@ -30,7 +30,7 @@ public interface KeyGenerator { * Return the provided key as restart data. * * @param key to be converted to restart data. - * @return RestartData representation of the key. + * @return StreamContext representation of the key. * @throws IllegalArgumentException if key is null. * @throws IllegalArgumentException if key is an incompatible type. */ diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapStreamContextRowMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapStreamContextRowMapper.java index 40a398331..c899bb911 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapStreamContextRowMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapStreamContextRowMapper.java @@ -33,15 +33,15 @@ import org.springframework.util.ClassUtils; * * @author Lucas Ward * @author Dave Syer - * @see RestartDataRowMapper + * @see StreamContextRowMapper */ -public class ColumnMapStreamContextRowMapper extends ColumnMapRowMapper implements RestartDataRowMapper{ +public class ColumnMapStreamContextRowMapper extends ColumnMapRowMapper implements StreamContextRowMapper{ public static final String KEY_PREFIX = ClassUtils.getQualifiedName(ColumnMapStreamContextRowMapper.class) + ".KEY."; public PreparedStatementSetter createSetter(StreamContext streamContext) { - ColumnMapRestartData columnData = new ColumnMapRestartData(streamContext.getProperties()); + ColumnMapStreamContext columnData = new ColumnMapStreamContext(streamContext.getProperties()); List columns = new ArrayList(); for (Iterator iterator = columnData.keys.entrySet().iterator(); iterator.hasNext();) { @@ -56,19 +56,19 @@ public class ColumnMapStreamContextRowMapper extends ColumnMapRowMapper implemen public StreamContext createStreamContext(Object key) { Assert.isInstanceOf(Map.class, key, "Input to create StreamContext must be of type Map."); Map keys = (Map)key; - return new ColumnMapRestartData(keys); + return new ColumnMapStreamContext(keys); } - private static class ColumnMapRestartData extends GenericStreamContext { + private static class ColumnMapStreamContext extends GenericStreamContext { private final Map keys; - public ColumnMapRestartData(Map keys) { + public ColumnMapStreamContext(Map keys) { this.keys = keys; } - public ColumnMapRestartData(Properties props) { + public ColumnMapStreamContext(Properties props) { keys = CollectionFactory.createLinkedCaseInsensitiveMapIfPossible(props.size()); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/MultipleColumnJdbcKeyGenerator.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/MultipleColumnJdbcKeyGenerator.java index a271fb5a8..fa9bcad53 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/MultipleColumnJdbcKeyGenerator.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/MultipleColumnJdbcKeyGenerator.java @@ -28,7 +28,7 @@ import org.springframework.util.StringUtils; /** *

Jdbc implementation of the {@link KeyGenerator} interface that works for composite keys. * (i.e. keys represented by multiple columns) A sql query to be used to return the keys and - * a {@link RestartDataRowMapper} to map each row in the resultset to an Object must be set in + * a {@link StreamContextRowMapper} to map each row in the resultset to an Object must be set in * order to work correctly. *

* @@ -43,7 +43,7 @@ public class MultipleColumnJdbcKeyGenerator implements private JdbcTemplate jdbcTemplate; - private RestartDataRowMapper keyMapper = new ColumnMapStreamContextRowMapper(); + private StreamContextRowMapper keyMapper = new ColumnMapStreamContextRowMapper(); private String sql; @@ -78,7 +78,7 @@ public class MultipleColumnJdbcKeyGenerator implements } /* (non-Javadoc) - * @see org.springframework.batch.io.sql.scratch.AbstractDrivingQueryItemReader#restoreKeys(org.springframework.batch.restart.RestartData) + * @see org.springframework.batch.io.driving.KeyGenerator#restoreKeys(org.springframework.batch.item.StreamContext) */ public List restoreKeys(StreamContext streamContext) { @@ -94,10 +94,10 @@ public class MultipleColumnJdbcKeyGenerator implements } /* (non-Javadoc) - * @see org.springframework.batch.restart.Restartable#getRestartData() + * @see org.springframework.batch.io.driving.KeyGenerator#getKeyAsStreamContext(java.lang.Object) */ public StreamContext getKeyAsStreamContext(Object key) { - Assert.state(keyMapper != null, "RestartDataConverter must not be null."); + Assert.state(keyMapper != null, "Kye mapper must not be null."); return keyMapper.createStreamContext(key); } @@ -121,12 +121,12 @@ public class MultipleColumnJdbcKeyGenerator implements } /** - * Set the {@link RestartDataRowMapper} to be used to map a resultset + * Set the {@link StreamContextRowMapper} to be used to map a resultset * to keys. * * @param keyMapper */ - public void setKeyMapper(RestartDataRowMapper keyMapper) { + public void setKeyMapper(StreamContextRowMapper keyMapper) { this.keyMapper = keyMapper; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/SingleColumnJdbcKeyGenerator.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/SingleColumnJdbcKeyGenerator.java index dd25d15ee..a21acf19b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/SingleColumnJdbcKeyGenerator.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/SingleColumnJdbcKeyGenerator.java @@ -30,21 +30,26 @@ import org.springframework.util.Assert; import org.springframework.util.StringUtils; /** - *

Jdbc {@link KeyGenerator} implementation that only works for a single column key. A sql - * query must be passed in which will be used to return a list of keys. Each key will be mapped - * by a {@link RowMapper} that returns a mapped key. By default, the {@link SingleColumnRowMapper} - * is used, and will convert keys into well known types at runtime. It is extremely important to - * note that only one column should be mapped to an object and returned as a key. If multiple - * columns are returned as a key in this strategy, then restart will not function properly. Instead - * a strategy that supports keys comprised of multiple columns should be used. - * - *

Restartability: Because the key is only one column, restart is made much more simple. Before - * each commit, the last processed key is returned to be stored as restart data. Upon restart, that - * same key is given back to restore from, using a separate 'RestartQuery'. This means that only the - * keys remaining to be processed are returned, rather than returning the original list of keys and - * iterating forward to that last committed point. + *

+ * Jdbc {@link KeyGenerator} implementation that only works for a single column + * key. A sql query must be passed in which will be used to return a list of + * keys. Each key will be mapped by a {@link RowMapper} that returns a mapped + * key. By default, the {@link SingleColumnRowMapper} is used, and will convert + * keys into well known types at runtime. It is extremely important to note that + * only one column should be mapped to an object and returned as a key. If + * multiple columns are returned as a key in this strategy, then restart will + * not function properly. Instead a strategy that supports keys comprised of + * multiple columns should be used. + * + *

+ * Restartability: Because the key is only one column, restart is made much more + * simple. Before each commit, the last processed key is returned to be stored + * as restart data. Upon restart, that same key is given back to restore from, + * using a separate 'RestartQuery'. This means that only the keys remaining to + * be processed are returned, rather than returning the original list of keys + * and iterating forward to that last committed point. *

- * + * * @author Lucas Ward * @since 1.0 */ @@ -63,10 +68,10 @@ public class SingleColumnJdbcKeyGenerator implements KeyGenerator { public SingleColumnJdbcKeyGenerator() { super(); } - + /** - * Constructs a new instance using the provided jdbcTemplate and string representing - * the sql statement that should be used to retrieve keys. + * Constructs a new instance using the provided jdbcTemplate and string + * representing the sql statement that should be used to retrieve keys. * * @param jdbcTemplate * @param sql @@ -81,7 +86,8 @@ public class SingleColumnJdbcKeyGenerator implements KeyGenerator { this.sql = sql; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see org.springframework.batch.io.driving.KeyGenerationStrategy#retrieveKeys() */ public List retrieveKeys() { @@ -90,27 +96,28 @@ public class SingleColumnJdbcKeyGenerator implements KeyGenerator { /** * Get the restart data representing the last processed key. - * - * @see KeyGenerator#getKeyAsRestartData() + * + * @see KeyGenerator#getKeyAsStreamContext(Object) * @throws IllegalArgumentException if key is null. */ public StreamContext getKeyAsStreamContext(Object key) { - + Assert.notNull(key, "The key must not be null."); - + Properties props = new Properties(); props.setProperty(RESTART_KEY, key.toString()); return new GenericStreamContext(props); } /** - * Return the remaining to be processed for the provided {@link StreamContext}. - * The RestartData attempting to be restored from must have been obtained from the - * same KeyGenerationStrategy as the one - * being restored from otherwise it is invalid. - * - * @param StreamContext obtained by calling getRestartData during a previous - * run. + * Return the remaining to be processed for the provided + * {@link StreamContext}. The {@link StreamContext} attempting to be + * restored from must have been obtained from the same + * KeyGenerationStrategy as the one being restored from otherwise + * it is invalid. + * + * @param StreamContext obtained by calling + * {@link #getKeyAsStreamContext(Object)} during a previous run. * @throws IllegalStateException if restart sql statement is null. * @throws IllegalArgumentException if restart data is null. * @see KeyGenerator#restoreKeys(org.springframework.batch.item.StreamContext) @@ -118,8 +125,8 @@ public class SingleColumnJdbcKeyGenerator implements KeyGenerator { public List restoreKeys(StreamContext streamContext) { Assert.notNull(streamContext, "The restart data must not be null."); - Assert.state(StringUtils.hasText(restartSql), "The RestartQuery must not be null or empty" + - " in order to restart."); + Assert.state(StringUtils.hasText(restartSql), "The RestartQuery must not be null or empty" + + " in order to restart."); String lastProcessedKey = streamContext.getProperties().getProperty(RESTART_KEY); @@ -130,18 +137,18 @@ public class SingleColumnJdbcKeyGenerator implements KeyGenerator { return new ArrayList(); } - - /* (non-Javadoc) + /* + * (non-Javadoc) * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ public void afterPropertiesSet() throws Exception { Assert.notNull(jdbcTemplate, "JdbcTemplate must not be null."); Assert.hasText(sql, "The DrivingQuery must not be null or empty."); } - + /** * Set the {@link RowMapper} to be used to map each key to an object. - * + * * @param keyMapper */ public void setKeyMapper(RowMapper keyMapper) { @@ -149,14 +156,15 @@ public class SingleColumnJdbcKeyGenerator implements KeyGenerator { } /** - * Set the SQL query to be used to return the remaining keys to be processed. - * + * Set the SQL query to be used to return the remaining keys to be + * processed. + * * @param restartSql */ public void setRestartSql(String restartSql) { this.restartSql = restartSql; } - + /** * Set the SQL statement to be used to return the keys to be processed. * diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/RestartDataRowMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/StreamContextRowMapper.java similarity index 94% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/RestartDataRowMapper.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/StreamContextRowMapper.java index 091e7b997..0f162a306 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/RestartDataRowMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/StreamContextRowMapper.java @@ -31,7 +31,7 @@ import org.springframework.jdbc.core.RowMapper; * @see RowMapper * @since 1.0 */ -public interface RestartDataRowMapper extends RowMapper { +public interface StreamContextRowMapper extends RowMapper { /** * Given the provided composite key, return a RestartData representation. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java index 2813709f6..531b9cd13 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java @@ -74,7 +74,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen * file and position the buffer reader according to information provided by * the restart data * - * @param restartData restartData information + * @param data {@link StreamContext} information */ public void restoreFrom(StreamContext data) {