diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/ItemOrientedTasklet.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/ItemOrientedTasklet.java index a9b3738bb..f5e573258 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/ItemOrientedTasklet.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/ItemOrientedTasklet.java @@ -40,7 +40,7 @@ import org.springframework.util.Assert; * A concrete implementation of the {@link Tasklet} interface that provides * 'split processing'. This type of processing is characterized by separating * the reading and processing of batch data into two separate classes: - * ItemProvider and ItemProcessor. The ItemProvider class provides a solid means + * {@link ItemReader} and {@link ItemProcessor}. The {@link ItemReader} class provides a solid means * for re-usability and enforces good architecture practices. Because an object * must be returned by the {@link ItemReader} to continue * processing, (returning null indicates processing should end) a developer is @@ -108,7 +108,7 @@ public class ItemOrientedTasklet implements Tasklet, Skippable, * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ public void afterPropertiesSet() throws Exception { - Assert.notNull(itemProvider, "ItemProvider must be provided"); + Assert.notNull(itemProvider, "ItemReader must be provided"); Assert.notNull(itemProcessor, "ItemProcessor must be provided"); if (itemRecoverer == null && (itemProvider instanceof ItemRecoverer)) { diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/tasklet/ItemOrientedTaskletTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/tasklet/ItemOrientedTaskletTests.java index 8570fe744..089f3199b 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/tasklet/ItemOrientedTaskletTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/tasklet/ItemOrientedTaskletTests.java @@ -282,7 +282,7 @@ public class ItemOrientedTaskletTests extends TestCase { try { module.afterPropertiesSet(); } catch (IllegalArgumentException e) { - assertTrue(e.getMessage().toLowerCase().indexOf("provider") >= 0); + assertTrue(e.getMessage().toLowerCase().indexOf("reader") >= 0); } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemProcessor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemProcessor.java index 231fa66fb..e7b39d28b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemProcessor.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemProcessor.java @@ -1,4 +1,5 @@ package org.springframework.batch.item.processor; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -6,6 +7,7 @@ import java.util.Map; import java.util.Properties; import org.springframework.batch.item.ItemProcessor; +import org.springframework.batch.item.ItemReader; import org.springframework.batch.restart.GenericRestartData; import org.springframework.batch.restart.RestartData; import org.springframework.batch.restart.Restartable; @@ -17,11 +19,11 @@ import org.springframework.batch.statistics.StatisticsProvider; * @author Robert Kasanicky */ public class CompositeItemProcessor implements ItemProcessor, Restartable, StatisticsProvider { - + private static final String SEPARATOR = "#"; private List itemProcessors; - + /** * Calls injected ItemProcessors in order. */ @@ -32,15 +34,16 @@ public class CompositeItemProcessor implements ItemProcessor, Restartable, Stati } /** - * Compound restart data of all injected (Restartable) ItemProcessors, property keys are - * prefixed with list index of the ItemProcessor. + * Compound restart data of all injected (Restartable) ItemProcessors, + * property keys are prefixed with list index of the ItemProcessor. */ public RestartData getRestartData() { Properties props = createCompoundProperties(new PropertiesExtractor() { public Properties extractProperties(Object o) { if (o instanceof Restartable) { - return ((Restartable)o).getRestartData().getProperties(); - } else { + return ((Restartable) o).getRestartData().getProperties(); + } + else { return null; } } @@ -49,24 +52,24 @@ public class CompositeItemProcessor implements ItemProcessor, Restartable, Stati } /** - * @param data contains values of restart data, property keys are expected to be prefixed with - * list index of the ItemProcessor. + * @param data contains values of restart data, property keys are expected + * to be prefixed with list index of the ItemProcessor. */ public void restoreFrom(RestartData data) { if (data == null || data.getProperties() == null) { // do nothing return; } - + List restartDataList = parseProperties(data.getProperties()); - + // iterators would make the loop below less readable - for (int i=0; i < itemProcessors.size(); i++) { + for (int i = 0; i < itemProcessors.size(); i++) { if (itemProcessors.get(i) instanceof Restartable) { ((Restartable) itemProcessors.get(i)).restoreFrom((RestartData) restartDataList.get(i)); } } - + } /** @@ -76,15 +79,16 @@ public class CompositeItemProcessor implements ItemProcessor, Restartable, Stati public Properties getStatistics() { return createCompoundProperties(new PropertiesExtractor() { public Properties extractProperties(Object o) { - if (o instanceof StatisticsProvider){ + if (o instanceof StatisticsProvider) { return ((StatisticsProvider) o).getStatistics(); - } else { + } + else { return null; } } }); } - + public void setItemProcessors(List itemProcessors) { this.itemProcessors = itemProcessors; } @@ -94,26 +98,26 @@ public class CompositeItemProcessor implements ItemProcessor, Restartable, Stati */ private List parseProperties(Properties props) { List restartDataList = new ArrayList(itemProcessors.size()); - for (int i = 0; i