IN PROGRESS - issue BATCH-121: BatchResourceFactoryBean - is it adding any value?
http://opensource.atlassian.com/projects/spring/browse/BATCH-121 Change StepContext to contain a StepExecution instead of a JobIdentifier
This commit is contained in:
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.repeat.context.SynchronizedAttributeAccessor;
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements
|
||||
|
||||
private Map callbacks = new HashMap();
|
||||
private StepContext parent;
|
||||
private JobIdentifier jobIdentifier;
|
||||
private StepExecution stepExecution;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@@ -123,17 +123,17 @@ public class SimpleStepContext extends SynchronizedAttributeAccessor implements
|
||||
|
||||
|
||||
/**
|
||||
* @param jobIdentifier
|
||||
* @param stepExecution
|
||||
*/
|
||||
public void setJobIdentifier(JobIdentifier jobIdentifier) {
|
||||
this.jobIdentifier = jobIdentifier;
|
||||
public void setStepExecution(StepExecution stepExecution) {
|
||||
this.stepExecution = stepExecution;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.execution.scope.StepContext#getJobIdentifier()
|
||||
*/
|
||||
public JobIdentifier getJobIdentifier() {
|
||||
return jobIdentifier;
|
||||
public StepExecution getStepExecution() {
|
||||
return stepExecution;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.execution.scope;
|
||||
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.core.AttributeAccessor;
|
||||
|
||||
/**
|
||||
@@ -27,12 +27,12 @@ import org.springframework.core.AttributeAccessor;
|
||||
public interface StepContext extends AttributeAccessor {
|
||||
|
||||
/**
|
||||
* Accessor for the {@link JobIdentifier} associated with the currently
|
||||
* Accessor for the {@link StepExecution} associated with the currently
|
||||
* executing step.
|
||||
*
|
||||
* @return the {@link JobIdentifier} associated with the current step
|
||||
* @return the {@link StepExecution} associated with the current step
|
||||
*/
|
||||
JobIdentifier getJobIdentifier();
|
||||
StepExecution getStepExecution();
|
||||
|
||||
/**
|
||||
* Accessor for the parent context.
|
||||
|
||||
@@ -182,7 +182,7 @@ public class SimpleStepExecutor implements StepExecutor {
|
||||
stepExecution.getJobExecution().unregisterStepContext(context);
|
||||
}
|
||||
});
|
||||
stepScopeContext.setJobIdentifier(stepExecution.getJobExecution().getJobIdentifier());
|
||||
stepScopeContext.setStepExecution(stepExecution);
|
||||
context.setAttribute(StepScope.ID_KEY, stepExecution.getJobExecution()
|
||||
.getJobIdentifier());
|
||||
// Mark the context as a step context as a hint to scope
|
||||
|
||||
Reference in New Issue
Block a user