Purge StreamContext

This commit is contained in:
dsyer
2008-02-05 08:51:54 +00:00
parent 51e48b5edb
commit 1479d4c53d
44 changed files with 116 additions and 141 deletions

View File

@@ -192,12 +192,11 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements
return stepExecution;
}
/*
* (non-Javadoc)
* @see org.springframework.batch.item.ItemStream#getStreamContext()
/* (non-Javadoc)
* @see org.springframework.batch.item.ExecutionAttributesProvider#getExecutionAttributes()
*/
public ExecutionAttributes getStreamContext() {
return streamManager.getStreamContext(this);
public ExecutionAttributes getExecutionAttributes() {
return streamManager.getExecutionAttributes(this);
}
/* (non-Javadoc)

View File

@@ -18,7 +18,7 @@ package org.springframework.batch.execution.scope;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ExecutionAttributes;
import org.springframework.batch.item.StreamContextProvider;
import org.springframework.batch.item.ExecutionAttributesProvider;
import org.springframework.core.AttributeAccessor;
/**
@@ -27,7 +27,7 @@ import org.springframework.core.AttributeAccessor;
* @author Dave Syer
*
*/
public interface StepContext extends AttributeAccessor, StreamContextProvider {
public interface StepContext extends AttributeAccessor, ExecutionAttributesProvider {
/**
* Accessor for the {@link StepExecution} associated with the currently

View File

@@ -206,7 +206,7 @@ public class SimpleStepExecutor {
// TODO: check that stepExecution can
// aggregate these contributions if they
// come in asynchronously.
ExecutionAttributes statistics = stepContext.getStreamContext();
ExecutionAttributes statistics = stepContext.getExecutionAttributes();
contribution.setStreamContext(statistics);
contribution.incrementCommitCount();
@@ -220,7 +220,7 @@ public class SimpleStepExecutor {
stepExecution.apply(contribution);
if (saveStreamContext) {
stepInstance.setStreamContext(stepContext.getStreamContext());
stepInstance.setStreamContext(stepContext.getExecutionAttributes());
jobRepository.update(stepInstance);
}
jobRepository.saveOrUpdate(stepExecution);

View File

@@ -136,8 +136,8 @@ public class SimpleStepContextTests extends TestCase {
public void testStreamContextWithNotNullService() throws Exception {
Map map = new HashMap();
context = new SimpleStepContext(null, null, new StubStreamManager(map));
assertEquals(1, context.getStreamContext().getProperties().size());
assertEquals("bar", context.getStreamContext().getProperties().getProperty("foo"));
assertEquals(1, context.getExecutionAttributes().getProperties().size());
assertEquals("bar", context.getExecutionAttributes().getProperties().getProperty("foo"));
}
public void testStreamManagerRegistration() throws Exception {
@@ -164,7 +164,7 @@ public class SimpleStepContextTests extends TestCase {
public void close(Object key) {
}
public ExecutionAttributes getStreamContext(Object key) {
public ExecutionAttributes getExecutionAttributes(Object key) {
return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar"));
}

View File

@@ -103,7 +103,7 @@ public class SimpleStepConfigurationTests extends TestCase {
*/
public void testIsSaveStreamContext() {
assertEquals(false, configuration.isSaveStreamContext());
configuration.setSaveStreamContext(true);
configuration.setSaveExecutionAttributes(true);
assertEquals(true, configuration.isSaveStreamContext());
}

View File

@@ -290,7 +290,7 @@ public class SimpleStepExecutorTests extends TestCase {
StepInstance step = new StepInstance(new Long(1));
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepExecutor.setTasklet(tasklet);
stepConfiguration.setSaveStreamContext(true);
stepConfiguration.setSaveExecutionAttributes(true);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -309,7 +309,7 @@ public class SimpleStepExecutorTests extends TestCase {
step.setStepExecutionCount(1);
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepExecutor.setTasklet(tasklet);
stepConfiguration.setSaveStreamContext(true);
stepConfiguration.setSaveExecutionAttributes(true);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -332,7 +332,7 @@ public class SimpleStepExecutorTests extends TestCase {
step.setStepExecutionCount(1);
MockRestartableTasklet tasklet = new MockRestartableTasklet();
stepConfiguration.setTasklet(tasklet);
stepConfiguration.setSaveStreamContext(false);
stepConfiguration.setSaveExecutionAttributes(false);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
@@ -359,7 +359,7 @@ public class SimpleStepExecutorTests extends TestCase {
return ExitStatus.FINISHED;
}
});
stepConfiguration.setSaveStreamContext(true);
stepConfiguration.setSaveExecutionAttributes(true);
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecution);
@@ -413,7 +413,7 @@ public class SimpleStepExecutorTests extends TestCase {
return ExitStatus.FINISHED;
}
});
stepConfiguration.setSaveStreamContext(true);
stepConfiguration.setSaveExecutionAttributes(true);
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(step, jobExecution);
@@ -421,7 +421,7 @@ public class SimpleStepExecutorTests extends TestCase {
final Map map = new HashMap();
stepExecutor.setStreamManager(new SimpleStreamManager(new ResourcelessTransactionManager()) {
public ExecutionAttributes getStreamContext(Object key) {
public ExecutionAttributes getExecutionAttributes(Object key) {
// TODO Auto-generated method stub
return new ExecutionAttributes(PropertiesConverter.stringToProperties("foo=bar"));
}
@@ -453,7 +453,7 @@ public class SimpleStepExecutorTests extends TestCase {
return restoreFromCalledWithSomeContext;
}
public ExecutionAttributes getStreamContext() {
public ExecutionAttributes getExecutionAttributes() {
getStreamContextCalled = true;
return new ExecutionAttributes(PropertiesConverter.stringToProperties("spam=bucket"));
}

View File

@@ -58,15 +58,15 @@ CREATE TABLE BATCH_STEP_EXECUTION_ATTRS (
DOUBLE_VAL DOUBLE PRECISION ,
OBJECT_VAL LONGVARBINARY);
CREATE TABLE BATCH_STEP_EXECUTION_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_STEP_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_JOB_EXECUTION_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_JOB_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_STEP_EXECUTION_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_STEP_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_JOB_EXECUTION_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_JOB_SEQ (
ID BIGINT IDENTITY
);

View File

@@ -27,7 +27,7 @@
class="org.springframework.batch.execution.step.simple.SimpleStep"
abstract="true">
<property name="allowStartIfComplete" value="true" />
<property name="saveStreamContext" value="false" />
<property name="saveExecutionAttributes" value="false" />
<property name="exceptionHandler">
<bean
class="org.springframework.batch.repeat.exception.handler.SimpleLimitExceptionHandler">