From 4a40b17002fac763d65f67811349cdec806f32b5 Mon Sep 17 00:00:00 2001
From: robokaso
Date: Fri, 15 Feb 2008 12:12:16 +0000
Subject: [PATCH] RESOLVED - issue BATCH-362: Rename ExecutionAttributes to
ExecutionContext http://jira.springframework.org/browse/BATCH-362
---
.../batch/core/domain/Step.java | 2 +-
.../batch/core/domain/StepContribution.java | 16 +++---
.../batch/core/domain/StepExecution.java | 20 ++++----
.../batch/core/domain/StepSupport.java | 10 ++--
.../batch/core/repository/JobRepository.java | 4 +-
.../core/domain/StepContributionTests.java | 14 +++---
.../batch/core/domain/StepExecutionTests.java | 12 ++---
.../batch/core/domain/StepSupportTests.java | 6 +--
.../support/SimpleExportedJobLauncher.java | 2 +-
.../repository/SimpleJobRepository.java | 10 ++--
.../repository/dao/JdbcStepExecutionDao.java | 34 ++++++-------
.../repository/dao/JdbcStepInstanceDao.java | 14 ------
.../execution/repository/dao/MapStepDao.java | 16 +++---
.../repository/dao/StepExecutionDao.java | 20 ++++----
.../repository/dao/StepInstanceDao.java | 8 ---
.../execution/scope/SimpleStepContext.java | 18 +++----
.../batch/execution/scope/StepContext.java | 10 ++--
.../execution/step/simple/ChunkedStep.java | 18 +++----
.../step/simple/SimpleStepExecutor.java | 18 +++----
.../SimpleExportedJobLauncherTests.java | 4 +-
.../execution/repository/MockStepDao.java | 12 ++---
.../repository/SimpleJobRepositoryTests.java | 50 +++++++++----------
.../repository/dao/AbstractStepDaoTests.java | 46 ++++++++---------
.../repository/dao/MapStepDaoTests.java | 12 ++---
.../scope/SimpleStepContextTests.java | 16 +++---
.../simple/SimpleStepConfigurationTests.java | 10 ++--
.../step/simple/SimpleStepExecutorTests.java | 32 ++++++------
.../resources/simple-container-definition.xml | 2 +-
.../io/cursor/HibernateCursorItemReader.java | 20 ++++----
.../batch/io/cursor/JdbcCursorItemReader.java | 14 +++---
.../io/driving/DrivingQueryItemReader.java | 18 +++----
.../batch/io/driving/KeyGenerator.java | 12 ++---
...> ColumnMapExecutionContextRowMapper.java} | 28 +++++------
...er.java => ExecutionContextRowMapper.java} | 22 ++++----
.../driving/support/IbatisKeyGenerator.java | 16 +++---
.../MultipleColumnJdbcKeyGenerator.java | 24 ++++-----
.../support/SingleColumnJdbcKeyGenerator.java | 22 ++++----
.../batch/io/file/FlatFileItemReader.java | 20 ++++----
.../batch/io/file/FlatFileItemWriter.java | 24 ++++-----
.../batch/io/xml/StaxEventItemReader.java | 22 ++++----
.../batch/io/xml/StaxEventItemWriter.java | 16 +++---
...nAttributes.java => ExecutionContext.java} | 10 ++--
...der.java => ExecutionContextProvider.java} | 8 +--
.../batch/item/ItemStream.java | 18 +++----
.../item/reader/DelegatingItemReader.java | 16 +++---
.../batch/item/stream/ItemStreamAdapter.java | 18 +++----
.../item/stream/SimpleStreamManager.java | 32 ++++++------
.../batch/item/stream/StreamManager.java | 12 ++---
.../driving/DrivingQueryItemReaderTests.java | 16 +++---
.../batch/io/driving/FooInputSource.java | 8 +--
...umnMapExecutionContextRowMapperTests.java} | 28 +++++------
...olumnJdbcKeyGeneratorIntegrationTests.java | 20 ++++----
...olumnJdbcKeyGeneratorIntegrationTests.java | 10 ++--
.../file/FlatFileItemReaderAdvancedTests.java | 8 +--
.../io/file/FlatFileItemWriterTests.java | 8 +--
...bstractJdbcItemReaderIntegrationTests.java | 8 +--
...tDataSourceItemReaderIntegrationTests.java | 10 ++--
.../io/xml/StaxEventItemReaderTests.java | 10 ++--
.../xml/StaxEventWriterItemWriterTests.java | 6 +--
...sTests.java => ExecutionContextTests.java} | 8 +--
.../reader/DelegatingItemReaderTests.java | 12 ++---
.../item/stream/SimpleStreamManagerTests.java | 40 +++++++--------
.../writer/ItemWriterItemProcessorTests.java | 8 +--
.../item/reader/GeneratingItemReader.java | 12 ++---
.../sample/item/reader/StagingItemReader.java | 16 +++---
.../sample/tasklet/InfiniteLoopTasklet.java | 12 ++---
.../sample/tasklet/SimpleTradeWriter.java | 12 ++---
.../src/main/resources/jobs/parallelJob.xml | 2 +-
.../resources/simple-container-definition.xml | 6 +--
69 files changed, 523 insertions(+), 545 deletions(-)
rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/{ColumnMapExecutionAttributesRowMapper.java => ColumnMapExecutionContextRowMapper.java} (76%)
rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/{ExecutionAttributesRowMapper.java => ExecutionContextRowMapper.java} (62%)
rename spring-batch-infrastructure/src/main/java/org/springframework/batch/item/{ExecutionAttributes.java => ExecutionContext.java} (94%)
rename spring-batch-infrastructure/src/main/java/org/springframework/batch/item/{ExecutionAttributesProvider.java => ExecutionContextProvider.java} (76%)
rename spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/{ColumnMapExecutionAttributesRowMapperTests.java => ColumnMapExecutionContextRowMapperTests.java} (63%)
rename spring-batch-infrastructure/src/test/java/org/springframework/batch/item/{ExecutionAttributesTests.java => ExecutionContextTests.java} (92%)
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java
index be33980d8..e2434e13e 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java
@@ -43,7 +43,7 @@ public interface Step {
* Flag to indicate if restart data needs to be saved for this step.
* @return true if restart data should be saved
*/
- boolean isSaveExecutionAttributes();
+ boolean isSaveExecutionContext();
/**
* @return the number of times a job can be started with the same
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepContribution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepContribution.java
index dc929997a..804f84e90 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepContribution.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepContribution.java
@@ -15,7 +15,7 @@
*/
package org.springframework.batch.core.domain;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
/**
* Represents a contribution to a {@link StepExecution}, buffering changes
@@ -30,7 +30,7 @@ public class StepContribution {
private StepExecution execution;
- private ExecutionAttributes executionAttributes;
+ private ExecutionContext executionContext;
private int commitCount;
@@ -67,18 +67,18 @@ public class StepContribution {
/**
* Set the statistics properties.
*
- * @param executionAttributes
+ * @param executionContext
*/
- public void setExecutionAttributes(ExecutionAttributes executionAttributes) {
- this.executionAttributes = executionAttributes;
+ public void setExecutionContext(ExecutionContext executionContext) {
+ this.executionContext = executionContext;
}
/**
- * Public getter for the {@link ExecutionAttributes}.
+ * Public getter for the {@link ExecutionContext}.
* @return the stream context
*/
- public ExecutionAttributes getExecutionAttributes() {
- return executionAttributes;
+ public ExecutionContext getExecutionContext() {
+ return executionContext;
}
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecution.java
index e0afdd78f..e1b69293e 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecution.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecution.java
@@ -18,7 +18,7 @@ package org.springframework.batch.core.domain;
import java.util.Date;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
/**
@@ -55,7 +55,7 @@ public class StepExecution extends Entity {
private Date endTime = null;
- private ExecutionAttributes executionAttributes = new ExecutionAttributes();
+ private ExecutionContext executionContext = new ExecutionContext();
private ExitStatus exitStatus = ExitStatus.UNKNOWN;
@@ -106,21 +106,21 @@ public class StepExecution extends Entity {
}
/**
- * Returns the {@link ExecutionAttributes} for this execution
+ * Returns the {@link ExecutionContext} for this execution
*
* @return the attributes
*/
- public ExecutionAttributes getExecutionAttributes() {
- return executionAttributes;
+ public ExecutionContext getExecutionContext() {
+ return executionContext;
}
/**
- * Sets the {@link ExecutionAttributes} for this execution
+ * Sets the {@link ExecutionContext} for this execution
*
- * @param executionAttributes the attributes
+ * @param executionContext the attributes
*/
- public void setExecutionAttributes(ExecutionAttributes executionAttributes) {
- this.executionAttributes = executionAttributes;
+ public void setExecutionContext(ExecutionContext executionContext) {
+ this.executionContext = executionContext;
}
/**
@@ -346,7 +346,7 @@ public class StepExecution extends Entity {
*/
public synchronized void apply(StepContribution contribution) {
taskCount += contribution.getTaskCount();
- executionAttributes = contribution.getExecutionAttributes();
+ executionContext = contribution.getExecutionContext();
commitCount += contribution.getCommitCount();
}
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 420ac1aa3..f2e4c6e85 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
@@ -33,7 +33,7 @@ public class StepSupport implements Step, BeanNameAware {
private boolean allowStartIfComplete;
- private boolean saveExecutionAttributes = false;
+ private boolean saveExecutionContext = false;
/**
* Default constructor for {@link StepSupport}.
@@ -102,12 +102,12 @@ public class StepSupport implements Step, BeanNameAware {
this.allowStartIfComplete = allowStartIfComplete;
}
- public void setSaveExecutionAttributes(boolean saveExecutionAttributes) {
- this.saveExecutionAttributes = saveExecutionAttributes;
+ public void setSaveExecutionContext(boolean saveExecutionContext) {
+ this.saveExecutionContext = saveExecutionContext;
}
- public boolean isSaveExecutionAttributes() {
- return saveExecutionAttributes;
+ public boolean isSaveExecutionContext() {
+ return saveExecutionContext;
}
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java
index dccb423b1..c78600229 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java
@@ -21,7 +21,7 @@ import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.StepExecution;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
/**
*
@@ -29,7 +29,7 @@ import org.springframework.batch.item.ExecutionAttributes;
* must first be obtained using the findOrCreateJob method. Once a Job and it's
* related steps are obtained, they can be updated. It should be noted that any
* reconstituted steps are expected to contain restart data if the step
- * says it wants to be restored after a restart, and {@link ExecutionAttributes}
+ * says it wants to be restored after a restart, and {@link ExecutionContext}
* exists.
*
*
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepContributionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepContributionTests.java
index ed004fc98..3a7a42fd7 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepContributionTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepContributionTests.java
@@ -17,7 +17,7 @@ package org.springframework.batch.core.domain;
import junit.framework.TestCase;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
/**
* @author Dave Syer
@@ -41,14 +41,14 @@ public class StepContributionTests extends TestCase {
/**
* Test method for
- * {@link org.springframework.batch.core.domain.StepContribution#setExecutionAttributes(ExecutionAttributes)}.
+ * {@link org.springframework.batch.core.domain.StepContribution#setExecutionContext(ExecutionContext)}.
*/
- public void testSetExecutionAttributes() {
- assertEquals(null, contribution.getExecutionAttributes());
- ExecutionAttributes context = new ExecutionAttributes();
+ public void testSetExecutionContext() {
+ assertEquals(null, contribution.getExecutionContext());
+ ExecutionContext context = new ExecutionContext();
context.putString("foo", "bar");
- contribution.setExecutionAttributes(context);
- assertEquals(1, contribution.getExecutionAttributes().getProperties().size());
+ contribution.setExecutionContext(context);
+ assertEquals(1, contribution.getExecutionContext().getProperties().size());
}
/**
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepExecutionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepExecutionTests.java
index d2585050c..b7119db0b 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepExecutionTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepExecutionTests.java
@@ -19,7 +19,7 @@ import java.util.Date;
import junit.framework.TestCase;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
/**
@@ -198,12 +198,12 @@ public class StepExecutionTests extends TestCase {
execution.toString().indexOf("rollback") >= 0);
}
- public void testExecutionAttributes() throws Exception {
- assertNotNull(execution.getExecutionAttributes());
- ExecutionAttributes context = new ExecutionAttributes();
+ public void testExecutionContext() throws Exception {
+ assertNotNull(execution.getExecutionContext());
+ ExecutionContext context = new ExecutionContext();
context.putString("foo", "bar");
- execution.setExecutionAttributes(context );
- assertEquals("bar", execution.getExecutionAttributes().getString("foo"));
+ execution.setExecutionContext(context );
+ assertEquals("bar", execution.getExecutionContext().getString("foo"));
}
public void testEqualsWithSameIdentifier() throws Exception {
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 c7f135e17..3e85bbf33 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
@@ -64,9 +64,9 @@ public class StepSupportTests extends TestCase {
}
public void testSaveRestartFlag() throws Exception {
- assertEquals(false, configuration.isSaveExecutionAttributes());
- configuration.setSaveExecutionAttributes(true);
- assertEquals(true, configuration.isSaveExecutionAttributes());
+ assertEquals(false, configuration.isSaveExecutionContext());
+ configuration.setSaveExecutionContext(true);
+ assertEquals(true, configuration.isSaveExecutionContext());
}
/**
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncher.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncher.java
index 168e1e1ce..04d616858 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncher.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncher.java
@@ -103,7 +103,7 @@ public class SimpleExportedJobLauncher implements ExportedJobLauncher, Initializ
int i = 0;
for (Iterator iterator = execution.getStepExecutions().iterator(); iterator.hasNext();) {
StepExecution stepExecution = (StepExecution) iterator.next();
- Properties statistics = stepExecution.getExecutionAttributes().getProperties();
+ Properties statistics = stepExecution.getExecutionContext().getProperties();
for (Iterator iter = statistics.keySet().iterator(); iter.hasNext();) {
String key = (String) iter.next();
result.setProperty(prefix + "step" + i + "." + key, statistics.getProperty(key));
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java
index 4e93e67bf..19f64afeb 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java
@@ -36,7 +36,7 @@ import org.springframework.batch.execution.repository.dao.JobExecutionDao;
import org.springframework.batch.execution.repository.dao.JobInstanceDao;
import org.springframework.batch.execution.repository.dao.StepExecutionDao;
import org.springframework.batch.execution.repository.dao.StepInstanceDao;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.util.Assert;
@@ -264,12 +264,12 @@ public class SimpleJobRepository implements JobRepository {
jobExecutionDao.saveJobExecution(jobExecution);
}
stepExecutionDao.saveStepExecution(stepExecution);
- stepExecutionDao.saveExecutionAttributes(stepExecution.getId(), stepExecution.getExecutionAttributes());
+ stepExecutionDao.saveExecutionContext(stepExecution.getId(), stepExecution.getExecutionContext());
}
else {
// existing execution, update
stepExecutionDao.updateStepExecution(stepExecution);
- stepExecutionDao.updateExecutionAttributes(stepExecution.getId(), stepExecution.getExecutionAttributes());
+ stepExecutionDao.updateExecutionContext(stepExecution.getId(), stepExecution.getExecutionContext());
}
}
@@ -315,9 +315,9 @@ public class SimpleJobRepository implements JobRepository {
if (stepInstance != null) {
stepInstance.setLastExecution(stepExecutionDao.getLastStepExecution(stepInstance));
if (stepInstance.getLastExecution() != null) {
- ExecutionAttributes executionAttributes = stepExecutionDao.findExecutionAttributes(stepInstance
+ ExecutionContext executionContext = stepExecutionDao.findExecutionContext(stepInstance
.getLastExecution().getId());
- stepInstance.getLastExecution().setExecutionAttributes(executionAttributes);
+ stepInstance.getLastExecution().setExecutionContext(executionContext);
}
stepInstance.setStepExecutionCount(stepExecutionDao.getStepExecutionCount(stepInstance));
stepInstances.add(stepInstance);
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java
index 5a1138eaa..842bcbafc 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java
@@ -18,7 +18,7 @@ import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
import org.springframework.batch.execution.repository.dao.JdbcJobExecutionDao.JobExecutionRowMapper;
import org.springframework.batch.io.exception.BatchCriticalException;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.support.PropertiesConverter;
import org.springframework.beans.factory.InitializingBean;
@@ -96,11 +96,11 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao
private DataFieldMaxValueIncrementer stepExecutionIncrementer;
- public ExecutionAttributes findExecutionAttributes(final Long executionId) {
+ public ExecutionContext findExecutionContext(final Long executionId) {
Assert.notNull(executionId, "ExecutionId must not be null.");
- final ExecutionAttributes executionAttributes = new ExecutionAttributes();
+ final ExecutionContext executionContext = new ExecutionContext();
RowCallbackHandler callback = new RowCallbackHandler() {
@@ -110,16 +110,16 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao
AttributeType type = AttributeType.getType(typeCd);
String key = rs.getString("KEY_NAME");
if (type == AttributeType.STRING) {
- executionAttributes.putString(key, rs.getString("STRING_VAL"));
+ executionContext.putString(key, rs.getString("STRING_VAL"));
}
else if (type == AttributeType.LONG) {
- executionAttributes.putLong(key, rs.getLong("LONG_VAL"));
+ executionContext.putLong(key, rs.getLong("LONG_VAL"));
}
else if (type == AttributeType.DOUBLE) {
- executionAttributes.putDouble(key, rs.getDouble("DOUBLE_VAL"));
+ executionContext.putDouble(key, rs.getDouble("DOUBLE_VAL"));
}
else if (type == AttributeType.OBJECT) {
- executionAttributes.putLong(key, rs.getLong("OBJECT_VAL"));
+ executionContext.putLong(key, rs.getLong("OBJECT_VAL"));
}
else {
throw new BatchCriticalException("Invalid type found: [" + typeCd + "] for execution id: ["
@@ -130,7 +130,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao
getJdbcTemplate().query(getQuery(FIND_STEP_EXECUTION_ATTRS), new Object[] { executionId }, callback);
- return executionAttributes;
+ return executionContext;
}
/**
@@ -200,12 +200,12 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao
* attributes that don't match a provided type must be serialized into a
* blob.
*/
- public void saveExecutionAttributes(final Long executionId, final ExecutionAttributes executionAttributes) {
+ public void saveExecutionContext(final Long executionId, final ExecutionContext executionContext) {
Assert.notNull(executionId, "ExecutionId must not be null.");
- Assert.notNull(executionAttributes, "The ExecutionAttributes must not be null.");
+ Assert.notNull(executionContext, "The ExecutionContext must not be null.");
- for (Iterator it = executionAttributes.entrySet().iterator(); it.hasNext();) {
+ for (Iterator it = executionContext.entrySet().iterator(); it.hasNext();) {
Entry entry = (Entry) it.next();
final String key = entry.getKey().toString();
final Object value = entry.getValue();
@@ -285,7 +285,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao
stepExecution.getStepId(), stepExecution.getJobExecutionId(), stepExecution.getStartTime(),
stepExecution.getEndTime(), stepExecution.getStatus().toString(), stepExecution.getCommitCount(),
stepExecution.getTaskCount(),
- PropertiesConverter.propertiesToString(stepExecution.getExecutionAttributes().getProperties()),
+ PropertiesConverter.propertiesToString(stepExecution.getExecutionContext().getProperties()),
stepExecution.getExitStatus().isContinuable() ? "Y" : "N", stepExecution.getExitStatus().getExitCode(),
stepExecution.getExitStatus().getExitDescription() };
getJdbcTemplate().update(getQuery(SAVE_STEP_EXECUTION), parameters, new int[] { Types.INTEGER, Types.INTEGER,
@@ -314,12 +314,12 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao
*
* @see {@link LobCreator}
*/
- public void updateExecutionAttributes(final Long executionId, ExecutionAttributes executionAttributes) {
+ public void updateExecutionContext(final Long executionId, ExecutionContext executionContext) {
Assert.notNull(executionId, "ExecutionId must not be null.");
- Assert.notNull(executionAttributes, "The ExecutionAttributes must not be null.");
+ Assert.notNull(executionContext, "The ExecutionContext must not be null.");
- for (Iterator it = executionAttributes.entrySet().iterator(); it.hasNext();) {
+ for (Iterator it = executionContext.entrySet().iterator(); it.hasNext();) {
Entry entry = (Entry) it.next();
final String key = entry.getKey().toString();
final Object value = entry.getValue();
@@ -411,7 +411,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao
Integer version = new Integer(stepExecution.getVersion().intValue() + 1);
Object[] parameters = new Object[] { stepExecution.getStartTime(), stepExecution.getEndTime(),
stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getTaskCount(),
- PropertiesConverter.propertiesToString(stepExecution.getExecutionAttributes().getProperties()),
+ PropertiesConverter.propertiesToString(stepExecution.getExecutionContext().getProperties()),
stepExecution.getExitStatus().isContinuable() ? "Y" : "N",
stepExecution.getExitStatus().getExitCode(), exitDescription, version, stepExecution.getId(),
stepExecution.getVersion() };
@@ -449,7 +449,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao
stepExecution.setStatus(BatchStatus.getStatus(rs.getString(5)));
stepExecution.setCommitCount(rs.getInt(6));
stepExecution.setTaskCount(rs.getInt(7));
- stepExecution.setExecutionAttributes(new ExecutionAttributes(PropertiesConverter.stringToProperties(rs
+ stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties(rs
.getString(8))));
stepExecution
.setExitStatus(new ExitStatus("Y".equals(rs.getString(9)), rs.getString(10), rs.getString(11)));
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepInstanceDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepInstanceDao.java
index 469580da7..c46a5a743 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepInstanceDao.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepInstanceDao.java
@@ -124,20 +124,6 @@ public class JdbcStepInstanceDao extends AbstractJdbcBatchMetadataDao implements
return getJdbcTemplate().query(getQuery(FIND_STEPS), parameters, rowMapper);
}
-// /**
-// * @see StepDao#updateStepInstance(StepInstance)
-// * @throws IllegalArgumentException if step, or it's status and id is null.
-// */
-// public void updateStepInstance(final StepInstance step) {
-//
-// Assert.notNull(step, "Step cannot be null.");
-// Assert.notNull(step.getId(), "Step Id cannot be null.");
-//
-// Object[] parameters = new Object[] { step.getLastExecution().getId(), step.getId() };
-//
-// getJdbcTemplate().update(getQuery(UPDATE_STEP), parameters);
-// }
-
public void setStepIncrementer(DataFieldMaxValueIncrementer stepIncrementer) {
this.stepIncrementer = stepIncrementer;
}
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 89c135a25..b68347154 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
@@ -26,7 +26,7 @@ import java.util.Map.Entry;
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.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.support.transaction.TransactionAwareProxyFactory;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
@@ -82,8 +82,8 @@ public class MapStepDao implements StepDao {
return new ArrayList(steps);
}
- public ExecutionAttributes getExecutionAttributes(Long stepId) {
- return (ExecutionAttributes) restartsById.get(stepId);
+ public ExecutionContext getExecutionContext(Long stepId) {
+ return (ExecutionContext) restartsById.get(stepId);
}
public int getStepExecutionCount(StepInstance stepInstance) {
@@ -150,16 +150,16 @@ public class MapStepDao implements StepDao {
// no-op
}
- public ExecutionAttributes findExecutionAttributes(Long executionId) {
+ public ExecutionContext findExecutionContext(Long executionId) {
return null;
}
- public void saveExecutionAttributes(Long executionId,
- ExecutionAttributes executionAttributes) {
+ public void saveExecutionContext(Long executionId,
+ ExecutionContext executionContext) {
}
- public void updateExecutionAttributes(Long executionId,
- ExecutionAttributes executionAttributes) {
+ public void updateExecutionContext(Long executionId,
+ ExecutionContext executionContext) {
}
public StepExecution getLastStepExecution(StepInstance stepInstance) {
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/StepExecutionDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/StepExecutionDao.java
index 9f1dd5b53..51217ebdb 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/StepExecutionDao.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/StepExecutionDao.java
@@ -4,7 +4,7 @@ import java.util.List;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
public interface StepExecutionDao {
@@ -55,33 +55,33 @@ public interface StepExecutionDao {
StepExecution getStepExecution(Long stepExecutionId, StepInstance stepInstance);
/**
- * Find all {@link ExecutionAttributes} for the given execution id.
+ * Find all {@link ExecutionContext} for the given execution id.
*
* @param executionId - Long id of the {@link StepExecution} that the
* attributes belongs to.
* @return attributes for the provided id. If none are found, an empty
- * {@link ExecutionAttributes} will be returned.
+ * {@link ExecutionContext} will be returned.
* @throws IllegalArgumentException if the id is null.
*/
- ExecutionAttributes findExecutionAttributes(final Long executionId);
+ ExecutionContext findExecutionContext(final Long executionId);
/**
- * Save the provided {@link ExecutionAttributes} for the given executionId.
+ * Save the provided {@link ExecutionContext} for the given executionId.
*
* @param executionId to be saved
- * @param executionAttributes to be saved.
+ * @param executionContext to be saved.
* @throws IllegalArgumentException if the executionId or attributes are
* null.
*/
- void saveExecutionAttributes(final Long executionId, final ExecutionAttributes executionAttributes);
+ void saveExecutionContext(final Long executionId, final ExecutionContext executionContext);
/**
- * Update the provided ExecutionAttributes.
+ * Update the provided ExecutionContext.
*
* @param executionId
- * @param executionAttributes
+ * @param executionContext
*/
- void updateExecutionAttributes(final Long executionId, ExecutionAttributes executionAttributes);
+ void updateExecutionContext(final Long executionId, ExecutionContext executionContext);
/**
* @return the last execution of the given instance
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/StepInstanceDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/StepInstanceDao.java
index 0a575d07b..a26544b45 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/StepInstanceDao.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/StepInstanceDao.java
@@ -35,12 +35,4 @@ public interface StepInstanceDao {
*/
StepInstance createStepInstance(JobInstance jobInstance, String stepName);
-// /**
-// * Update an existing StepInstance.
-// *
-// * Preconditions: StepInstance must have an ID.
-// *
-// * @param job
-// */
-// void updateStepInstance(StepInstance stepInstance);
}
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 428b33073..d74a47db8 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
@@ -26,7 +26,7 @@ import java.util.Set;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.item.ItemStream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.stream.StreamManager;
import org.springframework.batch.repeat.context.SynchronizedAttributeAccessor;
@@ -46,7 +46,7 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements
private StreamManager streamManager;
- private ExecutionAttributes executionAttributes;
+ private ExecutionContext executionContext;
/**
* Default constructor.
@@ -82,7 +82,7 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements
if (streamManager != null && (value instanceof ItemStream)) {
ItemStream stream = (ItemStream) value;
stream.open();
- streamManager.register(this, stream, executionAttributes);
+ streamManager.register(this, stream, executionContext);
}
}
@@ -193,17 +193,17 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes()
+ * @see org.springframework.batch.item.ExecutionContextProvider#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
- return streamManager.getExecutionAttributes(this);
+ public ExecutionContext getExecutionContext() {
+ return streamManager.getExecutionContext(this);
}
/* (non-Javadoc)
- * @see org.springframework.batch.execution.scope.StepContext#restoreFrom(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.execution.scope.StepContext#restoreFrom(org.springframework.batch.item.ExecutionContext)
*/
- public void restoreFrom(ExecutionAttributes executionAttributes) {
- this.executionAttributes = executionAttributes;
+ public void restoreFrom(ExecutionContext executionContext) {
+ this.executionContext = executionContext;
}
}
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 f3dc598ab..645b904aa 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
@@ -17,8 +17,8 @@ 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.ExecutionAttributesProvider;
+import org.springframework.batch.item.ExecutionContext;
+import org.springframework.batch.item.ExecutionContextProvider;
import org.springframework.core.AttributeAccessor;
/**
@@ -27,7 +27,7 @@ import org.springframework.core.AttributeAccessor;
* @author Dave Syer
*
*/
-public interface StepContext extends AttributeAccessor, ExecutionAttributesProvider {
+public interface StepContext extends AttributeAccessor, ExecutionContextProvider {
/**
* Accessor for the {@link StepExecution} associated with the currently
@@ -61,7 +61,7 @@ public interface StepContext extends AttributeAccessor, ExecutionAttributesProvi
* streams will simply not be initialised and repositioned for restart
* (which is sometimes desirable).
*
- * @param executionAttributes
+ * @param executionContext
*/
- void restoreFrom(ExecutionAttributes executionAttributes);
+ void restoreFrom(ExecutionContext executionContext);
}
\ No newline at end of file
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/ChunkedStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/ChunkedStep.java
index 25e708725..6d5962dc5 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/ChunkedStep.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/ChunkedStep.java
@@ -39,7 +39,7 @@ import org.springframework.batch.execution.scope.StepContext;
import org.springframework.batch.execution.scope.StepScope;
import org.springframework.batch.execution.scope.StepSynchronizationManager;
import org.springframework.batch.io.exception.BatchCriticalException;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemWriter;
@@ -271,11 +271,11 @@ public class ChunkedStep extends StepSupport implements InitializingBean{
// the conversation in StepScope
stepContext.setAttribute(StepScope.ID_KEY, stepExecution.getJobExecution().getId());
- final boolean saveExecutionAttributes = isSaveExecutionAttributes();
+ final boolean saveExecutionContext = isSaveExecutionContext();
- if (saveExecutionAttributes && isRestart && stepInstance.getLastExecution() != null) {
- stepExecution.setExecutionAttributes(stepInstance.getLastExecution().getExecutionAttributes());
- stepContext.restoreFrom(stepExecution.getExecutionAttributes());
+ if (saveExecutionContext && isRestart && stepInstance.getLastExecution() != null) {
+ stepExecution.setExecutionContext(stepInstance.getLastExecution().getExecutionContext());
+ stepContext.restoreFrom(stepExecution.getExecutionContext());
}
try {
@@ -371,8 +371,8 @@ public class ChunkedStep extends StepSupport implements InitializingBean{
// TODO: check that stepExecution can
// aggregate these contributions if they
// come in asynchronously.
- ExecutionAttributes statistics = stepContext.getExecutionAttributes();
- contribution.setExecutionAttributes(statistics);
+ ExecutionContext statistics = stepContext.getExecutionContext();
+ contribution.setExecutionContext(statistics);
contribution.incrementCommitCount();
// If the step operations are asynchronous then we need
@@ -384,8 +384,8 @@ public class ChunkedStep extends StepSupport implements InitializingBean{
// only if chunk was successful
stepExecution.apply(contribution);
- if (isSaveExecutionAttributes()) {
- stepExecution.setExecutionAttributes(stepContext.getExecutionAttributes());
+ if (isSaveExecutionContext()) {
+ stepExecution.setExecutionContext(stepContext.getExecutionContext());
}
jobRepository.saveOrUpdate(stepExecution);
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 e638a11b1..372a7d990 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
@@ -34,7 +34,7 @@ import org.springframework.batch.execution.scope.StepScope;
import org.springframework.batch.execution.scope.StepSynchronizationManager;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.io.exception.BatchCriticalException;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemRecoverer;
import org.springframework.batch.item.ItemStream;
@@ -302,11 +302,11 @@ public class SimpleStepExecutor implements InitializingBean {
// the conversation in StepScope
stepContext.setAttribute(StepScope.ID_KEY, stepExecution.getJobExecution().getId());
- final boolean saveExecutionAttributes = step.isSaveExecutionAttributes();
+ final boolean saveExecutionContext = step.isSaveExecutionContext();
- if (saveExecutionAttributes && isRestart && stepInstance.getLastExecution() != null) {
- stepExecution.setExecutionAttributes(stepInstance.getLastExecution().getExecutionAttributes());
- stepContext.restoreFrom(stepExecution.getExecutionAttributes());
+ if (saveExecutionContext && isRestart && stepInstance.getLastExecution() != null) {
+ stepExecution.setExecutionContext(stepInstance.getLastExecution().getExecutionContext());
+ stepContext.restoreFrom(stepExecution.getExecutionContext());
}
try {
@@ -336,8 +336,8 @@ public class SimpleStepExecutor implements InitializingBean {
// TODO: check that stepExecution can
// aggregate these contributions if they
// come in asynchronously.
- ExecutionAttributes statistics = stepContext.getExecutionAttributes();
- contribution.setExecutionAttributes(statistics);
+ ExecutionContext statistics = stepContext.getExecutionContext();
+ contribution.setExecutionContext(statistics);
contribution.incrementCommitCount();
// If the step operations are asynchronous then we need
@@ -349,8 +349,8 @@ public class SimpleStepExecutor implements InitializingBean {
// only if chunk was successful
stepExecution.apply(contribution);
- if (saveExecutionAttributes) {
- stepExecution.setExecutionAttributes(stepContext.getExecutionAttributes());
+ if (saveExecutionContext) {
+ stepExecution.setExecutionContext(stepContext.getExecutionContext());
}
jobRepository.saveOrUpdate(stepExecution);
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncherTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncherTests.java
index 0a88e8d3b..c3960c299 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncherTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncherTests.java
@@ -32,7 +32,7 @@ import org.springframework.batch.core.repository.JobExecutionAlreadyRunningExcep
import org.springframework.batch.core.runtime.JobParametersFactory;
import org.springframework.batch.execution.configuration.MapJobRegistry;
import org.springframework.batch.execution.launch.JobLauncher;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.support.PropertiesConverter;
/**
@@ -53,7 +53,7 @@ public class SimpleExportedJobLauncherTests extends TestCase {
public JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException {
JobExecution result = new JobExecution(null);
StepExecution stepExecution = result.createStepExecution(new StepInstance(null, "step"));
- stepExecution.setExecutionAttributes(new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")));
+ stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
list.add(jobParameters);
return result;
}
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 0d7be4195..7a48833af 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,7 @@ 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.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
public class MockStepDao implements StepDao {
@@ -72,16 +72,16 @@ public class MockStepDao implements StepDao {
return null;
}
- public ExecutionAttributes findExecutionAttributes(Long executionId) {
+ public ExecutionContext findExecutionContext(Long executionId) {
return null;
}
- public void saveExecutionAttributes(Long executionId,
- ExecutionAttributes executionAttributes) {
+ public void saveExecutionContext(Long executionId,
+ ExecutionContext executionContext) {
}
- public void updateExecutionAttributes(Long executionId,
- ExecutionAttributes executionAttributes) {
+ public void updateExecutionContext(Long executionId,
+ ExecutionContext executionContext) {
}
public StepExecution getStepExecution(Long stepExecutionId,
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 5f6c11c7f..24d3cd1b2 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
@@ -37,7 +37,7 @@ import org.springframework.batch.core.domain.StepSupport;
import org.springframework.batch.core.repository.BatchRestartException;
import org.springframework.batch.execution.repository.dao.JobDao;
import org.springframework.batch.execution.repository.dao.StepDao;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
/**
* Test SimpleJobRepository. The majority of test cases are tested using
@@ -77,7 +77,7 @@ public class SimpleJobRepositoryTests extends TestCase {
List steps;
- ExecutionAttributes executionAttributes;
+ ExecutionContext executionContext;
private JobExecution jobExecution;
@@ -120,7 +120,7 @@ public class SimpleJobRepositoryTests extends TestCase {
steps.add(databaseStep1);
steps.add(databaseStep2);
- executionAttributes = new ExecutionAttributes();
+ executionContext = new ExecutionContext();
}
/*
@@ -180,16 +180,16 @@ public class SimpleJobRepositoryTests extends TestCase {
stepDaoControl.setReturnValue(databaseStep1);
stepDao.getLastStepExecution(databaseStep1);
stepDaoControl.setReturnValue(databaseStep1Exec);
- stepDao.findExecutionAttributes(databaseStep1Exec.getId());
- stepDaoControl.setReturnValue(executionAttributes);
+ stepDao.findExecutionContext(databaseStep1Exec.getId());
+ stepDaoControl.setReturnValue(executionContext);
stepDao.getStepExecutionCount(databaseStep1);
stepDaoControl.setReturnValue(1);
stepDao.findStepInstance(databaseJob, "TestStep2");
stepDaoControl.setReturnValue(databaseStep2);
stepDao.getLastStepExecution(databaseStep2);
stepDaoControl.setReturnValue(databaseStep2Exec);
- stepDao.findExecutionAttributes(databaseStep2Exec.getId());
- stepDaoControl.setReturnValue(executionAttributes);
+ stepDao.findExecutionContext(databaseStep2Exec.getId());
+ stepDaoControl.setReturnValue(executionContext);
stepDao.getStepExecutionCount(databaseStep2);
stepDaoControl.setReturnValue(1);
stepDaoControl.replay();
@@ -259,16 +259,16 @@ public class SimpleJobRepositoryTests extends TestCase {
stepDaoControl.setReturnValue(databaseStep1);
stepDao.getLastStepExecution(databaseStep1);
stepDaoControl.setReturnValue(databaseStep1Exec);
- stepDao.findExecutionAttributes(databaseStep1Exec.getId());
- stepDaoControl.setReturnValue(executionAttributes);
+ stepDao.findExecutionContext(databaseStep1Exec.getId());
+ stepDaoControl.setReturnValue(executionContext);
stepDao.getStepExecutionCount(databaseStep1);
stepDaoControl.setReturnValue(1);
stepDao.findStepInstance(databaseJob, "TestStep2");
stepDaoControl.setReturnValue(databaseStep2);
stepDao.getLastStepExecution(databaseStep2);
stepDaoControl.setReturnValue(databaseStep2Exec);
- stepDao.findExecutionAttributes(databaseStep2Exec.getId());
- stepDaoControl.setReturnValue(executionAttributes);
+ stepDao.findExecutionContext(databaseStep2Exec.getId());
+ stepDaoControl.setReturnValue(executionContext);
stepDao.getStepExecutionCount(databaseStep2);
stepDaoControl.setReturnValue(1);
stepDaoControl.replay();
@@ -359,10 +359,10 @@ public class SimpleJobRepositoryTests extends TestCase {
public void testUpdateStepExecution() {
StepExecution stepExecution = new StepExecution(new StepInstance(new Long(10L)), null, new Long(1));
stepExecution.setId(new Long(11));
- ExecutionAttributes executionAttributes = new ExecutionAttributes();
- stepExecution.setExecutionAttributes(executionAttributes);
+ ExecutionContext executionContext = new ExecutionContext();
+ stepExecution.setExecutionContext(executionContext);
stepDao.updateStepExecution(stepExecution);
- stepDao.updateExecutionAttributes(stepExecution.getId(), executionAttributes);
+ stepDao.updateExecutionContext(stepExecution.getId(), executionContext);
stepDaoControl.replay();
jobRepository.saveOrUpdate(stepExecution);
stepDaoControl.verify();
@@ -370,10 +370,10 @@ public class SimpleJobRepositoryTests extends TestCase {
public void testSaveExistingStepExecution() {
StepExecution stepExecution = new StepExecution(new StepInstance(new Long(10L)), new JobExecution(null), null);
- ExecutionAttributes executionAttributes = new ExecutionAttributes();
- stepExecution.setExecutionAttributes(executionAttributes);
+ ExecutionContext executionContext = new ExecutionContext();
+ stepExecution.setExecutionContext(executionContext);
stepDao.saveStepExecution(stepExecution);
- stepDao.saveExecutionAttributes(stepExecution.getId(), executionAttributes);
+ stepDao.saveExecutionContext(stepExecution.getId(), executionContext);
stepDaoControl.replay();
jobRepository.saveOrUpdate(stepExecution);
stepDaoControl.verify();
@@ -397,7 +397,7 @@ public class SimpleJobRepositoryTests extends TestCase {
* Test to ensure that if a StepDao returns invalid restart data, it is
* corrected.
*/
- public void testCreateStepsFixesInvalidExecutionAttributes() throws Exception {
+ public void testCreateStepsFixesInvalidExecutionContext() throws Exception {
List jobs = new ArrayList();
@@ -430,7 +430,7 @@ public class SimpleJobRepositoryTests extends TestCase {
assertTrue(step.equals(databaseStep2));
}
- public void testFindStepsFixesInvalidExecutionAttributes() throws Exception {
+ public void testFindStepsFixesInvalidExecutionContext() throws Exception {
StepExecution databaseStep1Exec = new StepExecution(databaseStep1, null, new Long(1));
StepExecution databaseStep2Exec = new StepExecution(databaseStep2, null, new Long(2));
@@ -443,16 +443,16 @@ public class SimpleJobRepositoryTests extends TestCase {
stepDaoControl.setReturnValue(databaseStep1);
stepDao.getLastStepExecution(databaseStep1);
stepDaoControl.setReturnValue(databaseStep1Exec);
- stepDao.findExecutionAttributes(databaseStep1Exec.getId());
- stepDaoControl.setReturnValue(executionAttributes);
+ stepDao.findExecutionContext(databaseStep1Exec.getId());
+ stepDaoControl.setReturnValue(executionContext);
stepDao.getStepExecutionCount(databaseStep1);
stepDaoControl.setReturnValue(1);
stepDao.findStepInstance(databaseJob, "TestStep2");
stepDaoControl.setReturnValue(databaseStep2);
stepDao.getLastStepExecution(databaseStep2);
stepDaoControl.setReturnValue(databaseStep2Exec);
- stepDao.findExecutionAttributes(databaseStep2Exec.getId());
- stepDaoControl.setReturnValue(executionAttributes);
+ stepDao.findExecutionContext(databaseStep2Exec.getId());
+ stepDaoControl.setReturnValue(executionContext);
stepDao.getStepExecutionCount(databaseStep2);
stepDaoControl.setReturnValue(1);
stepDaoControl.replay();
@@ -477,9 +477,9 @@ public class SimpleJobRepositoryTests extends TestCase {
Iterator it = jobSteps.iterator();
StepInstance step = (StepInstance) it.next();
assertTrue(step.equals(databaseStep1));
- assertTrue(step.getLastExecution().getExecutionAttributes().isEmpty());
+ assertTrue(step.getLastExecution().getExecutionContext().isEmpty());
step = (StepInstance) it.next();
- assertTrue(step.getLastExecution().getExecutionAttributes().isEmpty());
+ assertTrue(step.getLastExecution().getExecutionContext().isEmpty());
assertTrue(step.equals(databaseStep2));
}
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 f40950638..7663cdbaf 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
@@ -27,7 +27,7 @@ import org.springframework.batch.core.domain.JobSupport;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.support.PropertiesConverter;
import org.springframework.dao.OptimisticLockingFailureException;
@@ -64,7 +64,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
protected JobParameters jobParameters = new JobParameters();
- protected ExecutionAttributes executionAttributes;
+ protected ExecutionContext executionContext;
public void setJobInstanceDao(JobInstanceDao jobInstanceDao) {
this.jobInstanceDao = jobInstanceDao;
@@ -109,11 +109,11 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
step1.setLastExecution(stepExecution);
//stepInstanceDao.updateStepInstance(step1);
- executionAttributes = new ExecutionAttributes();
- executionAttributes.putString("1", "testString1");
- executionAttributes.putString("2", "testString2");
- executionAttributes.putLong("3", 3);
- executionAttributes.putDouble("4", 4.4);
+ executionContext = new ExecutionContext();
+ executionContext.putString("1", "testString1");
+ executionContext.putString("2", "testString2");
+ executionContext.putLong("3", 3);
+ executionContext.putDouble("4", 4.4);
}
@@ -163,20 +163,20 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
assertEquals(step3, tempStep);
}
- public void testUpdateStepWithoutExecutionAttributes() {
+ public void testUpdateStepWithoutExecutionContext() {
//stepInstanceDao.updateStepInstance(step1);
StepInstance tempStep = stepInstanceDao.findStepInstance(jobInstance, step1.getName());
assertEquals(tempStep, step1);
}
- public void testUpdateStepWithExecutionAttributes() {
+ public void testUpdateStepWithExecutionContext() {
- stepExecutionDao.saveExecutionAttributes(step1.getId(), executionAttributes);
+ stepExecutionDao.saveExecutionContext(step1.getId(), executionContext);
StepInstance tempStep = stepInstanceDao.findStepInstance(jobInstance, step1.getName());
- ExecutionAttributes tempAttributes = stepExecutionDao.findExecutionAttributes(step1.getId());
+ ExecutionContext tempAttributes = stepExecutionDao.findExecutionContext(step1.getId());
assertEquals(tempStep, step1);
- assertEquals(executionAttributes, tempAttributes);
+ assertEquals(executionContext, tempAttributes);
}
public void testSaveStepExecution() {
@@ -184,7 +184,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
StepExecution execution = new StepExecution(step2, jobExecution, null);
execution.setStatus(BatchStatus.STARTED);
execution.setStartTime(new Date(System.currentTimeMillis()));
- execution.setExecutionAttributes(new ExecutionAttributes(PropertiesConverter.stringToProperties("key1=0,key2=5")));
+ execution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("key1=0,key2=5")));
execution.setExitStatus(new ExitStatus(false, ExitStatusExceptionClassifier.FATAL_EXCEPTION,
"java.lang.Exception"));
stepExecutionDao.saveStepExecution(execution);
@@ -192,7 +192,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
assertEquals(1, executions.size());
StepExecution tempExecution = (StepExecution) executions.get(0);
assertEquals(execution, tempExecution);
- assertEquals(execution.getExecutionAttributes().getString("key1"), tempExecution.getExecutionAttributes().getString("key1"));
+ assertEquals(execution.getExecutionContext().getString("key1"), tempExecution.getExecutionContext().getString("key1"));
assertEquals(execution.getExitStatus(), tempExecution.getExitStatus());
}
@@ -202,7 +202,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
stepExecution.setEndTime(new Date(System.currentTimeMillis()));
stepExecution.setCommitCount(5);
stepExecution.setTaskCount(5);
- stepExecution.setExecutionAttributes(new ExecutionAttributes());
+ stepExecution.setExecutionContext(new ExecutionContext());
stepExecution.setExitStatus(new ExitStatus(false, ExitStatusExceptionClassifier.FATAL_EXCEPTION,
"java.lang.Exception"));
stepExecutionDao.updateStepExecution(stepExecution);
@@ -262,15 +262,15 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
}
}
- public void testSaveExecutionAttributes(){
+ public void testSaveExecutionContext(){
- stepExecutionDao.saveExecutionAttributes(stepExecution.getId(), executionAttributes);
- ExecutionAttributes attributes = stepExecutionDao.findExecutionAttributes(stepExecution.getId());
- assertEquals(executionAttributes, attributes);
- executionAttributes.putString("newString", "newString");
- stepExecutionDao.updateExecutionAttributes(stepExecution.getId(), executionAttributes);
- attributes = stepExecutionDao.findExecutionAttributes(stepExecution.getId());
- assertEquals(executionAttributes, attributes);
+ stepExecutionDao.saveExecutionContext(stepExecution.getId(), executionContext);
+ ExecutionContext attributes = stepExecutionDao.findExecutionContext(stepExecution.getId());
+ assertEquals(executionContext, attributes);
+ executionContext.putString("newString", "newString");
+ stepExecutionDao.updateExecutionContext(stepExecution.getId(), executionContext);
+ attributes = stepExecutionDao.findExecutionContext(stepExecution.getId());
+ assertEquals(executionContext, attributes);
}
public void testGetLastStepExecution() {
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 246fdace4..f5107ef16 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
@@ -25,7 +25,7 @@ import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
public class MapStepDaoTests extends TestCase {
@@ -103,17 +103,17 @@ public class MapStepDaoTests extends TestCase {
assertEquals(2, dao.getStepExecutionCount(step));
}
- public void testSaveExecutionAttributes() throws Exception {
- assertEquals(null, dao.getExecutionAttributes(step.getId()));
+ public void testSaveExecutionContext() throws Exception {
+ assertEquals(null, dao.getExecutionContext(step.getId()));
Properties data = new Properties();
data.setProperty("restart.key1", "restartData");
- ExecutionAttributes executionAttributes = new ExecutionAttributes(data);
+ ExecutionContext executionContext = new ExecutionContext(data);
StepExecution stepExecution = new StepExecution(step, null, null);
- stepExecution.setExecutionAttributes(executionAttributes);
+ stepExecution.setExecutionContext(executionContext);
dao.saveStepExecution(stepExecution);
StepExecution tempExecution = dao.getStepExecution(stepExecution.getId(), step);
assertEquals(tempExecution, stepExecution);
- assertEquals(stepExecution.getExecutionAttributes(), tempExecution.getExecutionAttributes());
+ assertEquals(stepExecution.getExecutionContext(), tempExecution.getExecutionContext());
}
}
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 cc431d521..389507c31 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
@@ -24,7 +24,7 @@ import junit.framework.TestCase;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.item.ItemStream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.stream.ItemStreamAdapter;
import org.springframework.batch.item.stream.SimpleStreamManager;
import org.springframework.batch.support.PropertiesConverter;
@@ -133,11 +133,11 @@ public class SimpleStepContextTests extends TestCase {
assertTrue(list.contains("spam"));
}
- public void testExecutionAttributesWithNotNullService() throws Exception {
+ public void testExecutionContextWithNotNullService() throws Exception {
Map map = new HashMap();
context = new SimpleStepContext(null, null, new StubStreamManager(map));
- assertEquals(1, context.getExecutionAttributes().getProperties().size());
- assertEquals("bar", context.getExecutionAttributes().getProperties().getProperty("foo"));
+ assertEquals(1, context.getExecutionContext().getProperties().size());
+ assertEquals("bar", context.getExecutionContext().getProperties().getProperty("foo"));
}
public void testStreamManagerRegistration() throws Exception {
@@ -164,18 +164,18 @@ public class SimpleStepContextTests extends TestCase {
public void close(Object key) {
}
- public ExecutionAttributes getExecutionAttributes(Object key) {
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar"));
+ public ExecutionContext getExecutionContext(Object key) {
+ return new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar"));
}
public void open(Object key) {
}
- public void register(Object key, ItemStream stream, ExecutionAttributes executionAttributes) {
+ public void register(Object key, ItemStream stream, ExecutionContext executionContext) {
map.put(key, stream);
}
- public void restoreFrom(Object key, ExecutionAttributes data) {
+ public void restoreFrom(Object key, ExecutionContext data) {
}
}
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 386b020ef..71b727d1c 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,12 +103,12 @@ public class SimpleStepConfigurationTests extends TestCase {
}
/**
- * Test method for {@link org.springframework.batch.execution.step.simple.AbstractStep#isSaveExecutionAttributes()}.
+ * Test method for {@link org.springframework.batch.execution.step.simple.AbstractStep#isSaveExecutionContext()}.
*/
- public void testIsSaveExecutionAttributes() {
- assertEquals(false, configuration.isSaveExecutionAttributes());
- configuration.setSaveExecutionAttributes(true);
- assertEquals(true, configuration.isSaveExecutionAttributes());
+ public void testIsSaveExecutionContext() {
+ assertEquals(false, configuration.isSaveExecutionContext());
+ configuration.setSaveExecutionContext(true);
+ assertEquals(true, configuration.isSaveExecutionContext());
}
}
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 bcdef0e75..20af14203 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
@@ -38,7 +38,7 @@ import org.springframework.batch.execution.repository.dao.MapJobDao;
import org.springframework.batch.execution.repository.dao.MapStepDao;
import org.springframework.batch.execution.scope.StepScope;
import org.springframework.batch.execution.scope.StepSynchronizationManager;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.exception.ResetFailedException;
@@ -283,7 +283,7 @@ public class SimpleStepExecutorTests extends TestCase {
StepInstance step = new StepInstance(new Long(1));
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepExecutor.setItemReader(tasklet);
- stepConfiguration.setSaveExecutionAttributes(true);
+ stepConfiguration.setSaveExecutionContext(true);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -302,12 +302,12 @@ public class SimpleStepExecutorTests extends TestCase {
step.setStepExecutionCount(1);
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepExecutor.setItemReader(tasklet);
- stepConfiguration.setSaveExecutionAttributes(true);
+ stepConfiguration.setSaveExecutionContext(true);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
stepExecution
- .setExecutionAttributes(new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")));
+ .setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
step.setLastExecution(stepExecution);
stepExecutor.execute(stepExecution);
@@ -326,7 +326,7 @@ public class SimpleStepExecutorTests extends TestCase {
step.setStepExecutionCount(1);
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepConfiguration.setItemReader(tasklet);
- stepConfiguration.setSaveExecutionAttributes(false);
+ stepConfiguration.setSaveExecutionContext(false);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -354,7 +354,7 @@ public class SimpleStepExecutorTests extends TestCase {
return ExitStatus.FINISHED;
}
});
- stepConfiguration.setSaveExecutionAttributes(true);
+ stepConfiguration.setSaveExecutionContext(true);
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecution);
@@ -408,17 +408,17 @@ public class SimpleStepExecutorTests extends TestCase {
return ExitStatus.FINISHED;
}
});
- stepConfiguration.setSaveExecutionAttributes(true);
+ stepConfiguration.setSaveExecutionContext(true);
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecution);
- assertEquals(false, stepExecution.getExecutionAttributes().containsKey("foo"));
+ assertEquals(false, stepExecution.getExecutionContext().containsKey("foo"));
final Map map = new HashMap();
stepExecutor.setStreamManager(new SimpleStreamManager(new ResourcelessTransactionManager()) {
- public ExecutionAttributes getExecutionAttributes(Object key) {
+ public ExecutionContext getExecutionContext(Object key) {
// TODO Auto-generated method stub
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar"));
+ return new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar"));
}
});
@@ -426,7 +426,7 @@ public class SimpleStepExecutorTests extends TestCase {
// At least once in that process the statistics service was asked for
// statistics...
- assertEquals("bar", stepExecution.getExecutionAttributes().getString("foo"));
+ assertEquals("bar", stepExecution.getExecutionContext().getString("foo"));
// ...but nothing was registered because nothing with step scoped.
assertEquals(0, map.size());
}
@@ -448,12 +448,12 @@ public class SimpleStepExecutorTests extends TestCase {
return restoreFromCalledWithSomeContext;
}
- public ExecutionAttributes getExecutionAttributes() {
+ public ExecutionContext getExecutionContext() {
getExecutionAttributesCalled = true;
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("spam=bucket"));
+ return new ExecutionContext(PropertiesConverter.stringToProperties("spam=bucket"));
}
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
restoreFromCalled = true;
restoreFromCalledWithSomeContext = data.getProperties().size() > 0;
}
@@ -507,7 +507,7 @@ public class SimpleStepExecutorTests extends TestCase {
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
stepExecution
- .setExecutionAttributes(new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")));
+ .setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
step.setLastExecution(stepExecution);
try {
@@ -544,7 +544,7 @@ public class SimpleStepExecutorTests extends TestCase {
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
stepExecution
- .setExecutionAttributes(new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar")));
+ .setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
step.setLastExecution(stepExecution);
try {
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 4ad2ab088..ec419cb87 100644
--- a/spring-batch-execution/src/test/resources/simple-container-definition.xml
+++ b/spring-batch-execution/src/test/resources/simple-container-definition.xml
@@ -28,7 +28,7 @@
class="org.springframework.batch.execution.step.simple.SimpleStep"
abstract="true">
-
+
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 915b172db..3fc7b0a70 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
@@ -24,7 +24,7 @@ import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
import org.springframework.batch.io.Skippable;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.reader.AbstractItemStreamItemReader;
@@ -167,23 +167,23 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
}
/**
- * @return the current row number wrapped as {@link ExecutionAttributes}
+ * @return the current row number wrapped as {@link ExecutionContext}
*/
- public ExecutionAttributes getExecutionAttributes() {
+ public ExecutionContext getExecutionContext() {
Properties props = new Properties();
props.setProperty(RESTART_DATA_ROW_NUMBER_KEY, "" + currentProcessedRow);
- ExecutionAttributes executionAttributes = new ExecutionAttributes();
- executionAttributes.putString(RESTART_DATA_ROW_NUMBER_KEY, "" + currentProcessedRow);
+ ExecutionContext executionContext = new ExecutionContext();
+ executionContext.putString(RESTART_DATA_ROW_NUMBER_KEY, "" + currentProcessedRow);
String skipped = skippedRows.toString();
- executionAttributes.putString(SKIPPED_ROWS, skipped.substring(1, skipped.length() - 1));
- return executionAttributes;
+ executionContext.putString(SKIPPED_ROWS, skipped.substring(1, skipped.length() - 1));
+ return executionContext;
}
/**
* Sets the cursor to the received row number.
*/
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
Assert.state(!initialized, "Cannot restore when already intialized. Call close() first before restore()");
Properties props = data.getProperties();
@@ -229,7 +229,7 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.stream.ItemStreamAdapter#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.stream.ItemStreamAdapter#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
lastCommitRowNumber = currentProcessedRow;
@@ -240,7 +240,7 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.stream.ItemStreamAdapter#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.stream.ItemStreamAdapter#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() {
currentProcessedRow = lastCommitRowNumber;
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 14382397f..fe14c643b 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
@@ -30,7 +30,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.io.support.AbstractTransactionalIoSource;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.KeyedItemReader;
import org.springframework.batch.item.exception.ResetFailedException;
@@ -71,7 +71,7 @@ import org.springframework.util.StringUtils;
*
*
*
- * {@link ExecutionAttributes}: The current row is returned as restart data,
+ * {@link ExecutionContext}: The current row is returned as restart data,
* and when restored from that same data, the cursor is opened and the current
* row set to the value within the restart data. There are also two statistics
* returned by this input source: the current line being processed and the
@@ -378,11 +378,11 @@ public class JdbcCursorItemReader extends AbstractTransactionalIoSource implemen
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.stream.ItemStreamAdapter#getExecutionAttributes()
+ * @see org.springframework.batch.item.stream.ItemStreamAdapter#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
+ public ExecutionContext getExecutionContext() {
String skipped = skippedRows.toString();
- ExecutionAttributes context = new ExecutionAttributes();
+ ExecutionContext context = new ExecutionContext();
context.putString(SKIPPED_ROWS, skipped.substring(1, skipped.length() - 1));
context.putLong(CURRENT_PROCESSED_ROW, currentProcessedRow);
context.putLong(SKIP_COUNT, skipCount);
@@ -391,9 +391,9 @@ public class JdbcCursorItemReader extends AbstractTransactionalIoSource implemen
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.stream.ItemStreamAdapter#restoreFrom(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.stream.ItemStreamAdapter#restoreFrom(org.springframework.batch.item.ExecutionContext)
*/
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
Assert.state(!initialized);
if (data == null)
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 7b8650f17..5629c9bd0 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
@@ -19,7 +19,7 @@ import java.util.Iterator;
import java.util.List;
import org.springframework.batch.io.support.AbstractTransactionalIoSource;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.KeyedItemReader;
import org.springframework.beans.factory.InitializingBean;
@@ -147,7 +147,7 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource implem
* 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 {@link ExecutionAttributes} attempting to be
+ * data could be returned. The {@link ExecutionContext} attempting to be
* restored from must have been obtained from the same input source
* as the one being restored from otherwise it is invalid.
*
@@ -156,10 +156,10 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource implem
* @throws IllegalStateException if the input source has already been
* initialized.
*/
- public final void restoreFrom(ExecutionAttributes data) {
+ public final void restoreFrom(ExecutionContext data) {
- Assert.notNull(data, "ExecutionAttributes must not be null.");
- Assert.notNull(data.getProperties(), "ExecutionAttributes properties must not be null.");
+ Assert.notNull(data, "ExecutionContext must not be null.");
+ Assert.notNull(data.getProperties(), "ExecutionContext properties must not be null.");
Assert.state(!initialized, "Cannot restore when already intialized. Call" + " close() first before restore()");
if (data.getProperties().size() == 0) {
@@ -174,8 +174,8 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource implem
}
}
- public ExecutionAttributes getExecutionAttributes() {
- return keyGenerator.getKeyAsExecutionAttributes(getCurrentKey());
+ public ExecutionContext getExecutionContext() {
+ return keyGenerator.getKeyAsExecutionContext(getCurrentKey());
}
public void afterPropertiesSet() throws Exception {
@@ -223,7 +223,7 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource implem
/*
* (non-Javadoc)
*
- * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
lastCommitIndex = currentIndex;
@@ -232,7 +232,7 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource implem
/*
* (non-Javadoc)
*
- * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() {
keysIterator = keys.listIterator(lastCommitIndex);
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 ef04d45ef..bf4e8c06a 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
@@ -2,7 +2,7 @@ package org.springframework.batch.io.driving;
import java.util.List;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
/**
* Strategy interface used to generate keys in driving query input.
@@ -20,19 +20,19 @@ public interface KeyGenerator {
/**
* Restore the keys list based on provided restart data.
*
- * @param executionAttributes, the restart data to restore the keys list from.
+ * @param executionContext, the restart data to restore the keys list from.
* @return a list of keys.
- * @throws IllegalArgumentException is executionAttributes is null.
+ * @throws IllegalArgumentException if executionContext is null.
*/
- List restoreKeys(ExecutionAttributes executionAttributes);
+ List restoreKeys(ExecutionContext executionContext);
/**
* Return the provided key as restart data.
*
* @param key to be converted to restart data.
- * @return {@link ExecutionAttributes} representation of the key.
+ * @return {@link ExecutionContext} representation of the key.
* @throws IllegalArgumentException if key is null.
* @throws IllegalArgumentException if key is an incompatible type.
*/
- ExecutionAttributes getKeyAsExecutionAttributes(Object key);
+ ExecutionContext getKeyAsExecutionContext(Object key);
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapExecutionAttributesRowMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapExecutionContextRowMapper.java
similarity index 76%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapExecutionAttributesRowMapper.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapExecutionContextRowMapper.java
index e6391859e..d9c22b521 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapExecutionAttributesRowMapper.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ColumnMapExecutionContextRowMapper.java
@@ -12,7 +12,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.core.CollectionFactory;
import org.springframework.jdbc.core.ColumnMapRowMapper;
import org.springframework.jdbc.core.PreparedStatementSetter;
@@ -23,8 +23,8 @@ import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
/**
- *
Extension of the ColumnMapRowMapper that converts a column map to {@link ExecutionAttributes} and allows
- * {@link ExecutionAttributes} to be converted back as a PreparedStatementSetter. This is useful in a restart
+ * Extension of the ColumnMapRowMapper that converts a column map to {@link ExecutionContext} and allows
+ * {@link ExecutionContext} to be converted back as a PreparedStatementSetter. This is useful in a restart
* scenario, as it allows for the standard functionality of the ColumnMapRowMapper to be used to
* create a map representing the columns returned by a query. It should be noted that this column ordering
* is preserved in the map using a link list version of Map.
@@ -32,15 +32,15 @@ import org.springframework.util.ClassUtils;
*
* @author Lucas Ward
* @author Dave Syer
- * @see ExecutionAttributesRowMapper
+ * @see ExecutionContextRowMapper
*/
-public class ColumnMapExecutionAttributesRowMapper extends ColumnMapRowMapper implements ExecutionAttributesRowMapper {
+public class ColumnMapExecutionContextRowMapper extends ColumnMapRowMapper implements ExecutionContextRowMapper {
- public static final String KEY_PREFIX = ClassUtils.getQualifiedName(ColumnMapExecutionAttributesRowMapper.class) + ".KEY.";
+ public static final String KEY_PREFIX = ClassUtils.getQualifiedName(ColumnMapExecutionContextRowMapper.class) + ".KEY.";
- public PreparedStatementSetter createSetter(ExecutionAttributes executionAttributes) {
+ public PreparedStatementSetter createSetter(ExecutionContext executionContext) {
- ColumnMapExecutionAttributes columnData = new ColumnMapExecutionAttributes(executionAttributes.getProperties());
+ ColumnMapExecutionContext columnData = new ColumnMapExecutionContext(executionContext.getProperties());
List columns = new ArrayList();
for (Iterator iterator = columnData.keys.entrySet().iterator(); iterator.hasNext();) {
@@ -52,21 +52,21 @@ public class ColumnMapExecutionAttributesRowMapper extends ColumnMapRowMapper im
return new ArgPreparedStatementSetter(columns.toArray());
}
- public ExecutionAttributes createExecutionAttributes(Object key) {
- Assert.isInstanceOf(Map.class, key, "Input to create ExecutionAttributes must be of type Map.");
+ public ExecutionContext createExecutionContext(Object key) {
+ Assert.isInstanceOf(Map.class, key, "Input to create ExecutionContext must be of type Map.");
Map keys = (Map) key;
- return new ColumnMapExecutionAttributes(keys);
+ return new ColumnMapExecutionContext(keys);
}
- private static class ColumnMapExecutionAttributes extends ExecutionAttributes {
+ private static class ColumnMapExecutionContext extends ExecutionContext {
private final Map keys;
- public ColumnMapExecutionAttributes(Map keys) {
+ public ColumnMapExecutionContext(Map keys) {
this.keys = keys;
}
- public ColumnMapExecutionAttributes(Properties props) {
+ public ColumnMapExecutionContext(Properties props) {
keys = CollectionFactory.createLinkedCaseInsensitiveMapIfPossible(props.size());
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ExecutionAttributesRowMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ExecutionContextRowMapper.java
similarity index 62%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ExecutionAttributesRowMapper.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ExecutionContextRowMapper.java
index 145b050c8..4170302c5 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ExecutionAttributesRowMapper.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/ExecutionContextRowMapper.java
@@ -15,39 +15,39 @@
*/
package org.springframework.batch.io.driving.support;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.RowMapper;
/**
- * {@link ExecutionAttributesRowMapper} extends the standard {@link RowMapper} interface to provide for
- * converting an object returned from a RowMapper to {@link ExecutionAttributes} and back again. One
+ * {@link ExecutionContextRowMapper} extends the standard {@link RowMapper} interface to provide for
+ * converting an object returned from a RowMapper to {@link ExecutionContext} and back again. One
* of the most common use cases for this type of functionality is the DrivingQuery approach
- * to sql processing. Using a {@link ExecutionAttributesRowMapper}, developers can create each unique key
+ * to sql processing. Using a {@link ExecutionContextRowMapper}, developers can create each unique key
* to suite their specific needs, and also describe how such a key would be converted to
- * {@link ExecutionAttributes}, so that it can be serialized and stored.
+ * {@link ExecutionContext}, so that it can be serialized and stored.
*
* @author Lucas Ward
* @see RowMapper
* @since 1.0
*/
-public interface ExecutionAttributesRowMapper extends RowMapper {
+public interface ExecutionContextRowMapper extends RowMapper {
/**
- * Given the provided composite key, return a {@link ExecutionAttributes} representation.
+ * Given the provided composite key, return a {@link ExecutionContext} representation.
*
* @param key
- * @return ExecutionAttributes representing the composite key.
+ * @return ExecutionContext representing the composite key.
* @throws IllegalArgumentException if key is null or of an unsupported type.
*/
- public ExecutionAttributes createExecutionAttributes(Object key);
+ public ExecutionContext createExecutionContext(Object key);
/**
* Given the provided restart data, return a PreparedStatementSeter that can
* be used as parameters to a JdbcTemplate.
*
- * @param executionAttributes
+ * @param executionContext
* @return an array of objects that can be used as arguments to a JdbcTemplate.
*/
- public PreparedStatementSetter createSetter(ExecutionAttributes executionAttributes);
+ public PreparedStatementSetter createSetter(ExecutionContext executionContext);
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/IbatisKeyGenerator.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/IbatisKeyGenerator.java
index d3d555965..b86aaed86 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/IbatisKeyGenerator.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/support/IbatisKeyGenerator.java
@@ -5,7 +5,7 @@ import java.util.Properties;
import org.springframework.batch.io.driving.DrivingQueryItemReader;
import org.springframework.batch.io.driving.KeyGenerator;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.util.Assert;
@@ -40,22 +40,22 @@ public class IbatisKeyGenerator implements KeyGenerator {
}
/* (non-Javadoc)
- * @see org.springframework.batch.io.driving.KeyGenerator#getKeyAsExecutionAttributes(java.lang.Object)
+ * @see org.springframework.batch.io.driving.KeyGenerator#getKeyAsExecutionContext(java.lang.Object)
*/
- public ExecutionAttributes getKeyAsExecutionAttributes(Object key) {
+ public ExecutionContext getKeyAsExecutionContext(Object key) {
Properties props = new Properties();
props.setProperty(RESTART_KEY, key.toString());
- ExecutionAttributes executionAttributes = new ExecutionAttributes();
- executionAttributes.putString(RESTART_KEY, key.toString());
- return executionAttributes;
+ ExecutionContext executionContext = new ExecutionContext();
+ executionContext.putString(RESTART_KEY, key.toString());
+ return executionContext;
}
/**
* Restore the keys list given the provided restart data.
*
- * @see org.springframework.batch.io.driving.DrivingQueryItemReader#restoreKeys(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.io.driving.DrivingQueryItemReader#restoreKeys(org.springframework.batch.item.ExecutionContext)
*/
- public List restoreKeys(ExecutionAttributes data) {
+ public List restoreKeys(ExecutionContext data) {
Properties props = data.getProperties();
Object key = props.getProperty(RESTART_KEY);
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 7e7c77d27..eec7406f0 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
@@ -20,7 +20,7 @@ import java.util.List;
import org.springframework.batch.io.driving.DrivingQueryItemReader;
import org.springframework.batch.io.driving.KeyGenerator;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -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 ExecutionAttributesRowMapper} to map each row in the resultset to an Object must be set in
+ * a {@link ExecutionContextRowMapper} 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 ExecutionAttributesRowMapper keyMapper = new ColumnMapExecutionAttributesRowMapper();
+ private ExecutionContextRowMapper keyMapper = new ColumnMapExecutionContextRowMapper();
private String sql;
@@ -78,27 +78,27 @@ public class MultipleColumnJdbcKeyGenerator implements
}
/* (non-Javadoc)
- * @see org.springframework.batch.io.driving.KeyGenerator#restoreKeys(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.io.driving.KeyGenerator#restoreKeys(org.springframework.batch.item.ExecutionContext)
*/
- public List restoreKeys(ExecutionAttributes executionAttributes) {
+ public List restoreKeys(ExecutionContext executionContext) {
Assert.state(keyMapper != null, "KeyMapper must not be null.");
Assert.state(StringUtils.hasText(restartSql), "The RestartQuery must not be null or empty" +
" in order to restart.");
- if (executionAttributes.getProperties() != null) {
- return jdbcTemplate.query(restartSql, keyMapper.createSetter(executionAttributes), keyMapper);
+ if (executionContext.getProperties() != null) {
+ return jdbcTemplate.query(restartSql, keyMapper.createSetter(executionContext), keyMapper);
}
return new ArrayList();
}
/* (non-Javadoc)
- * @see org.springframework.batch.io.driving.KeyGenerator#getKeyAsExecutionAttributes(java.lang.Object)
+ * @see org.springframework.batch.io.driving.KeyGenerator#getKeyAsExecutionContext(java.lang.Object)
*/
- public ExecutionAttributes getKeyAsExecutionAttributes(Object key) {
+ public ExecutionContext getKeyAsExecutionContext(Object key) {
Assert.state(keyMapper != null, "Kye mapper must not be null.");
- return keyMapper.createExecutionAttributes(key);
+ return keyMapper.createExecutionContext(key);
}
/**
@@ -121,12 +121,12 @@ public class MultipleColumnJdbcKeyGenerator implements
}
/**
- * Set the {@link ExecutionAttributesRowMapper} to be used to map a resultset
+ * Set the {@link ExecutionContextRowMapper} to be used to map a resultset
* to keys.
*
* @param keyMapper
*/
- public void setKeyMapper(ExecutionAttributesRowMapper keyMapper) {
+ public void setKeyMapper(ExecutionContextRowMapper 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 abed9d80c..66ccc90a3 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
@@ -20,7 +20,7 @@ import java.util.List;
import org.apache.commons.lang.ClassUtils;
import org.springframework.batch.io.driving.KeyGenerator;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.SingleColumnRowMapper;
@@ -95,36 +95,36 @@ public class SingleColumnJdbcKeyGenerator implements KeyGenerator {
/**
* Get the restart data representing the last processed key.
*
- * @see KeyGenerator#getKeyAsExecutionAttributes(Object)
+ * @see KeyGenerator#getKeyAsExecutionContext(Object)
* @throws IllegalArgumentException if key is null.
*/
- public ExecutionAttributes getKeyAsExecutionAttributes(Object key) {
+ public ExecutionContext getKeyAsExecutionContext(Object key) {
Assert.notNull(key, "The key must not be null.");
- ExecutionAttributes context = new ExecutionAttributes();
+ ExecutionContext context = new ExecutionContext();
context.putString(RESTART_KEY, key.toString());
return context;
}
/**
* Return the remaining to be processed for the provided
- * {@link ExecutionAttributes}. The {@link ExecutionAttributes} attempting to be
+ * {@link ExecutionContext}. The {@link ExecutionContext} attempting to be
* restored from must have been obtained from the same
* KeyGenerationStrategy as the one being restored from otherwise
* it is invalid.
*
- * @param executionAttributes {@link ExecutionAttributes} obtained by calling
- * {@link #getKeyAsExecutionAttributes(Object)} during a previous run.
+ * @param executionContext {@link ExecutionContext} obtained by calling
+ * {@link #getKeyAsExecutionContext(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.ExecutionAttributes)
+ * @see KeyGenerator#restoreKeys(org.springframework.batch.item.ExecutionContext)
*/
- public List restoreKeys(ExecutionAttributes executionAttributes) {
+ public List restoreKeys(ExecutionContext executionContext) {
- Assert.notNull(executionAttributes, "The restart data must not be null.");
+ Assert.notNull(executionContext, "The restart data must not be null.");
Assert.state(StringUtils.hasText(restartSql), "The RestartQuery must not be null or empty"
+ " in order to restart.");
- String lastProcessedKey = executionAttributes.getProperties().getProperty(RESTART_KEY);
+ String lastProcessedKey = executionContext.getProperties().getProperty(RESTART_KEY);
if (lastProcessedKey != null) {
return jdbcTemplate.query(restartSql, new Object[] { lastProcessedKey }, keyMapper);
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemReader.java
index 5bd701cea..f07beb5ce 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemReader.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemReader.java
@@ -32,7 +32,7 @@ import org.springframework.batch.io.file.separator.ResourceLineReader;
import org.springframework.batch.io.file.transform.AbstractLineTokenizer;
import org.springframework.batch.io.file.transform.DelimitedLineTokenizer;
import org.springframework.batch.io.file.transform.LineTokenizer;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.exception.StreamException;
@@ -184,9 +184,9 @@ public class FlatFileItemReader implements ItemReader, Skippable, ItemStream, In
* and position the buffer reader according to information provided by the
* restart data
*
- * @param data {@link ExecutionAttributes} information
+ * @param data {@link ExecutionContext} information
*/
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
if (data == null || data.getProperties() == null
|| data.getProperties().getProperty(READ_STATISTICS_NAME) == null || getReader() == null) {
@@ -213,14 +213,14 @@ public class FlatFileItemReader implements ItemReader, Skippable, ItemStream, In
* the current Line Count which can be used to reinitialise the batch job in
* case of restart.
*/
- public ExecutionAttributes getExecutionAttributes() {
+ public ExecutionContext getExecutionContext() {
if (reader == null) {
throw new StreamException("ItemStream not open or already closed.");
}
- ExecutionAttributes executionAttributes = new ExecutionAttributes();
- executionAttributes.putLong(READ_STATISTICS_NAME, reader.getPosition());
- executionAttributes.putLong(SKIPPED_STATISTICS_NAME, skippedLines.size());
- return executionAttributes;
+ ExecutionContext executionContext = new ExecutionContext();
+ executionContext.putLong(READ_STATISTICS_NAME, reader.getPosition());
+ executionContext.putLong(SKIPPED_STATISTICS_NAME, skippedLines.size());
+ return executionContext;
}
/**
@@ -237,7 +237,7 @@ public class FlatFileItemReader implements ItemReader, Skippable, ItemStream, In
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
getReader().mark();
@@ -245,7 +245,7 @@ public class FlatFileItemReader implements ItemReader, Skippable, ItemStream, In
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() {
getReader().reset();
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 d0123898b..c8cd5e5ce 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
@@ -31,7 +31,7 @@ import java.util.Properties;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.BatchEnvironmentException;
import org.springframework.batch.io.support.AbstractTransactionalIoSource;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.exception.ResetFailedException;
@@ -71,7 +71,7 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
private Resource resource;
- private ExecutionAttributes executionAttributes = new ExecutionAttributes();
+ private ExecutionContext executionContext = new ExecutionContext();
private OutputState state = null;
@@ -215,22 +215,22 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
}
/**
- * @see ItemStream#getExecutionAttributes()
+ * @see ItemStream#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
+ public ExecutionContext getExecutionContext() {
if (state == null) {
throw new StreamException("ItemStream not open or already closed.");
}
- executionAttributes.putLong(RESTART_DATA_NAME, state.position());
- executionAttributes.putLong(WRITTEN_STATISTICS_NAME, state.linesWritten);
- executionAttributes.putLong(RESTART_COUNT_STATISTICS_NAME, state.restartCount);
- return executionAttributes;
+ executionContext.putLong(RESTART_DATA_NAME, state.position());
+ executionContext.putLong(WRITTEN_STATISTICS_NAME, state.linesWritten);
+ executionContext.putLong(RESTART_COUNT_STATISTICS_NAME, state.restartCount);
+ return executionContext;
}
/**
- * @see ItemStream#restoreFrom(ExecutionAttributes)
+ * @see ItemStream#restoreFrom(ExecutionContext)
*/
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
if (data == null)
return;
getOutputState().restoreFrom(data.getProperties());
@@ -520,7 +520,7 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
/*
* (non-Javadoc)
- * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
getOutputState().mark();
@@ -528,7 +528,7 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
/*
* (non-Javadoc)
- * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() throws ResetFailedException {
try {
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 d4cede3ef..3143dc092 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
@@ -16,7 +16,7 @@ import org.springframework.batch.io.xml.stax.DefaultFragmentEventReader;
import org.springframework.batch.io.xml.stax.DefaultTransactionalEventReader;
import org.springframework.batch.io.xml.stax.FragmentEventReader;
import org.springframework.batch.io.xml.stax.TransactionalEventReader;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.exception.StreamException;
@@ -174,25 +174,25 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
/**
* @return wrapped count of records read so far.
- * @see ItemStream#getExecutionAttributes()
+ * @see ItemStream#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
- ExecutionAttributes executionAttributes = new ExecutionAttributes();
- executionAttributes.putLong(READ_COUNT_STATISTICS_NAME, currentRecordCount);
- return executionAttributes;
+ public ExecutionContext getExecutionContext() {
+ ExecutionContext executionContext = new ExecutionContext();
+ executionContext.putLong(READ_COUNT_STATISTICS_NAME, currentRecordCount);
+ return executionContext;
}
/**
* Restores the input source for the given restart data by rereading and
- * skipping the number of records stored in the {@link ExecutionAttributes}.
+ * skipping the number of records stored in the {@link ExecutionContext}.
*
- * @param ExecutionAttributes that holds the line count from the last
+ * @param ExecutionContext that holds the line count from the last
* commit.
* @throws IllegalStateException if the ItemReader has already been
* initialized or if the number of records to read and skip exceeds the
* available records.
*/
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
if (data == null || data.getProperties() == null || !data.containsKey(READ_COUNT_STATISTICS_NAME)) {
return;
@@ -263,7 +263,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
lastCommitPointRecordCount = currentRecordCount;
@@ -273,7 +273,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() {
currentRecordCount = lastCommitPointRecordCount;
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 f7e95c98f..786193848 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
@@ -15,7 +15,7 @@ import javax.xml.stream.XMLStreamException;
import org.springframework.batch.io.support.FileUtils;
import org.springframework.batch.io.xml.stax.NoStartEndDocumentStreamWriter;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.exception.StreamException;
@@ -352,13 +352,13 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
/**
* Get the restart data.
* @return the restart data
- * @see org.springframework.batch.item.ItemStream#getExecutionAttributes()
+ * @see org.springframework.batch.item.ItemStream#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
+ public ExecutionContext getExecutionContext() {
if (!initialized) {
throw new StreamException("ItemStream is not open, or may have been closed. Cannot access context.");
}
- ExecutionAttributes context = new ExecutionAttributes();
+ ExecutionContext context = new ExecutionContext();
context.putLong(RESTART_DATA_NAME, getPosition());
context.putLong(WRITE_STATISTICS_NAME, currentRecordCount);
return context;
@@ -367,9 +367,9 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
/**
* Restore processing from provided restart data.
* @param data the restart data
- * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.ExecutionContext)
*/
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
long startAtPosition = 0;
@@ -440,7 +440,7 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
lastCommitPointPosition = getPosition();
@@ -449,7 +449,7 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
/*
* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() {
currentRecordCount = lastCommitPointRecordCount;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributes.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java
similarity index 94%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributes.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java
index 17cc5548e..d27eda727 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributes.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java
@@ -34,17 +34,17 @@ import org.springframework.util.Assert;
*
* @author Lucas Ward
*/
-public class ExecutionAttributes {
+public class ExecutionContext {
private boolean dirty = false;
private final Map map;
- public ExecutionAttributes() {
+ public ExecutionContext() {
map = new HashMap();
}
- public ExecutionAttributes(Map map){
+ public ExecutionContext(Map map){
this.map = map;
}
@@ -137,13 +137,13 @@ public class ExecutionAttributes {
}
public boolean equals(Object obj) {
- if(obj instanceof ExecutionAttributes == false){
+ if(obj instanceof ExecutionContext == false){
return false;
}
if(this == obj){
return true;
}
- ExecutionAttributes rhs = (ExecutionAttributes)obj;
+ ExecutionContext rhs = (ExecutionContext)obj;
return this.entrySet().equals(rhs.entrySet());
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributesProvider.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContextProvider.java
similarity index 76%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributesProvider.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContextProvider.java
index d9991fd01..483021495 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributesProvider.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContextProvider.java
@@ -19,14 +19,14 @@ package org.springframework.batch.item;
* @author Dave Syer
*
*/
-public interface ExecutionAttributesProvider {
+public interface ExecutionContextProvider {
/**
- * Get {@link ExecutionAttributes} representing this object's current state.
+ * Get {@link ExecutionContext} representing this object's current state.
* Should not return null even if there is no state.
*
- * @return {@link ExecutionAttributes} representing current state.
+ * @return {@link ExecutionContext} representing current state.
*/
- ExecutionAttributes getExecutionAttributes();
+ ExecutionContext getExecutionContext();
}
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 e366d3dc9..eb256954c 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
@@ -27,27 +27,27 @@ import org.springframework.batch.item.exception.StreamException;
*
*
*
- * The state that is stored is represented as {@link ExecutionAttributes} which
+ * The state that is stored is represented as {@link ExecutionContext} 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 #getExecutionAttributes()} method will be given back to the
- * {@link #restoreFrom(ExecutionAttributes)} method, exactly as it was provided.
+ * {@link ExecutionContext} that is returned via the
+ * {@link #getExecutionContext()} method will be given back to the
+ * {@link #restoreFrom(ExecutionContext)} method, exactly as it was provided.
*
*
* @author Dave Syer
*
*/
-public interface ItemStream extends ExecutionAttributesProvider {
+public interface ItemStream extends ExecutionContextProvider {
/**
- * Restore to the state given the provided {@link ExecutionAttributes}.
+ * Restore to the state given the provided {@link ExecutionContext}.
* This can be used to restart after a failure - hence not normally used
* more than once per call to {@link #open()}.
*
* @param context
*/
- void restoreFrom(ExecutionAttributes context);
+ void restoreFrom(ExecutionContext context);
/**
* If any resources are needed for the stream to operate they need to be
@@ -70,7 +70,7 @@ public interface ItemStream extends ExecutionAttributesProvider {
* stream is being accessed from multiple threads concurrently, it will have
* to manage that internally, and also reflect only the completed marks
* (independent of the order they happen) when
- * {@link ExecutionAttributesProvider#getExecutionAttributes()} is called.
+ * {@link ExecutionContextProvider#getExecutionContext()} is called.
*
* @return true if mark and reset are supported by the {@link ItemStream}
*/
@@ -79,7 +79,7 @@ public interface ItemStream extends ExecutionAttributesProvider {
/**
* Mark the stream so that it can be reset later and the items backed out.
* After this method is called the result will be reflected in subsequent
- * calls to {@link ExecutionAttributesProvider#getExecutionAttributes()}.
+ * calls to {@link ExecutionContextProvider#getExecutionContext()}.
*
* In a multi-threaded setting implementations have to ensure that only the
* state from the current thread is saved.
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 653bb43fa..4d13c4818 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,7 +17,7 @@
package org.springframework.batch.item.reader;
import org.springframework.batch.io.Skippable;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.exception.StreamException;
@@ -48,22 +48,22 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl
}
/**
- * @see ItemStream#getExecutionAttributes()
+ * @see ItemStream#getExecutionContext()
* @throws IllegalStateException if the parent template is not itself
* {@link ItemStream}.
*/
- public ExecutionAttributes getExecutionAttributes() {
+ public ExecutionContext getExecutionContext() {
// TODO: this is not necessary...
Assert.state(inputSource instanceof ItemStream, "Input source is not ItemStream");
- return ((ItemStream) inputSource).getExecutionAttributes();
+ return ((ItemStream) inputSource).getExecutionContext();
}
/**
- * @see ItemStream#restoreFrom(ExecutionAttributes)
+ * @see ItemStream#restoreFrom(ExecutionContext)
* @throws IllegalStateException if the parent template is not itself
* {@link ItemStream}.
*/
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
Assert.state(inputSource instanceof ItemStream, "Input source is not ItemStream");
((ItemStream) inputSource).restoreFrom(data);
}
@@ -117,7 +117,7 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
if (inputSource instanceof ItemStream) {
@@ -126,7 +126,7 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() {
if (inputSource instanceof ItemStream) {
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 c4731916b..2a398eb04 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
@@ -15,7 +15,7 @@
*/
package org.springframework.batch.item.stream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.exception.StreamException;
@@ -41,17 +41,17 @@ public class ItemStreamAdapter implements ItemStream {
/**
* No-op.
- * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.ExecutionContext)
*/
- public void restoreFrom(ExecutionAttributes context) {
+ public void restoreFrom(ExecutionContext context) {
}
/**
- * Return empty {@link ExecutionAttributes}.
- * @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes()
+ * Return empty {@link ExecutionContext}.
+ * @see org.springframework.batch.item.ExecutionContextProvider#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes();
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext();
}
/* (non-Javadoc)
@@ -62,14 +62,14 @@ public class ItemStreamAdapter implements ItemStream {
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
throw new UnsupportedOperationException("Mark operation not supported.");
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() {
throw new UnsupportedOperationException("Reset operation not supported.");
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 a9d364438..9937cdb9b 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
@@ -23,7 +23,7 @@ import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.transaction.PlatformTransactionManager;
@@ -66,8 +66,8 @@ 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 ExecutionAttributes} in
- * {@link #getExecutionAttributes(Object)}. The default value is true, which
+ * streams will be used as a prefix in the {@link ExecutionContext} in
+ * {@link #getExecutionContext(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).
@@ -85,16 +85,16 @@ public class SimpleStreamManager implements StreamManager {
}
/**
- * Simple aggregate {@link ExecutionAttributes} provider for the contributions
+ * Simple aggregate {@link ExecutionContext} provider for the contributions
* registered under the given key.
*
- * @see org.springframework.batch.item.stream.StreamManager#getExecutionAttributes(java.lang.Object)
+ * @see org.springframework.batch.item.stream.StreamManager#getExecutionContext(java.lang.Object)
*/
- public ExecutionAttributes getExecutionAttributes(Object key) {
- final ExecutionAttributes result = new ExecutionAttributes();
+ public ExecutionContext getExecutionContext(Object key) {
+ final ExecutionContext result = new ExecutionContext();
iterate(key, new Callback() {
public void execute(ItemStream stream) {
- ExecutionAttributes context = stream.getExecutionAttributes();
+ ExecutionContext context = stream.getExecutionContext();
String prefix = ClassUtils.getQualifiedName(stream.getClass()) + ".";
if (!useClassNameAsPrefix) {
prefix = "";
@@ -114,9 +114,9 @@ public class SimpleStreamManager implements StreamManager {
* the provided key.
*
* @see org.springframework.batch.item.stream.StreamManager#register(java.lang.Object,
- * org.springframework.batch.item.ItemStream, ExecutionAttributes)
+ * org.springframework.batch.item.ItemStream, ExecutionContext)
*/
- public void register(Object key, ItemStream stream, ExecutionAttributes executionAttributes) {
+ public void register(Object key, ItemStream stream, ExecutionContext executionContext) {
synchronized (registry) {
Set set = (Set) registry.get(key);
if (set == null) {
@@ -125,23 +125,23 @@ public class SimpleStreamManager implements StreamManager {
}
set.add(stream);
}
- if (executionAttributes != null) {
- stream.restoreFrom(extract(stream, executionAttributes));
+ if (executionContext != null) {
+ stream.restoreFrom(extract(stream, executionContext));
}
}
/**
* @param stream
- * @param executionAttributes
+ * @param executionContext
* @return
*/
- private ExecutionAttributes extract(ItemStream stream, ExecutionAttributes executionAttributes) {
- ExecutionAttributes result = new ExecutionAttributes();
+ private ExecutionContext extract(ItemStream stream, ExecutionContext executionContext) {
+ ExecutionContext result = new ExecutionContext();
String prefix = ClassUtils.getQualifiedName(stream.getClass()) + ".";
if (!useClassNameAsPrefix) {
prefix = "";
}
- for (Iterator iterator = executionAttributes.entrySet().iterator(); iterator.hasNext();) {
+ for (Iterator iterator = executionContext.entrySet().iterator(); iterator.hasNext();) {
Entry entry = (Entry) iterator.next();
String contextKey = (String) entry.getKey();
if (contextKey.startsWith(prefix)) {
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 fc68a93ee..30b787c09 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
@@ -15,7 +15,7 @@
*/
package org.springframework.batch.item.stream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.transaction.TransactionStatus;
@@ -37,20 +37,20 @@ public interface StreamManager {
*
* @param key the key under which to add the provider
* @param stream an {@link ItemStream}
- * @param executionAttributes the context (may be null) to restore from on registration
+ * @param executionContext the context (may be null) to restore from on registration
*/
- void register(Object key, ItemStream stream, ExecutionAttributes executionAttributes);
+ void register(Object key, ItemStream stream, ExecutionContext executionContext);
/**
- * Extract and aggregate the {@link ExecutionAttributes} from all streams under
+ * Extract and aggregate the {@link ExecutionContext} from all streams under
* this key.
*
* @param key the key under which {@link ItemStream} instances might have
* been registered.
- * @return {@link ExecutionAttributes} aggregating the contexts of all providers
+ * @return {@link ExecutionContext} aggregating the contexts of all providers
* registered under this key, or empty otherwise.
*/
- ExecutionAttributes getExecutionAttributes(Object key);
+ ExecutionContext getExecutionContext(Object key);
/**
* If any resources are needed for the stream to operate they need to be
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 3d9e11ee1..d41a2b760 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
@@ -9,7 +9,7 @@ import junit.framework.TestCase;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;
@@ -73,7 +73,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
Foo foo2 = (Foo) source.read();
assertEquals(2, foo2.getValue());
- ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes();
+ ExecutionContext streamContext = getAsRestartable(source).getExecutionContext();
// 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).getExecutionAttributes();
+ ExecutionContext streamContext = getAsRestartable(source).getExecutionContext();
// create new input source
source = createItemReader();
@@ -117,7 +117,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
* @throws Exception
*/
public void testRestoreFromEmptyData() throws Exception {
- ExecutionAttributes streamContext = new ExecutionAttributes(new Properties());
+ ExecutionContext streamContext = new ExecutionContext(new Properties());
getAsRestartable(source).restoreFrom(streamContext);
@@ -164,7 +164,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
private static class MockKeyGenerator implements KeyGenerator{
- static ExecutionAttributes streamContext;
+ static ExecutionContext streamContext;
List keys;
List restartKeys;
@@ -173,7 +173,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
//restart data properties cannot be empty.
props.setProperty("", "");
- streamContext = new ExecutionAttributes(props);
+ streamContext = new ExecutionContext(props);
}
public MockKeyGenerator() {
@@ -191,11 +191,11 @@ public class DrivingQueryItemReaderTests extends TestCase {
restartKeys.add(new Foo(5, "5", 5));
}
- public ExecutionAttributes getKeyAsExecutionAttributes(Object key) {
+ public ExecutionContext getKeyAsExecutionContext(Object key) {
return streamContext;
}
- public List restoreKeys(ExecutionAttributes streamContext) {
+ public List restoreKeys(ExecutionContext streamContext) {
assertEquals(MockKeyGenerator.streamContext, streamContext);
return restartKeys;
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 3bae4d5aa..de86c52cf 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
@@ -2,7 +2,7 @@ package org.springframework.batch.io.driving;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.reader.AbstractItemReader;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
@@ -29,11 +29,11 @@ class FooItemReader extends AbstractItemReader implements ItemStream, ItemReader
}
}
- public ExecutionAttributes getExecutionAttributes() {
- return inputSource.getExecutionAttributes();
+ public ExecutionContext getExecutionContext() {
+ return inputSource.getExecutionContext();
}
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
inputSource.restoreFrom(data);
}
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/ColumnMapExecutionAttributesRowMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/ColumnMapExecutionContextRowMapperTests.java
similarity index 63%
rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/ColumnMapExecutionAttributesRowMapperTests.java
rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/ColumnMapExecutionContextRowMapperTests.java
index b2ce68862..ebbc2208c 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/ColumnMapExecutionAttributesRowMapperTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/ColumnMapExecutionContextRowMapperTests.java
@@ -11,18 +11,18 @@ import java.util.Properties;
import junit.framework.TestCase;
import org.easymock.MockControl;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.core.CollectionFactory;
import org.springframework.jdbc.core.PreparedStatementSetter;
/**
* @author Lucas Ward
*/
-public class ColumnMapExecutionAttributesRowMapperTests extends TestCase {
+public class ColumnMapExecutionContextRowMapperTests extends TestCase {
- private static final String KEY = ColumnMapExecutionAttributesRowMapper.KEY_PREFIX;
+ private static final String KEY = ColumnMapExecutionContextRowMapper.KEY_PREFIX;
- private ColumnMapExecutionAttributesRowMapper mapper;
+ private ColumnMapExecutionContextRowMapper mapper;
private Map key;
@@ -32,43 +32,43 @@ public class ColumnMapExecutionAttributesRowMapperTests extends TestCase {
protected void setUp() throws Exception {
super.setUp();
- mapper = new ColumnMapExecutionAttributesRowMapper();
+ mapper = new ColumnMapExecutionContextRowMapper();
key = CollectionFactory.createLinkedCaseInsensitiveMapIfPossible(2);
key.put("1", new Integer(1));
key.put("2", new Integer(2));
}
- public void testCreateExecutionAttributesWithInvalidType() throws Exception {
+ public void testCreateExecutionContextWithInvalidType() throws Exception {
try{
- mapper.createExecutionAttributes(new Object());
+ mapper.createExecutionContext(new Object());
fail();
}catch(IllegalArgumentException ex){
//expected
}
}
- public void testCreateExecutionAttributesWithNull(){
+ public void testCreateExecutionContextWithNull(){
try{
- mapper.createExecutionAttributes(null);
+ mapper.createExecutionContext(null);
fail();
}catch(IllegalArgumentException ex){
//expected
}
}
- public void testCreateExecutionAttributes() throws Exception {
- ExecutionAttributes streamContext = mapper.createExecutionAttributes(key);
+ public void testCreateExecutionContext() throws Exception {
+ ExecutionContext streamContext = mapper.createExecutionContext(key);
Properties props = streamContext.getProperties();
assertEquals("1", props.getProperty(KEY + "0"));
assertEquals("2", props.getProperty(KEY + "1"));
}
- public void testCreateExecutionAttributesFromEmptyKeys() throws Exception {
+ public void testCreateExecutionContextFromEmptyKeys() throws Exception {
- ExecutionAttributes streamContext = mapper.createExecutionAttributes(new HashMap());
+ ExecutionContext streamContext = mapper.createExecutionContext(new HashMap());
assertEquals(0, streamContext.getProperties().size());
}
@@ -77,7 +77,7 @@ public class ColumnMapExecutionAttributesRowMapperTests extends TestCase {
Properties props = new Properties();
props.setProperty(KEY + "0", "1");
props.setProperty(KEY + "1", "2");
- ExecutionAttributes streamContext = new ExecutionAttributes();
+ ExecutionContext streamContext = new ExecutionContext();
streamContext.putString(KEY + "0", "1");
streamContext.putString(KEY + "1", "2");
PreparedStatementSetter setter = mapper.createSetter(streamContext);
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/MultipleColumnJdbcKeyGeneratorIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/MultipleColumnJdbcKeyGeneratorIntegrationTests.java
index fdee85bac..8997b2f42 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/MultipleColumnJdbcKeyGeneratorIntegrationTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/MultipleColumnJdbcKeyGeneratorIntegrationTests.java
@@ -7,7 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.core.CollectionFactory;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -45,9 +45,9 @@ public class MultipleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTran
public void testRestoreKeys(){
- ExecutionAttributes streamContext = new ExecutionAttributes();
- streamContext.putString(ColumnMapExecutionAttributesRowMapper.KEY_PREFIX + "0", "3");
- streamContext.putString(ColumnMapExecutionAttributesRowMapper.KEY_PREFIX + "1", "3");
+ ExecutionContext streamContext = new ExecutionContext();
+ streamContext.putString(ColumnMapExecutionContextRowMapper.KEY_PREFIX + "0", "3");
+ streamContext.putString(ColumnMapExecutionContextRowMapper.KEY_PREFIX + "1", "3");
List keys = keyStrategy.restoreKeys(streamContext);
@@ -60,24 +60,24 @@ public class MultipleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTran
assertEquals(new Integer(5), key.get("VALUE"));
}
- public void testGetKeyAsExecutionAttributes(){
+ public void testGetKeyAsExecutionContext(){
Map key = CollectionFactory.createLinkedCaseInsensitiveMapIfPossible(1);
key.put("ID", new Long(3));
key.put("VALUE", new Integer(3));
- ExecutionAttributes streamContext = keyStrategy.getKeyAsExecutionAttributes(key);
+ ExecutionContext streamContext = keyStrategy.getKeyAsExecutionContext(key);
Properties props = streamContext.getProperties();
assertEquals(2, props.size());
- assertEquals("3", props.get(ColumnMapExecutionAttributesRowMapper.KEY_PREFIX + "0"));
- assertEquals("3", props.get(ColumnMapExecutionAttributesRowMapper.KEY_PREFIX + "1"));
+ assertEquals("3", props.get(ColumnMapExecutionContextRowMapper.KEY_PREFIX + "0"));
+ assertEquals("3", props.get(ColumnMapExecutionContextRowMapper.KEY_PREFIX + "1"));
}
public void testGetNullKeyAsStreamContext(){
try{
- keyStrategy.getKeyAsExecutionAttributes(null);
+ keyStrategy.getKeyAsExecutionContext(null);
fail();
}catch(IllegalArgumentException ex){
//expected
@@ -87,7 +87,7 @@ public class MultipleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTran
public void testRestoreKeysFromNull(){
try{
- keyStrategy.getKeyAsExecutionAttributes(null);
+ keyStrategy.getKeyAsExecutionContext(null);
}catch(IllegalArgumentException ex){
//expected
}
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/SingleColumnJdbcKeyGeneratorIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/SingleColumnJdbcKeyGeneratorIntegrationTests.java
index 8a6832030..899b9c31b 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/SingleColumnJdbcKeyGeneratorIntegrationTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/support/SingleColumnJdbcKeyGeneratorIntegrationTests.java
@@ -3,7 +3,7 @@ package org.springframework.batch.io.driving.support;
import java.util.List;
import java.util.Properties;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
/**
@@ -43,7 +43,7 @@ public class SingleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTransa
Properties props = new Properties();
props.setProperty(SingleColumnJdbcKeyGenerator.RESTART_KEY, "3");
- ExecutionAttributes streamContext = new ExecutionAttributes(props);
+ ExecutionContext streamContext = new ExecutionContext(props);
List keys = keyStrategy.restoreKeys(streamContext);
@@ -54,7 +54,7 @@ public class SingleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTransa
public void testGetKeyAsStreamContext(){
- ExecutionAttributes streamContext = keyStrategy.getKeyAsExecutionAttributes(new Long(3));
+ ExecutionContext streamContext = keyStrategy.getKeyAsExecutionContext(new Long(3));
Properties props = streamContext.getProperties();
assertEquals(1, props.size());
@@ -64,7 +64,7 @@ public class SingleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTransa
public void testGetNullKeyAsStreamContext(){
try{
- keyStrategy.getKeyAsExecutionAttributes(null);
+ keyStrategy.getKeyAsExecutionContext(null);
fail();
}catch(IllegalArgumentException ex){
//expected
@@ -74,7 +74,7 @@ public class SingleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTransa
public void testRestoreKeysFromNull(){
try{
- keyStrategy.getKeyAsExecutionAttributes(null);
+ keyStrategy.getKeyAsExecutionContext(null);
}catch(IllegalArgumentException ex){
//expected
}
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemReaderAdvancedTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemReaderAdvancedTests.java
index 82cc64bfe..af1738d96 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemReaderAdvancedTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemReaderAdvancedTests.java
@@ -24,7 +24,7 @@ import org.springframework.batch.io.file.mapping.DefaultFieldSet;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSetMapper;
import org.springframework.batch.io.file.transform.LineTokenizer;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
@@ -153,7 +153,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
reader.setFieldSetMapper(fieldSetMapper);
// do not open the template...
try {
- reader.restoreFrom(reader.getExecutionAttributes());
+ reader.restoreFrom(reader.getExecutionContext());
} catch (StreamException e) {
assertTrue("Message does not contain open: "+e.getMessage(), e.getMessage().contains("open"));
}
@@ -177,7 +177,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
reader.read();
// get restart data
- ExecutionAttributes streamContext = reader.getExecutionAttributes();
+ ExecutionContext streamContext = reader.getExecutionContext();
assertEquals("4", (String) streamContext.getProperties().getProperty(
FlatFileItemReader.READ_STATISTICS_NAME));
// close input
@@ -193,7 +193,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
assertEquals("[testLine5]", reader.read().toString());
assertEquals("[testLine6]", reader.read().toString());
- ExecutionAttributes statistics = reader.getExecutionAttributes();
+ ExecutionContext statistics = reader.getExecutionContext();
assertEquals(6, statistics.getLong(FlatFileItemReader.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 53d7ef354..51199e7f1 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
@@ -25,7 +25,7 @@ import java.util.Collections;
import junit.framework.TestCase;
import org.springframework.batch.item.ItemStream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.writer.ItemTransformer;
import org.springframework.core.io.FileSystemResource;
import org.springframework.transaction.support.TransactionSynchronizationManager;
@@ -309,7 +309,7 @@ public class FlatFileItemWriterTests extends TestCase {
commit();
// get restart data
- ExecutionAttributes streamContext = inputSource.getExecutionAttributes();
+ ExecutionContext streamContext = inputSource.getExecutionContext();
// close template
inputSource.close();
@@ -335,7 +335,7 @@ public class FlatFileItemWriterTests extends TestCase {
inputSource.write("testLine8");
// get statistics
- ExecutionAttributes statistics = inputSource.getExecutionAttributes();
+ ExecutionContext statistics = inputSource.getExecutionContext();
// 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.getExecutionAttributes();
+ ExecutionContext streamContext = inputSource.getExecutionContext();
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 aa6acd92f..8d41b5862 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
@@ -3,7 +3,7 @@ package org.springframework.batch.io.sql;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -76,7 +76,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra
Foo foo2 = (Foo) source.read();
assertEquals(2, foo2.getValue());
- ExecutionAttributes streamContext = getAsRestartable(source).getExecutionAttributes();
+ ExecutionContext streamContext = getAsRestartable(source).getExecutionContext();
// 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).getExecutionAttributes();
+ ExecutionContext streamContext = getAsRestartable(source).getExecutionContext();
// create new input source
source = createItemReader();
@@ -120,7 +120,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra
* @throws Exception
*/
public void testRestoreFromEmptyData() throws Exception {
- ExecutionAttributes streamContext = new ExecutionAttributes();
+ ExecutionContext streamContext = new ExecutionContext();
getAsRestartable(source).restoreFrom(streamContext);
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 94f92373e..e1c511519 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
@@ -2,7 +2,7 @@ package org.springframework.batch.io.support;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.io.sample.domain.Foo;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.beans.factory.InitializingBean;
@@ -85,7 +85,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
Foo foo2 = (Foo) reader.read();
assertEquals(2, foo2.getValue());
- ExecutionAttributes streamContext = getAsItemStream(reader).getExecutionAttributes();
+ ExecutionContext streamContext = getAsItemStream(reader).getExecutionContext();
// create new input source
reader = createItemReader();
@@ -107,7 +107,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
Foo foo2 = (Foo) reader.read();
assertEquals(2, foo2.getValue());
- ExecutionAttributes streamContext = getAsItemStream(reader).getExecutionAttributes();
+ ExecutionContext streamContext = getAsItemStream(reader).getExecutionContext();
// create new input source
reader = createItemReader();
@@ -129,7 +129,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
* @throws Exception
*/
public void testRestoreFromEmptyData() throws Exception {
- ExecutionAttributes streamContext = new ExecutionAttributes();
+ ExecutionContext streamContext = new ExecutionContext();
getAsItemStream(reader).restoreFrom(streamContext);
@@ -212,7 +212,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
rollback();
- ExecutionAttributes streamContext = getAsItemStream(reader).getExecutionAttributes();
+ ExecutionContext streamContext = getAsItemStream(reader).getExecutionContext();
// create new input source
reader = createItemReader();
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 90d2105fa..1f0d127a4 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
@@ -14,7 +14,7 @@ import javax.xml.stream.events.XMLEvent;
import junit.framework.TestCase;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.core.io.AbstractResource;
import org.springframework.core.io.ByteArrayResource;
@@ -113,7 +113,7 @@ public class StaxEventItemReaderTests extends TestCase {
*/
public void testRestart() {
source.read();
- ExecutionAttributes streamContext = source.getExecutionAttributes();
+ ExecutionContext streamContext = source.getExecutionContext();
assertEquals(1, streamContext.getLong(StaxEventItemReader.READ_COUNT_STATISTICS_NAME));
List expectedAfterRestart = (List) source.read();
@@ -128,7 +128,7 @@ public class StaxEventItemReaderTests extends TestCase {
* already initialised when restoring.
*/
public void testInvalidRestore() {
- ExecutionAttributes context = new ExecutionAttributes();
+ ExecutionContext context = new ExecutionContext();
context.putLong(StaxEventItemReader.READ_COUNT_STATISTICS_NAME, 100000);
try {
source.restoreFrom(context);
@@ -143,7 +143,7 @@ public class StaxEventItemReaderTests extends TestCase {
public void testRestoreWorksFromClosedStream() throws Exception {
source.close();
- source.restoreFrom(new ExecutionAttributes());
+ source.restoreFrom(new ExecutionContext());
}
/**
* Skipping marked records after rollback.
@@ -205,7 +205,7 @@ public class StaxEventItemReaderTests extends TestCase {
}
private long extractRecordCount() {
- return source.getExecutionAttributes().getLong(StaxEventItemReader.READ_COUNT_STATISTICS_NAME);
+ return source.getExecutionContext().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 e4ab425d1..4406603bb 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
@@ -12,7 +12,7 @@ import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
import org.springframework.batch.io.xml.oxm.MarshallingEventWriterSerializer;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.oxm.Marshaller;
@@ -88,7 +88,7 @@ public class StaxEventWriterItemWriterTests extends TestCase {
// write record
writer.write(record);
// writer.mark();
- ExecutionAttributes streamContext = writer.getExecutionAttributes();
+ ExecutionContext streamContext = writer.getExecutionContext();
writer.close();
// create new writer from saved restart data and continue writing
@@ -117,7 +117,7 @@ public class StaxEventWriterItemWriterTests extends TestCase {
final int NUMBER_OF_RECORDS = 10;
for (int i = 1; i <= NUMBER_OF_RECORDS; i++) {
writer.write(record);
- long writeStatistics = writer.getExecutionAttributes().getLong(StaxEventItemWriter.WRITE_STATISTICS_NAME);
+ long writeStatistics = writer.getExecutionContext().getLong(StaxEventItemWriter.WRITE_STATISTICS_NAME);
assertEquals(i, writeStatistics);
}
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionAttributesTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionContextTests.java
similarity index 92%
rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionAttributesTests.java
rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionContextTests.java
index 2745b683d..3c0f2ba95 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionAttributesTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ExecutionContextTests.java
@@ -21,14 +21,14 @@ import junit.framework.TestCase;
* @author Lucas Ward
*
*/
-public class ExecutionAttributesTests extends TestCase{
+public class ExecutionContextTests extends TestCase{
- ExecutionAttributes context;
+ ExecutionContext context;
protected void setUp() throws Exception {
super.setUp();
- context = new ExecutionAttributes();
+ context = new ExecutionContext();
}
public void testNormalUsage(){
@@ -78,7 +78,7 @@ public class ExecutionAttributesTests extends TestCase{
public void testEquals(){
context.putString("1", "testString");
- ExecutionAttributes tempContext = new ExecutionAttributes();
+ ExecutionContext tempContext = new ExecutionContext();
assertFalse(tempContext.equals(context));
tempContext.putString("1", "testString");
assertTrue(tempContext.equals(context));
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 bbec6a8a2..ee7dafa45 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
@@ -23,7 +23,7 @@ import junit.framework.TestCase;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.support.PropertiesConverter;
/**
@@ -73,7 +73,7 @@ public class DelegatingItemReaderTests extends TestCase {
* Gets restart data from the input template
*/
public void testGetStreamContext() {
- Properties props = itemProvider.getExecutionAttributes().getProperties();
+ Properties props = itemProvider.getExecutionContext().getProperties();
assertEquals("foo", props.getProperty("value"));
}
@@ -82,7 +82,7 @@ public class DelegatingItemReaderTests extends TestCase {
* @throws Exception
*/
public void testRestoreFrom() throws Exception {
- itemProvider.restoreFrom(new ExecutionAttributes(PropertiesConverter.stringToProperties("value=bar")));
+ itemProvider.restoreFrom(new ExecutionContext(PropertiesConverter.stringToProperties("value=bar")));
assertEquals("bar", itemProvider.read());
}
@@ -99,11 +99,11 @@ public class DelegatingItemReaderTests extends TestCase {
return PropertiesConverter.stringToProperties("a=b");
}
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("value=foo"));
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext(PropertiesConverter.stringToProperties("value=foo"));
}
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
value = data.getProperties().getProperty("value");
}
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 510d55f7e..1b124edbf 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
@@ -20,7 +20,7 @@ import java.util.List;
import junit.framework.TestCase;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.batch.support.PropertiesConverter;
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
@@ -72,31 +72,31 @@ public class SimpleStreamManagerTests extends TestCase {
/**
* Test method for
- * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}.
+ * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionContext(java.lang.Object)}.
*/
public void testGetStreamContextEmpty() {
- ExecutionAttributes streamContext = manager.getExecutionAttributes("foo");
+ ExecutionContext streamContext = manager.getExecutionContext("foo");
assertEquals(0, streamContext.entrySet().size());
}
/**
* Test method for
- * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}.
+ * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionContext(java.lang.Object)}.
*/
public void testGetStreamContextNotEmpty() {
manager.register("foo", stream, null);
- ExecutionAttributes streamContext = manager.getExecutionAttributes("foo");
+ ExecutionContext streamContext = manager.getExecutionContext("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#getExecutionAttributes(java.lang.Object)}.
+ * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionContext(java.lang.Object)}.
*/
public void testGetStreamContextNotEmptyAndRestore() {
testGetStreamContextNotEmpty();
- ExecutionAttributes context = manager.getExecutionAttributes("foo");
+ ExecutionContext context = manager.getExecutionContext("foo");
// Register again, now with the context that was created from the same
// stream...
manager.register("foo", stream, context);
@@ -107,10 +107,10 @@ public class SimpleStreamManagerTests extends TestCase {
/**
* Test method for
- * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}.
+ * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionContext(java.lang.Object)}.
*/
public void testGetStreamContextNotEmptyAndRestoreWithNoPrefix() {
- ExecutionAttributes context = new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar"));
+ ExecutionContext context = new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar"));
manager.setUseClassNameAsPrefix(false);
manager.register("foo", stream, context);
assertEquals(1, list.size());
@@ -120,12 +120,12 @@ public class SimpleStreamManagerTests extends TestCase {
/**
* Test method for
- * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionAttributes(java.lang.Object)}.
+ * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionContext(java.lang.Object)}.
*/
public void testGetStreamContextWithNoPrefix() {
manager.setUseClassNameAsPrefix(false);
manager.register("foo", stream, null);
- ExecutionAttributes context = manager.getExecutionAttributes("foo");
+ ExecutionContext context = manager.getExecutionContext("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#getExecutionAttributes(java.lang.Object)}.
+ * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionContext(java.lang.Object)}.
*/
public void testGetStreamContextTwoRegistrations() {
manager.register("foo", new ItemStreamAdapter() {
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar"));
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar"));
}
}, null);
manager.register("foo", new ItemStreamAdapter() {
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=spam"));
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext(PropertiesConverter.stringToProperties("foo=spam"));
}
}, null);
- ExecutionAttributes streamContext = manager.getExecutionAttributes("foo");
+ ExecutionContext streamContext = manager.getExecutionContext("foo");
assertEquals(2, streamContext.entrySet().size());
}
@@ -234,11 +234,11 @@ public class SimpleStreamManagerTests extends TestCase {
}
private final class ItemStreamAdapterExtension extends ItemStreamAdapter {
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar"));
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar"));
}
- public void restoreFrom(ExecutionAttributes context) {
+ public void restoreFrom(ExecutionContext context) {
list.add(context.getString("foo"));
}
}
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 f42f11b7e..99b6d0641 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
@@ -21,7 +21,7 @@ import java.util.List;
import junit.framework.TestCase;
import org.springframework.batch.io.Skippable;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.support.PropertiesConverter;
@@ -95,11 +95,11 @@ public class ItemWriterItemProcessorTests extends TestCase {
public void open() {
}
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("value=foo"));
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext(PropertiesConverter.stringToProperties("value=foo"));
}
- public void restoreFrom(ExecutionAttributes data) {
+ public void restoreFrom(ExecutionContext data) {
value = data.getProperties().getProperty("value");
}
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 011d9435d..e67be3560 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
@@ -2,7 +2,7 @@ package org.springframework.batch.sample.item.reader;
import java.math.BigDecimal;
-import org.springframework.batch.item.ExecutionAttributes;
+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;
@@ -94,16 +94,16 @@ public class GeneratingItemReader extends AbstractItemReaderRecoverer implements
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.ExecutionContext)
*/
- public void restoreFrom(ExecutionAttributes context) {
+ public void restoreFrom(ExecutionContext context) {
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes()
+ * @see org.springframework.batch.item.ExecutionContextProvider#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes();
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext();
}
}
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 ceb291bd2..434058f92 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
@@ -11,7 +11,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.execution.scope.StepContext;
import org.springframework.batch.execution.scope.StepContextAware;
-import org.springframework.batch.item.ExecutionAttributes;
+import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.KeyedItemReader;
import org.springframework.batch.item.exception.StreamException;
@@ -212,7 +212,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
/*
* (non-Javadoc)
*
- * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionContext)
*/
public void mark() {
getBuffer().commit();
@@ -221,7 +221,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
/*
* (non-Javadoc)
*
- * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionContext)
*/
public void reset() {
getBuffer().rollback();
@@ -230,19 +230,19 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
/*
* (non-Javadoc)
*
- * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.ExecutionAttributes)
+ * @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.ExecutionContext)
*/
- public void restoreFrom(ExecutionAttributes context) {
+ public void restoreFrom(ExecutionContext context) {
// no-op
}
/*
* (non-Javadoc)
*
- * @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes()
+ * @see org.springframework.batch.item.ExecutionContextProvider#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes();
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext();
}
}
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 318cb0e81..bf51fcd18 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
@@ -17,8 +17,8 @@
package org.springframework.batch.sample.tasklet;
import org.springframework.batch.core.tasklet.Tasklet;
-import org.springframework.batch.item.ExecutionAttributes;
-import org.springframework.batch.item.ExecutionAttributesProvider;
+import org.springframework.batch.item.ExecutionContext;
+import org.springframework.batch.item.ExecutionContextProvider;
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, ExecutionAttributesProvider {
+public class InfiniteLoopTasklet implements Tasklet, ExecutionContextProvider {
private int count = 0;
@@ -48,10 +48,10 @@ public class InfiniteLoopTasklet implements Tasklet, ExecutionAttributesProvider
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes()
+ * @see org.springframework.batch.item.ExecutionContextProvider#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
- return new ExecutionAttributes(PropertiesConverter.stringToProperties("count=" + count));
+ public ExecutionContext getExecutionContext() {
+ return new ExecutionContext(PropertiesConverter.stringToProperties("count=" + count));
}
}
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeWriter.java
index 1458aa5a8..083694c77 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeWriter.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeWriter.java
@@ -17,8 +17,8 @@
package org.springframework.batch.sample.tasklet;
import org.springframework.batch.core.tasklet.Tasklet;
-import org.springframework.batch.item.ExecutionAttributes;
-import org.springframework.batch.item.ExecutionAttributesProvider;
+import org.springframework.batch.item.ExecutionContext;
+import org.springframework.batch.item.ExecutionContextProvider;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.sample.dao.TradeDao;
import org.springframework.batch.sample.domain.Trade;
@@ -38,7 +38,7 @@ import org.springframework.util.Assert;
* @author Lucas Ward
* @author Dave Syer
*/
-public class SimpleTradeWriter implements ItemWriter, ExecutionAttributesProvider {
+public class SimpleTradeWriter implements ItemWriter, ExecutionContextProvider {
/*
* writes a Trade object to output
@@ -67,10 +67,10 @@ public class SimpleTradeWriter implements ItemWriter, ExecutionAttributesProvide
}
/* (non-Javadoc)
- * @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes()
+ * @see org.springframework.batch.item.ExecutionContextProvider#getExecutionContext()
*/
- public ExecutionAttributes getExecutionAttributes() {
- ExecutionAttributes statistics = new ExecutionAttributes();
+ public ExecutionContext getExecutionContext() {
+ ExecutionContext statistics = new ExecutionContext();
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 43673e03d..b789b3822 100644
--- a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml
@@ -42,7 +42,7 @@
-
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 8ff410255..e1d987927 100644
--- a/spring-batch-samples/src/main/resources/simple-container-definition.xml
+++ b/spring-batch-samples/src/main/resources/simple-container-definition.xml
@@ -97,14 +97,14 @@
abstract="true">
-
+
-
+
-
+