diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/DelegatingItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/DelegatingItemReader.java index de8091a5b..b8cb0b7e4 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/DelegatingItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/DelegatingItemReader.java @@ -17,11 +17,8 @@ package org.springframework.batch.item.reader; import org.springframework.batch.io.Skippable; -import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemReader; -import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.KeyedItemReader; -import org.springframework.batch.item.exception.StreamException; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; @@ -32,7 +29,7 @@ import org.springframework.util.Assert; * * @author Dave Syer */ -public class DelegatingItemReader extends AbstractItemReader implements Skippable, InitializingBean, ItemStream, KeyedItemReader { +public class DelegatingItemReader extends AbstractItemReader implements Skippable, InitializingBean, KeyedItemReader { private ItemReader itemReader; @@ -49,17 +46,6 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl return itemReader.read(); } - /** - * @see ItemStream#update(ExecutionContext) - * @throws IllegalStateException if the parent template is not itself - * {@link ItemStream}. - */ - public void update(ExecutionContext executionContext) { - if (itemReader instanceof ItemStream) { - ((ItemStream) itemReader).update(executionContext); - } - } - /** * Setter for input source. * @param source @@ -81,26 +67,6 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl } } - /* - * (non-Javadoc) - * @see org.springframework.batch.item.ItemStream#open() - */ - public void open(ExecutionContext executionContext) throws StreamException { - if (itemReader instanceof ItemStream) { - ((ItemStream) itemReader).open(executionContext); - } - } - - /* - * (non-Javadoc) - * @see org.springframework.batch.item.ItemStream#open() - */ - public void close(ExecutionContext executionContext) throws StreamException { - if (itemReader instanceof ItemStream) { - ((ItemStream) itemReader).close(null); - } - } - /* * (non-Javadoc) * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionContext) diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/reader/DelegatingItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/reader/DelegatingItemReaderTests.java index 81e2afa7d..5361c5783 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/reader/DelegatingItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/reader/DelegatingItemReaderTests.java @@ -16,15 +16,12 @@ package org.springframework.batch.item.reader; -import java.util.Properties; - import junit.framework.TestCase; import org.springframework.batch.io.Skippable; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemStream; -import org.springframework.batch.support.PropertiesConverter; /** * Unit test for {@link DelegatingItemReader} @@ -72,14 +69,6 @@ public class DelegatingItemReaderTests extends TestCase { assertSame("domain object is provided by the input template", this, result); } - /** - * Gets restart data from the input template - */ - public void testGetStreamContext() { - itemProvider.update(executionContext); - assertEquals("foo", executionContext.getString("value")); - } - public void testSkip() throws Exception { itemProvider.skip(); assertEquals("after skip", itemProvider.read()); @@ -89,10 +78,6 @@ public class DelegatingItemReaderTests extends TestCase { private Object value; - public Properties getStatistics() { - return PropertiesConverter.stringToProperties("a=b"); - } - public void update(ExecutionContext executionContext) { executionContext.putString("value", "foo"); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AbstractTradeBatchTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AbstractTradeBatchTests.java index dc16b5c42..1b848a62b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AbstractTradeBatchTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AbstractTradeBatchTests.java @@ -22,7 +22,6 @@ import org.springframework.batch.io.file.FlatFileItemReader; import org.springframework.batch.io.file.mapping.FieldSet; import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.item.ExecutionContext; -import org.springframework.batch.item.reader.DelegatingItemReader; import org.springframework.batch.item.writer.AbstractItemWriter; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -49,20 +48,15 @@ public abstract class AbstractTradeBatchTests extends TestCase { provider.open(new ExecutionContext()); } - protected static class TradeItemReader extends DelegatingItemReader { + protected static class TradeItemReader extends FlatFileItemReader { protected TradeItemReader(Resource resource) throws Exception { super(); - FlatFileItemReader inputSource = new FlatFileItemReader(); - inputSource.setResource(resource); - inputSource.setFieldSetMapper(new TradeMapper()); - inputSource.afterPropertiesSet(); - setItemReader(inputSource); + setResource(resource); + setFieldSetMapper(new TradeMapper()); + afterPropertiesSet(); } - public synchronized Object read() throws Exception { - return super.read(); - } } protected static class TradeMapper implements FieldSetMapper{ diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/GeneratingItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/GeneratingItemReader.java index 9925bdece..58f982e4f 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/GeneratingItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/GeneratingItemReader.java @@ -3,10 +3,8 @@ package org.springframework.batch.sample.item.reader; import java.math.BigDecimal; import org.springframework.batch.item.ExecutionContext; -import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.exception.MarkFailedException; import org.springframework.batch.item.exception.ResetFailedException; -import org.springframework.batch.item.exception.StreamException; import org.springframework.batch.item.reader.AbstractItemReaderRecoverer; import org.springframework.batch.sample.domain.Trade; @@ -15,7 +13,7 @@ import org.springframework.batch.sample.domain.Trade; * * @author Robert Kasanicky */ -public class GeneratingItemReader extends AbstractItemReaderRecoverer implements ItemStream { +public class GeneratingItemReader extends AbstractItemReaderRecoverer { private int limit = 1; @@ -58,14 +56,6 @@ public class GeneratingItemReader extends AbstractItemReaderRecoverer implements return false; } - /* (non-Javadoc) - * @see org.springframework.batch.item.ItemStream#close() - */ - public void close(ExecutionContext executionContext) throws StreamException { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#mark() */ @@ -86,13 +76,4 @@ public class GeneratingItemReader extends AbstractItemReaderRecoverer implements public void restoreFrom(ExecutionContext context) { } - /* (non-Javadoc) - * @see org.springframework.batch.item.ExecutionContextProvider#getExecutionContext() - */ - public void update(ExecutionContext executionContext) { - } - - public void open(ExecutionContext context) throws StreamException { - } - } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/writer/TradeWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/writer/TradeWriter.java index de8883f66..cc7334f3a 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/writer/TradeWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/writer/TradeWriter.java @@ -64,10 +64,4 @@ public class TradeWriter extends AbstractItemWriter { public void setDao(TradeDao dao) { this.dao = dao; } - - public void close() { - } - - public void init() { - } } diff --git a/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml b/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml index e88cc8a55..69c7ef75c 100644 --- a/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml @@ -15,6 +15,7 @@ + diff --git a/spring-batch-samples/src/main/resources/jobs/compositeProcessorSampleJob.xml b/spring-batch-samples/src/main/resources/jobs/compositeProcessorSampleJob.xml index f7686be90..a057938c2 100644 --- a/spring-batch-samples/src/main/resources/jobs/compositeProcessorSampleJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/compositeProcessorSampleJob.xml @@ -1,58 +1,68 @@ - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -62,33 +72,39 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-samples/src/main/resources/jobs/fixedLengthImportJob.xml b/spring-batch-samples/src/main/resources/jobs/fixedLengthImportJob.xml index 628971361..79c5ce50d 100644 --- a/spring-batch-samples/src/main/resources/jobs/fixedLengthImportJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/fixedLengthImportJob.xml @@ -14,6 +14,7 @@ + diff --git a/spring-batch-samples/src/main/resources/jobs/multilineJob.xml b/spring-batch-samples/src/main/resources/jobs/multilineJob.xml index 79e8def6d..59d74c699 100644 --- a/spring-batch-samples/src/main/resources/jobs/multilineJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/multilineJob.xml @@ -11,7 +11,8 @@ - + + diff --git a/spring-batch-samples/src/main/resources/jobs/multilineOrderJob.xml b/spring-batch-samples/src/main/resources/jobs/multilineOrderJob.xml index ccc1e8a8d..f38b58aac 100644 --- a/spring-batch-samples/src/main/resources/jobs/multilineOrderJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/multilineOrderJob.xml @@ -1,13 +1,14 @@ - - + - + @@ -15,48 +16,74 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 AND ? <= 9999999999 : 'Incorrect order ID' : 'error.order.id' } { orderDate : isFutureDate(?) = FALSE : 'Future date is not allowed' : 'error.order.date.future' } @@ -106,38 +133,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml index 11a92e44c..8aff10c02 100644 --- a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml @@ -18,6 +18,7 @@ + diff --git a/spring-batch-samples/src/main/resources/jobs/restartSample.xml b/spring-batch-samples/src/main/resources/jobs/restartSample.xml index e5e573737..b5b16a902 100644 --- a/spring-batch-samples/src/main/resources/jobs/restartSample.xml +++ b/spring-batch-samples/src/main/resources/jobs/restartSample.xml @@ -14,6 +14,7 @@ + diff --git a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml index 1ebf1fdc9..00c4da0e8 100644 --- a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml @@ -25,6 +25,7 @@ + diff --git a/spring-batch-samples/src/main/resources/jobs/tradeJob.xml b/spring-batch-samples/src/main/resources/jobs/tradeJob.xml index 36c9fa5d5..44b008dee 100644 --- a/spring-batch-samples/src/main/resources/jobs/tradeJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/tradeJob.xml @@ -1,87 +1,91 @@ - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file