From 7f71dc55cee6ff1ec3df2cc68fa2a294090c9d94 Mon Sep 17 00:00:00 2001 From: dsyer Date: Tue, 18 Dec 2007 18:47:33 +0000 Subject: [PATCH] IN PROGRESS - issue BATCH-212: Merge InputSource with ItemProvider http://opensource.atlassian.com/projects/spring/browse/BATCH-212 Remove unnecessary uses of Delegating ItemReader from samples. --- .../retry/policy/ItemReaderRetryPolicy.java | 12 +- .../jobs/beanWrapperMapperSampleJob.xml | 7 +- .../src/main/resources/jobs/footballJob.xml | 24 +-- .../src/main/resources/jobs/hibernateJob.xml | 8 +- .../src/main/resources/jobs/ibatisJob.xml | 6 +- .../src/main/resources/jobs/parallelJob.xml | 24 +-- .../src/main/resources/jobs/rollbackJob.xml | 6 +- .../src/main/resources/jobs/tradeJob.xml | 15 +- .../src/main/resources/jobs/xmlStaxJob.xml | 147 ++++++++++-------- 9 files changed, 98 insertions(+), 151 deletions(-) diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/ItemReaderRetryPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/ItemReaderRetryPolicy.java index ad3f8cb7c..97489cdab 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/ItemReaderRetryPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/ItemReaderRetryPolicy.java @@ -145,14 +145,14 @@ public class ItemReaderRetryPolicy extends AbstractStatefulRetryPolicy { // The delegate context... private RetryContext delegateContext; - private ItemReader provider; + private ItemReader reader; private ItemRecoverer recoverer; public ItemProviderRetryContext(ItemReaderRetryCallback callback) { super(RetrySynchronizationManager.getContext()); item = callback.next(this); - this.provider = callback.getReader(); + this.reader = callback.getReader(); this.recoverer = callback.getRecoverer(); } @@ -165,8 +165,8 @@ public class ItemReaderRetryPolicy extends AbstractStatefulRetryPolicy { } public RetryContext open(RetryCallback callback) { - if (hasFailed(provider, item)) { - this.delegateContext = retryContextCache.get(provider + if (hasFailed(reader, item)) { + this.delegateContext = retryContextCache.get(reader .getKey(item)); } if (this.delegateContext == null) { @@ -180,7 +180,7 @@ public class ItemReaderRetryPolicy extends AbstractStatefulRetryPolicy { public void registerThrowable(RetryContext context, Throwable throwable) throws TerminatedRetryException { - retryContextCache.put(provider.getKey(item), this.delegateContext); + retryContextCache.put(reader.getKey(item), this.delegateContext); delegate.registerThrowable(this.delegateContext, throwable); } @@ -199,7 +199,7 @@ public class ItemReaderRetryPolicy extends AbstractStatefulRetryPolicy { public Object handleRetryExhausted(RetryContext context) throws Exception { // If there is no going back, then we can remove the history - retryContextCache.remove(provider.getKey(item)); + retryContextCache.remove(reader.getKey(item)); RepeatSynchronizationManager.setCompleteOnly(); if (recoverer != null) { boolean success = recoverer.recover(item, context diff --git a/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml b/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml index 6e6a6a394..91675fa37 100644 --- a/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml @@ -36,12 +36,7 @@ - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/footballJob.xml b/spring-batch-samples/src/main/resources/jobs/footballJob.xml index 52cd1760b..d0a0df3e3 100644 --- a/spring-batch-samples/src/main/resources/jobs/footballJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/footballJob.xml @@ -27,13 +27,7 @@ - - - - - + @@ -57,13 +51,7 @@ - - - - - + @@ -87,13 +75,7 @@ - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml b/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml index 75bfe6aed..f2c9b14a4 100644 --- a/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml @@ -21,13 +21,7 @@ - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/ibatisJob.xml b/spring-batch-samples/src/main/resources/jobs/ibatisJob.xml index 3ebe54dad..11ddb5f75 100644 --- a/spring-batch-samples/src/main/resources/jobs/ibatisJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/ibatisJob.xml @@ -20,11 +20,7 @@ - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml index 9a9060066..a45b46fde 100644 --- a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml @@ -22,13 +22,7 @@ - - - - - + - - - - - + @@ -140,13 +128,7 @@ - - - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml index 25166fb50..22ac14d3d 100644 --- a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml @@ -65,11 +65,7 @@ - - - + diff --git a/spring-batch-samples/src/main/resources/jobs/tradeJob.xml b/spring-batch-samples/src/main/resources/jobs/tradeJob.xml index 2b85ae36c..5cab4d3a6 100644 --- a/spring-batch-samples/src/main/resources/jobs/tradeJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/tradeJob.xml @@ -41,13 +41,7 @@ - - - - - + - - - - - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +