diff --git a/spring-batch-core/pom.xml b/spring-batch-core/pom.xml index 8404febcb..ea60268cd 100644 --- a/spring-batch-core/pom.xml +++ b/spring-batch-core/pom.xml @@ -21,6 +21,9 @@ clover + + false + diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java index 8c869f37a..157c981d9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java @@ -121,7 +121,7 @@ public class StepSupport implements Step, BeanNameAware { this.allowStartIfComplete = allowStartIfComplete; } - public void setSaveStreamContext(boolean saveStreamContext) { + public void setSaveExecutionAttributes(boolean saveStreamContext) { this.saveStreamContext = saveStreamContext; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java index aab413690..e91ca2434 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java @@ -65,7 +65,7 @@ public class StepSupportTests extends TestCase { public void testSaveRestartFlag() throws Exception { assertEquals(false, configuration.isSaveStreamContext()); - configuration.setSaveStreamContext(true); + configuration.setSaveExecutionAttributes(true); assertEquals(true, configuration.isSaveStreamContext()); } diff --git a/spring-batch-execution/pom.xml b/spring-batch-execution/pom.xml index f3eb45848..632a37af0 100644 --- a/spring-batch-execution/pom.xml +++ b/spring-batch-execution/pom.xml @@ -21,6 +21,9 @@ clover + + false + diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/scope/SimpleStepContext.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/scope/SimpleStepContext.java index 2b940f8cd..7b58bfe8a 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/scope/SimpleStepContext.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/scope/SimpleStepContext.java @@ -192,12 +192,11 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements return stepExecution; } - /* - * (non-Javadoc) - * @see org.springframework.batch.item.ItemStream#getStreamContext() + /* (non-Javadoc) + * @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes() */ - public ExecutionAttributes getStreamContext() { - return streamManager.getStreamContext(this); + public ExecutionAttributes getExecutionAttributes() { + return streamManager.getExecutionAttributes(this); } /* (non-Javadoc) diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/scope/StepContext.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/scope/StepContext.java index 2b2044d99..721b84fca 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/scope/StepContext.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/scope/StepContext.java @@ -18,7 +18,7 @@ package org.springframework.batch.execution.scope; import org.springframework.batch.core.domain.StepExecution; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ExecutionAttributes; -import org.springframework.batch.item.StreamContextProvider; +import org.springframework.batch.item.ExecutionAttributesProvider; import org.springframework.core.AttributeAccessor; /** @@ -27,7 +27,7 @@ import org.springframework.core.AttributeAccessor; * @author Dave Syer * */ -public interface StepContext extends AttributeAccessor, StreamContextProvider { +public interface StepContext extends AttributeAccessor, ExecutionAttributesProvider { /** * Accessor for the {@link StepExecution} associated with the currently 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 b83b55abc..4443dc849 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 @@ -206,7 +206,7 @@ public class SimpleStepExecutor { // TODO: check that stepExecution can // aggregate these contributions if they // come in asynchronously. - ExecutionAttributes statistics = stepContext.getStreamContext(); + ExecutionAttributes statistics = stepContext.getExecutionAttributes(); contribution.setStreamContext(statistics); contribution.incrementCommitCount(); @@ -220,7 +220,7 @@ public class SimpleStepExecutor { stepExecution.apply(contribution); if (saveStreamContext) { - stepInstance.setStreamContext(stepContext.getStreamContext()); + stepInstance.setStreamContext(stepContext.getExecutionAttributes()); jobRepository.update(stepInstance); } jobRepository.saveOrUpdate(stepExecution); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/scope/SimpleStepContextTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/scope/SimpleStepContextTests.java index eb6dd67f4..57d4eaa43 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/scope/SimpleStepContextTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/scope/SimpleStepContextTests.java @@ -136,8 +136,8 @@ public class SimpleStepContextTests extends TestCase { public void testStreamContextWithNotNullService() throws Exception { Map map = new HashMap(); context = new SimpleStepContext(null, null, new StubStreamManager(map)); - assertEquals(1, context.getStreamContext().getProperties().size()); - assertEquals("bar", context.getStreamContext().getProperties().getProperty("foo")); + assertEquals(1, context.getExecutionAttributes().getProperties().size()); + assertEquals("bar", context.getExecutionAttributes().getProperties().getProperty("foo")); } public void testStreamManagerRegistration() throws Exception { @@ -164,7 +164,7 @@ public class SimpleStepContextTests extends TestCase { public void close(Object key) { } - public ExecutionAttributes getStreamContext(Object key) { + public ExecutionAttributes getExecutionAttributes(Object key) { return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")); } 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 b3226e691..09a6d7369 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 @@ -103,7 +103,7 @@ public class SimpleStepConfigurationTests extends TestCase { */ public void testIsSaveStreamContext() { assertEquals(false, configuration.isSaveStreamContext()); - configuration.setSaveStreamContext(true); + configuration.setSaveExecutionAttributes(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 2b1bd26fc..f59201cfa 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 @@ -290,7 +290,7 @@ public class SimpleStepExecutorTests extends TestCase { StepInstance step = new StepInstance(new Long(1)); MockRestartableTasklet tasklet = new MockRestartableTasklet(); stepExecutor.setTasklet(tasklet); - stepConfiguration.setSaveStreamContext(true); + stepConfiguration.setSaveExecutionAttributes(true); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step, jobExecutionContext); @@ -309,7 +309,7 @@ public class SimpleStepExecutorTests extends TestCase { step.setStepExecutionCount(1); MockRestartableTasklet tasklet = new MockRestartableTasklet(); stepExecutor.setTasklet(tasklet); - stepConfiguration.setSaveStreamContext(true); + stepConfiguration.setSaveExecutionAttributes(true); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step, jobExecutionContext); @@ -332,7 +332,7 @@ public class SimpleStepExecutorTests extends TestCase { step.setStepExecutionCount(1); MockRestartableTasklet tasklet = new MockRestartableTasklet(); stepConfiguration.setTasklet(tasklet); - stepConfiguration.setSaveStreamContext(false); + stepConfiguration.setSaveExecutionAttributes(false); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step, jobExecutionContext); @@ -359,7 +359,7 @@ public class SimpleStepExecutorTests extends TestCase { return ExitStatus.FINISHED; } }); - stepConfiguration.setSaveStreamContext(true); + stepConfiguration.setSaveExecutionAttributes(true); JobExecution jobExecution = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step, jobExecution); @@ -413,7 +413,7 @@ public class SimpleStepExecutorTests extends TestCase { return ExitStatus.FINISHED; } }); - stepConfiguration.setSaveStreamContext(true); + stepConfiguration.setSaveExecutionAttributes(true); JobExecution jobExecution = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step, jobExecution); @@ -421,7 +421,7 @@ public class SimpleStepExecutorTests extends TestCase { final Map map = new HashMap(); stepExecutor.setStreamManager(new SimpleStreamManager(new ResourcelessTransactionManager()) { - public ExecutionAttributes getStreamContext(Object key) { + public ExecutionAttributes getExecutionAttributes(Object key) { // TODO Auto-generated method stub return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")); } @@ -453,7 +453,7 @@ public class SimpleStepExecutorTests extends TestCase { return restoreFromCalledWithSomeContext; } - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { getStreamContextCalled = true; return new ExecutionAttributes(PropertiesConverter.stringToProperties("spam=bucket")); } diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql index fdcf7a9ca..9c34d9f6b 100644 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql +++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql @@ -58,15 +58,15 @@ CREATE TABLE BATCH_STEP_EXECUTION_ATTRS ( DOUBLE_VAL DOUBLE PRECISION , OBJECT_VAL LONGVARBINARY); -CREATE TABLE BATCH_STEP_EXECUTION_SEQ ( - ID BIGINT IDENTITY -); -CREATE TABLE BATCH_STEP_SEQ ( - ID BIGINT IDENTITY -); -CREATE TABLE BATCH_JOB_EXECUTION_SEQ ( - ID BIGINT IDENTITY -); -CREATE TABLE BATCH_JOB_SEQ ( - ID BIGINT IDENTITY -); +CREATE TABLE BATCH_STEP_EXECUTION_SEQ ( + ID BIGINT IDENTITY +); +CREATE TABLE BATCH_STEP_SEQ ( + ID BIGINT IDENTITY +); +CREATE TABLE BATCH_JOB_EXECUTION_SEQ ( + ID BIGINT IDENTITY +); +CREATE TABLE BATCH_JOB_SEQ ( + ID BIGINT IDENTITY +); diff --git a/spring-batch-execution/src/test/resources/simple-container-definition.xml b/spring-batch-execution/src/test/resources/simple-container-definition.xml index ce0054edc..27cdaa6a3 100644 --- a/spring-batch-execution/src/test/resources/simple-container-definition.xml +++ b/spring-batch-execution/src/test/resources/simple-container-definition.xml @@ -27,7 +27,7 @@ class="org.springframework.batch.execution.step.simple.SimpleStep" abstract="true"> - + diff --git a/spring-batch-infrastructure/pom.xml b/spring-batch-infrastructure/pom.xml index 68435a996..a81ade9b4 100644 --- a/spring-batch-infrastructure/pom.xml +++ b/spring-batch-infrastructure/pom.xml @@ -19,6 +19,9 @@ clover + + false + 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 60fde6a3a..65f9461e1 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 @@ -174,7 +174,7 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl /** * @return the current row number wrapped as StreamContext */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { Properties props = new Properties(); props.setProperty(RESTART_DATA_ROW_NUMBER_KEY, "" + currentProcessedRow); 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 b527c7a96..b487e0616 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 @@ -390,7 +390,7 @@ public class JdbcCursorItemReader extends AbstractTransactionalIoSource implemen * * @see org.springframework.batch.restart.Restartable#getStreamContext() */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { String skipped = skippedRows.toString(); ExecutionAttributes context = new ExecutionAttributes(); context.putString(SKIPPED_ROWS, skipped.substring(1, skipped.length() - 1)); 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 5d5c58f7d..d25606ecb 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 @@ -189,7 +189,7 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource } } - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return keyGenerator.getKeyAsStreamContext(getCurrentKey()); } 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 a6e1eb6f0..fde894e25 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 @@ -90,7 +90,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen * current Line Count which can be used to re initialise the batch job in * case of restart. */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { if (reader == null) { throw new StreamException("ItemStream not open or already closed."); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java index d92fc2471..eef66ab57 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java @@ -244,9 +244,9 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements } /** - * @see ItemStream#getStreamContext() + * @see ItemStream#getExecutionAttributes() */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { if (state == null) { throw new StreamException("ItemStream not open or already closed."); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java index f8055bc4b..bb889e75a 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java @@ -174,9 +174,9 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade /** * @return wrapped count of records read so far. - * @see ItemStream#getStreamContext() + * @see ItemStream#getExecutionAttributes() */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { ExecutionAttributes restartData = new ExecutionAttributes(); restartData.putLong(READ_COUNT_STATISTICS_NAME, currentRecordCount); return restartData; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java index 3f50adb76..542536eeb 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java @@ -361,9 +361,9 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing /** * Get the restart data. * @return the restart data - * @see org.springframework.batch.item.ItemStream#getStreamContext() + * @see org.springframework.batch.item.ItemStream#getExecutionAttributes() */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { if (!initialized) { throw new StreamException("ItemStream is not open, or may have been closed. Cannot access context."); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java index 9b9532360..bb099f778 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java @@ -26,7 +26,7 @@ package org.springframework.batch.item; * The state that is stored is represented as {@link ExecutionAttributes} which * enforces a requirement that any restart data can be represented by a * Properties object. In general, the contract is that {@link ExecutionAttributes} - * that is returned via the {@link #getStreamContext()} method will be given + * that is returned via the {@link #getExecutionAttributes()} method will be given * back to the {@link #restoreFrom(ExecutionAttributes)} method, exactly as it was * provided. *

@@ -34,7 +34,7 @@ package org.springframework.batch.item; * @author Dave Syer * */ -public interface ItemStream extends StreamContextProvider { +public interface ItemStream extends ExecutionAttributesProvider { /** * Restart state given the provided {@link ExecutionAttributes}. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/StreamContextProvider.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/StreamContextProvider.java deleted file mode 100644 index ead50cf1d..000000000 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/StreamContextProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.item; - -/** - * @author Dave Syer - * - */ -public interface StreamContextProvider { - - /** - * Get {@link ExecutionAttributes} representing this object's current state. - * Should not return null even if there is no state. - * - * @return {@link ExecutionAttributes} representing current state. - */ - ExecutionAttributes getStreamContext(); - -} 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 33ab76604..8d04ded6d 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 @@ -48,14 +48,14 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl } /** - * @see ItemStream#getStreamContext() + * @see ItemStream#getExecutionAttributes() * @throws IllegalStateException if the parent template is not itself * {@link ItemStream}. */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { // TODO: this is not necessary... Assert.state(inputSource instanceof ItemStream, "Input source is not ItemStream"); - return ((ItemStream) inputSource).getStreamContext(); + return ((ItemStream) inputSource).getExecutionAttributes(); } /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java index 7d4b15ea3..5fc8e9078 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java @@ -48,9 +48,9 @@ public class ItemStreamAdapter implements ItemStream { /** * Return empty {@link ExecutionAttributes}. - * @see org.springframework.batch.item.StreamContextProvider#getStreamContext() + * @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes() */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return new ExecutionAttributes(); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/SimpleStreamManager.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/SimpleStreamManager.java index f73ab1307..27fd0e0a6 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/SimpleStreamManager.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/SimpleStreamManager.java @@ -67,7 +67,7 @@ public class SimpleStreamManager implements StreamManager { /** * Public setter for the flag. If this is true then the class name of the * streams will be used as a prefix in the {@link StreamContext} in - * {@link #getStreamContext(Object)}. The default value is true, which + * {@link #getExecutionAttributes(Object)}. The default value is true, which * gives the best chance of unique key names in the context. * * @param useClassNameAsPrefix the flag to set (default true). @@ -88,13 +88,13 @@ public class SimpleStreamManager implements StreamManager { * Simple aggregate {@link StreamContext} provider for the contributions * registered under the given key. * - * @see org.springframework.batch.item.stream.StreamManager#getStreamContext(java.lang.Object) + * @see org.springframework.batch.item.stream.StreamManager#getExecutionAttributes(java.lang.Object) */ - public ExecutionAttributes getStreamContext(Object key) { + public ExecutionAttributes getExecutionAttributes(Object key) { final ExecutionAttributes result = new ExecutionAttributes(); iterate(key, new Callback() { public void execute(ItemStream stream) { - ExecutionAttributes context = stream.getStreamContext(); + ExecutionAttributes context = stream.getExecutionAttributes(); String prefix = ClassUtils.getQualifiedName(stream.getClass()) + "."; if (!useClassNameAsPrefix) { prefix = ""; @@ -179,7 +179,7 @@ public class SimpleStreamManager implements StreamManager { iterate(key, new Callback() { public void execute(ItemStream stream) { if (stream.isMarkSupported()) { - stream.mark(stream.getStreamContext()); + stream.mark(stream.getExecutionAttributes()); } } }); @@ -188,7 +188,7 @@ public class SimpleStreamManager implements StreamManager { iterate(key, new Callback() { public void execute(ItemStream stream) { if (stream.isMarkSupported()) { - stream.reset(stream.getStreamContext()); + stream.reset(stream.getExecutionAttributes()); } } }); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/StreamManager.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/StreamManager.java index ba8fc81de..d89305d8e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/StreamManager.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/StreamManager.java @@ -50,7 +50,7 @@ public interface StreamManager { * @return {@link ExecutionAttributes} aggregating the contexts of all providers * registered under this key, or empty otherwise. */ - ExecutionAttributes getStreamContext(Object key); + ExecutionAttributes getExecutionAttributes(Object key); /** * If any resources are needed for the stream to operate they need to be diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/DelegatingItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/DelegatingItemWriter.java index 7e2fa8a37..11eca13ca 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/DelegatingItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/DelegatingItemWriter.java @@ -47,14 +47,14 @@ public class DelegatingItemWriter implements ItemWriter, Skippable, Initializing } /** - * @see ItemStream#getStreamContext() + * @see ItemStream#getExecutionAttributes() */ public ExecutionAttributes getStreamContext() { Assert.state(writer != null, "Source must not be null."); if (writer instanceof ItemStream) { - return ((ItemStream) writer).getStreamContext(); + return ((ItemStream) writer).getExecutionAttributes(); } else { return new ExecutionAttributes(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/DrivingQueryItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/DrivingQueryItemReaderTests.java index c59ef28e2..391636915 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/DrivingQueryItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/DrivingQueryItemReaderTests.java @@ -73,7 +73,7 @@ public class DrivingQueryItemReaderTests extends TestCase { Foo foo2 = (Foo) source.read(); assertEquals(2, foo2.getValue()); - ExecutionAttributes streamContext = getAsRestartable(source).getStreamContext(); + ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes(); // create new input source source = createItemReader(); @@ -95,7 +95,7 @@ public class DrivingQueryItemReaderTests extends TestCase { Foo foo2 = (Foo) source.read(); assertEquals(2, foo2.getValue()); - ExecutionAttributes streamContext = getAsRestartable(source).getStreamContext(); + ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes(); // create new input source source = createItemReader(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/FooInputSource.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/FooInputSource.java index aa6588ebf..e3719a834 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/FooInputSource.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/FooInputSource.java @@ -27,8 +27,8 @@ class FooItemReader extends AbstractItemReader implements ItemStream, ItemReader } } - public ExecutionAttributes getStreamContext() { - return inputSource.getStreamContext(); + public ExecutionAttributes getExecutionAttributes() { + return inputSource.getExecutionAttributes(); } public void restoreFrom(ExecutionAttributes data) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java index 57dc21645..ed559c95c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java @@ -156,7 +156,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase { inputSource.setFieldSetMapper(fieldSetMapper); // do not open the template... try { - inputSource.restoreFrom(inputSource.getStreamContext()); + inputSource.restoreFrom(inputSource.getExecutionAttributes()); } catch (StreamException e) { assertTrue("Message does not contain open: "+e.getMessage(), e.getMessage().contains("open")); } @@ -179,7 +179,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase { inputSource.read(); // get restart data - ExecutionAttributes streamContext = inputSource.getStreamContext(); + ExecutionAttributes streamContext = inputSource.getExecutionAttributes(); assertEquals("4", (String) streamContext.getProperties().getProperty( DefaultFlatFileItemReader.READ_STATISTICS_NAME)); // close input @@ -195,7 +195,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase { assertEquals("[testLine5]", inputSource.read().toString()); assertEquals("[testLine6]", inputSource.read().toString()); - ExecutionAttributes statistics = inputSource.getStreamContext(); + ExecutionAttributes statistics = inputSource.getExecutionAttributes(); assertEquals(6, statistics.getLong(DefaultFlatFileItemReader.READ_STATISTICS_NAME)); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java index 15fd2f890..42374f9e5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java @@ -309,7 +309,7 @@ public class FlatFileItemWriterTests extends TestCase { commit(); // get restart data - ExecutionAttributes streamContext = inputSource.getStreamContext(); + ExecutionAttributes streamContext = inputSource.getExecutionAttributes(); // close template inputSource.close(); @@ -335,7 +335,7 @@ public class FlatFileItemWriterTests extends TestCase { inputSource.write("testLine8"); // get statistics - ExecutionAttributes statistics = inputSource.getStreamContext(); + ExecutionAttributes statistics = inputSource.getExecutionAttributes(); // close template inputSource.close(); @@ -363,7 +363,7 @@ public class FlatFileItemWriterTests extends TestCase { public void testDefaultStreamContext() throws Exception { inputSource = new FlatFileItemWriter(); inputSource.open(); - ExecutionAttributes streamContext = inputSource.getStreamContext(); + ExecutionAttributes streamContext = inputSource.getExecutionAttributes(); assertNotNull(streamContext); assertEquals(3, streamContext.getProperties().size()); assertEquals(0, streamContext.getLong(FlatFileItemWriter.RESTART_DATA_NAME)); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/sql/AbstractJdbcItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/sql/AbstractJdbcItemReaderIntegrationTests.java index 060fba2d3..85f042476 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/sql/AbstractJdbcItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/sql/AbstractJdbcItemReaderIntegrationTests.java @@ -76,7 +76,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra Foo foo2 = (Foo) source.read(); assertEquals(2, foo2.getValue()); - ExecutionAttributes streamContext = getAsRestartable(source).getStreamContext(); + ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes(); // create new input source source = createItemReader(); @@ -98,7 +98,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra Foo foo2 = (Foo) source.read(); assertEquals(2, foo2.getValue()); - ExecutionAttributes streamContext = getAsRestartable(source).getStreamContext(); + ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes(); // create new input source source = createItemReader(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractDataSourceItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractDataSourceItemReaderIntegrationTests.java index d28e7a8d4..d9c5c2114 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractDataSourceItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractDataSourceItemReaderIntegrationTests.java @@ -83,7 +83,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends Abstr Foo foo2 = (Foo) source.read(); assertEquals(2, foo2.getValue()); - ExecutionAttributes streamContext = getAsRestartable(source).getStreamContext(); + ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes(); // create new input source source = createItemReader(); @@ -105,7 +105,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends Abstr Foo foo2 = (Foo) source.read(); assertEquals(2, foo2.getValue()); - ExecutionAttributes streamContext = getAsRestartable(source).getStreamContext(); + ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes(); // create new input source source = createItemReader(); @@ -208,7 +208,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends Abstr rollback(); - ExecutionAttributes streamContext = getAsRestartable(source).getStreamContext(); + ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes(); // create new input source source = createItemReader(); @@ -221,11 +221,11 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends Abstr } private void commit() { - ((ItemStream) source).mark(((ItemStream) source).getStreamContext()); + ((ItemStream) source).mark(((ItemStream) source).getExecutionAttributes()); } private void rollback() { - ((ItemStream) source).reset(((ItemStream) source).getStreamContext()); + ((ItemStream) source).reset(((ItemStream) source).getExecutionAttributes()); } private Skippable getAsSkippable(ItemReader source) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventItemReaderTests.java index b4fd56246..806e83c60 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventItemReaderTests.java @@ -112,7 +112,7 @@ public class StaxEventItemReaderTests extends TestCase { */ public void testRestart() { source.read(); - ExecutionAttributes streamContext = source.getStreamContext(); + ExecutionAttributes streamContext = source.getExecutionAttributes(); assertEquals(1, streamContext.getLong(StaxEventItemReader.READ_COUNT_STATISTICS_NAME)); List expectedAfterRestart = (List) source.read(); @@ -208,7 +208,7 @@ public class StaxEventItemReaderTests extends TestCase { } private long extractRecordCount() { - return source.getStreamContext().getLong(StaxEventItemReader.READ_COUNT_STATISTICS_NAME); + return source.getExecutionAttributes().getLong(StaxEventItemReader.READ_COUNT_STATISTICS_NAME); } public void testCloseWithoutOpen() throws Exception { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java index cfa2767cd..6f66513c9 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java @@ -88,7 +88,7 @@ public class StaxEventWriterItemWriterTests extends TestCase { // write records writer.write(record); writer.mark(null); - ExecutionAttributes streamContext = writer.getStreamContext(); + ExecutionAttributes streamContext = writer.getExecutionAttributes(); // create new writer from saved restart data and continue writing writer = createItemWriter(); @@ -116,7 +116,7 @@ public class StaxEventWriterItemWriterTests extends TestCase { for (int i = 1; i <= NUMBER_OF_RECORDS; i++) { writer.write(record); long writeStatistics = - writer.getStreamContext().getLong(StaxEventItemWriter.WRITE_STATISTICS_NAME); + writer.getExecutionAttributes().getLong(StaxEventItemWriter.WRITE_STATISTICS_NAME); assertEquals(i, writeStatistics); } 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 0baa0d796..db198d26e 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 @@ -73,7 +73,7 @@ public class DelegatingItemReaderTests extends TestCase { * Gets restart data from the input template */ public void testGetStreamContext() { - Properties props = itemProvider.getStreamContext().getProperties(); + Properties props = itemProvider.getExecutionAttributes().getProperties(); assertEquals("foo", props.getProperty("value")); } @@ -99,7 +99,7 @@ public class DelegatingItemReaderTests extends TestCase { return PropertiesConverter.stringToProperties("a=b"); } - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return new ExecutionAttributes(PropertiesConverter.stringToProperties("value=foo")); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java index 51b0bdf60..02dce156a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java @@ -72,31 +72,31 @@ public class SimpleStreamManagerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.item.stream.SimpleStreamManager#getStreamContext(java.lang.Object)}. + * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}. */ public void testGetStreamContextEmpty() { - ExecutionAttributes streamContext = manager.getStreamContext("foo"); + ExecutionAttributes streamContext = manager.getExecutionAttributes("foo"); assertEquals(0, streamContext.entrySet().size()); } /** * Test method for - * {@link org.springframework.batch.item.stream.SimpleStreamManager#getStreamContext(java.lang.Object)}. + * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}. */ public void testGetStreamContextNotEmpty() { manager.register("foo", stream, null); - ExecutionAttributes streamContext = manager.getStreamContext("foo"); + ExecutionAttributes streamContext = manager.getExecutionAttributes("foo"); assertEquals(1, streamContext.entrySet().size()); assertEquals("bar", streamContext.getString(ClassUtils.getQualifiedName(stream.getClass()) + ".foo")); } /** * Test method for - * {@link org.springframework.batch.item.stream.SimpleStreamManager#getStreamContext(java.lang.Object)}. + * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}. */ public void testGetStreamContextNotEmptyAndRestore() { testGetStreamContextNotEmpty(); - ExecutionAttributes context = manager.getStreamContext("foo"); + ExecutionAttributes context = manager.getExecutionAttributes("foo"); // Register again, now with the context that was created from the same // stream... manager.register("foo", stream, context); @@ -107,7 +107,7 @@ public class SimpleStreamManagerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.item.stream.SimpleStreamManager#getStreamContext(java.lang.Object)}. + * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}. */ public void testGetStreamContextNotEmptyAndRestoreWithNoPrefix() { ExecutionAttributes context = new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")); @@ -120,12 +120,12 @@ public class SimpleStreamManagerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.item.stream.SimpleStreamManager#getStreamContext(java.lang.Object)}. + * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}. */ public void testGetStreamContextWithNoPrefix() { manager.setUseClassNameAsPrefix(false); manager.register("foo", stream, null); - ExecutionAttributes context = manager.getStreamContext("foo"); + ExecutionAttributes context = manager.getExecutionAttributes("foo"); assertEquals(1, context.entrySet().size()); // The list should have the foo= map value from the sub-context assertEquals("bar", context.getString("foo")); @@ -133,20 +133,20 @@ public class SimpleStreamManagerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.item.stream.SimpleStreamManager#getStreamContext(java.lang.Object)}. + * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}. */ public void testGetStreamContextTwoRegistrations() { manager.register("foo", new ItemStreamAdapter() { - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")); } }, null); manager.register("foo", new ItemStreamAdapter() { - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=spam")); } }, null); - ExecutionAttributes streamContext = manager.getStreamContext("foo"); + ExecutionAttributes streamContext = manager.getExecutionAttributes("foo"); assertEquals(2, streamContext.entrySet().size()); } @@ -234,7 +234,7 @@ public class SimpleStreamManagerTests extends TestCase { } private final class ItemStreamAdapterExtension extends ItemStreamAdapter { - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterItemProcessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterItemProcessorTests.java index de84dcc86..14a3dbf55 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterItemProcessorTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterItemProcessorTests.java @@ -144,7 +144,7 @@ public class ItemWriterItemProcessorTests extends TestCase { public void open() { } - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return new ExecutionAttributes(PropertiesConverter.stringToProperties("value=foo")); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/StagingItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/StagingItemReader.java index 98f0872cb..09aeabd51 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/StagingItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/reader/StagingItemReader.java @@ -243,7 +243,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key * (non-Javadoc) * @see org.springframework.batch.item.StreamContextProvider#getStreamContext() */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return new ExecutionAttributes(); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/InfiniteLoopTasklet.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/InfiniteLoopTasklet.java index 7901dc46c..29e283847 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/InfiniteLoopTasklet.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/InfiniteLoopTasklet.java @@ -18,7 +18,7 @@ package org.springframework.batch.sample.tasklet; import org.springframework.batch.core.tasklet.Tasklet; import org.springframework.batch.item.ExecutionAttributes; -import org.springframework.batch.item.StreamContextProvider; +import org.springframework.batch.item.ExecutionAttributesProvider; import org.springframework.batch.repeat.ExitStatus; import org.springframework.batch.support.PropertiesConverter; @@ -30,7 +30,7 @@ import org.springframework.batch.support.PropertiesConverter; * @author Lucas Ward * */ -public class InfiniteLoopTasklet implements Tasklet, StreamContextProvider { +public class InfiniteLoopTasklet implements Tasklet, ExecutionAttributesProvider { private int count = 0; @@ -51,7 +51,7 @@ public class InfiniteLoopTasklet implements Tasklet, StreamContextProvider { * (non-Javadoc) * @see org.springframework.batch.item.stream.ItemStreamAdapter#getStreamContext() */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { return new ExecutionAttributes(PropertiesConverter.stringToProperties("count=" + count)); } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeTasklet.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeTasklet.java index 70b8b47a3..e4f2cddca 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeTasklet.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeTasklet.java @@ -20,7 +20,7 @@ import org.springframework.batch.core.tasklet.Tasklet; import org.springframework.batch.execution.tasklet.ItemOrientedTasklet; import org.springframework.batch.io.file.DefaultFlatFileItemReader; import org.springframework.batch.item.ExecutionAttributes; -import org.springframework.batch.item.StreamContextProvider; +import org.springframework.batch.item.ExecutionAttributesProvider; import org.springframework.batch.repeat.ExitStatus; import org.springframework.batch.sample.dao.TradeDao; import org.springframework.batch.sample.domain.Trade; @@ -39,7 +39,7 @@ import org.springframework.batch.sample.domain.Trade; * @author Lucas Ward * @author Dave Syer */ -public class SimpleTradeTasklet implements Tasklet, StreamContextProvider { +public class SimpleTradeTasklet implements Tasklet, ExecutionAttributesProvider { /* * reads the data from input file @@ -86,7 +86,7 @@ public class SimpleTradeTasklet implements Tasklet, StreamContextProvider { /* (non-Javadoc) * @see org.springframework.batch.item.StreamContextProvider#getStreamContext() */ - public ExecutionAttributes getStreamContext() { + public ExecutionAttributes getExecutionAttributes() { ExecutionAttributes statistics = new ExecutionAttributes(); statistics.putLong("trade.count", tradeCount); return statistics; diff --git a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml index d846b57fa..3db6e0106 100644 --- a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml @@ -48,7 +48,7 @@
- + diff --git a/spring-batch-samples/src/main/resources/jobs/restartSample.xml b/spring-batch-samples/src/main/resources/jobs/restartSample.xml index e815c9ea6..a9cc1ef05 100644 --- a/spring-batch-samples/src/main/resources/jobs/restartSample.xml +++ b/spring-batch-samples/src/main/resources/jobs/restartSample.xml @@ -31,7 +31,6 @@ - diff --git a/spring-batch-samples/src/main/resources/simple-container-definition.xml b/spring-batch-samples/src/main/resources/simple-container-definition.xml index 62de35142..c2e8e804f 100644 --- a/spring-batch-samples/src/main/resources/simple-container-definition.xml +++ b/spring-batch-samples/src/main/resources/simple-container-definition.xml @@ -87,7 +87,7 @@ - +