public abstract class AbstractStep extends java.lang.Object implements Step, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanNameAware
Step implementation that provides common behavior to subclasses, including registering and calling
listeners.| Constructor and Description |
|---|
AbstractStep()
Default constructor.
|
AbstractStep(java.lang.String name)
Convenient constructor for setting only the name property.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected void |
close(ExecutionContext ctx)
Extension point for subclasses to provide callbacks to their collaborators at the end of a step (right at the end
of the finally block), to close or release resources.
|
protected abstract void |
doExecute(StepExecution stepExecution)
Extension point for subclasses to execute business logic.
|
protected void |
doExecutionRegistration(StepExecution stepExecution)
Registers the
StepExecution for property resolution via StepScope |
protected void |
doExecutionRelease()
Releases the most recent
StepExecution |
void |
execute(StepExecution stepExecution)
Template method for step execution logic - calls abstract methods for resource initialization (
open(ExecutionContext)), execution logic (doExecute(StepExecution)) and resource closing (
close(ExecutionContext)). |
protected StepExecutionListener |
getCompositeListener() |
protected JobRepository |
getJobRepository() |
java.lang.String |
getName() |
int |
getStartLimit() |
boolean |
isAllowStartIfComplete() |
protected void |
open(ExecutionContext ctx)
Extension point for subclasses to provide callbacks to their collaborators at the beginning of a step, to open or
acquire resources.
|
void |
registerStepExecutionListener(StepExecutionListener listener)
Register a step listener for callbacks at the appropriate stages in a step execution.
|
void |
setAllowStartIfComplete(boolean allowStartIfComplete)
Public setter for flag that determines whether the step should start again if it is already complete.
|
void |
setBeanName(java.lang.String name)
Set the name property if it is not already set.
|
void |
setJobRepository(JobRepository jobRepository)
Public setter for
JobRepository. |
void |
setName(java.lang.String name)
Set the name property.
|
void |
setStartLimit(int startLimit)
Public setter for the startLimit.
|
void |
setStepExecutionListeners(StepExecutionListener[] listeners)
Register each of the objects as listeners.
|
java.lang.String |
toString() |
public AbstractStep()
public AbstractStep(java.lang.String name)
name - public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic java.lang.String getName()
public void setName(java.lang.String name)
setBeanName(java.lang.String)public void setBeanName(java.lang.String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwareBeanNameAware.setBeanName(java.lang.String)public int getStartLimit()
getStartLimit in interface Steppublic void setStartLimit(int startLimit)
startLimit - the startLimit to setpublic boolean isAllowStartIfComplete()
isAllowStartIfComplete in interface Steppublic void setAllowStartIfComplete(boolean allowStartIfComplete)
allowStartIfComplete - the value of the flag to setprotected abstract void doExecute(StepExecution stepExecution) throws java.lang.Exception
ExitStatus on the
StepExecution before returning.stepExecution - the current step contextjava.lang.Exceptionprotected void open(ExecutionContext ctx) throws java.lang.Exception
ctx - the ExecutionContext to usejava.lang.Exceptionprotected void close(ExecutionContext ctx) throws java.lang.Exception
ctx - the ExecutionContext to usejava.lang.Exceptionpublic final void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException
open(ExecutionContext)), execution logic (doExecute(StepExecution)) and resource closing (
close(ExecutionContext)).execute in interface StepstepExecution - an entity representing the step to be executedJobInterruptedException - if the step is interrupted externallyUnexpectedJobExecutionExceptionprotected void doExecutionRelease()
StepExecutionprotected void doExecutionRegistration(StepExecution stepExecution)
StepExecution for property resolution via StepScopestepExecution - public void registerStepExecutionListener(StepExecutionListener listener)
listener - a StepExecutionListenerpublic void setStepExecutionListeners(StepExecutionListener[] listeners)
listeners - an array of listener objects of known types.protected StepExecutionListener getCompositeListener()
public void setJobRepository(JobRepository jobRepository)
JobRepository.jobRepository - is a mandatory dependence (no default).protected JobRepository getJobRepository()
public java.lang.String toString()
toString in class java.lang.Object