类 AbstractStep
- java.lang.Object
- org.springframework.batch.core.step.AbstractStep
- 所有已实现的接口:
Step
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
- 直接已知子类:
DecisionStep
,DelegateStep
,FlowStep
,JobStep
,PartitionStep
,TaskletStep
public abstract class AbstractStep extends java.lang.Object implements Step, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanNameAware
AStep
implementation that provides common behavior to subclasses, including registering and calling listeners.- 作者:
- Dave Syer, Ben Hale, Robert Kasanicky, Michael Minella, Chris Schaefer, Mahmoud Ben Hassine
字段概要
从接口继承的字段 org.springframework.batch.core.Step
STEP_TYPE_KEY
构造器概要
构造器 构造器 说明 AbstractStep()
Default constructor.AbstractStep(java.lang.String name)
Convenient constructor for setting only the name property.
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 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 theStepExecution
for property resolution viaStepScope
protected void
doExecutionRelease()
Releases the most recentStepExecution
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 forJobRepository
.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()
构造器详细资料
AbstractStep
public AbstractStep()
Default constructor.
AbstractStep
public AbstractStep(java.lang.String name)
Convenient constructor for setting only the name property.- 参数:
name
- Name of the step
方法详细资料
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
setName
public void setName(java.lang.String name)
Set the name property. Always overrides the default value if this object is a Spring bean.- 参数:
name
- the name of theStep
.- 另请参阅:
setBeanName(java.lang.String)
setBeanName
public void setBeanName(java.lang.String name)
Set the name property if it is not already set. Because of the order of the callbacks in a Spring container the name property will be set first if it is present. Care is needed with bean definition inheritance - if a parent bean has a name, then its children need an explicit name as well, otherwise they will not be unique.- 指定者:
setBeanName
在接口中org.springframework.beans.factory.BeanNameAware
- 另请参阅:
BeanNameAware.setBeanName(java.lang.String)
getStartLimit
public int getStartLimit()
- 指定者:
getStartLimit
在接口中Step
- 返回:
- the number of times a job can be started with the same identifier.
setStartLimit
public void setStartLimit(int startLimit)
Public setter for the startLimit.- 参数:
startLimit
- the startLimit to set
isAllowStartIfComplete
public boolean isAllowStartIfComplete()
- 指定者:
isAllowStartIfComplete
在接口中Step
- 返回:
- true if a step that is already marked as complete can be started again.
setAllowStartIfComplete
public void setAllowStartIfComplete(boolean allowStartIfComplete)
Public setter for flag that determines whether the step should start again if it is already complete. Defaults to false.- 参数:
allowStartIfComplete
- the value of the flag to set
doExecute
protected abstract void doExecute(StepExecution stepExecution) throws java.lang.Exception
Extension point for subclasses to execute business logic. Subclasses should set theExitStatus
on theStepExecution
before returning.- 参数:
stepExecution
- the current step context- 抛出:
java.lang.Exception
- checked exception thrown by implementation
open
protected void open(ExecutionContext ctx) throws java.lang.Exception
Extension point for subclasses to provide callbacks to their collaborators at the beginning of a step, to open or acquire resources. Does nothing by default.- 参数:
ctx
- theExecutionContext
to use- 抛出:
java.lang.Exception
- checked exception thrown by implementation
close
protected void close(ExecutionContext ctx) throws java.lang.Exception
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. Does nothing by default.- 参数:
ctx
- theExecutionContext
to use- 抛出:
java.lang.Exception
- checked exception thrown by implementation
execute
public final void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException
Template method for step execution logic - calls abstract methods for resource initialization (open(ExecutionContext)
), execution logic (doExecute(StepExecution)
) and resource closing (close(ExecutionContext)
).- 指定者:
execute
在接口中Step
- 参数:
stepExecution
- an entity representing the step to be executed- 抛出:
JobInterruptedException
- if the step is interrupted externallyUnexpectedJobExecutionException
doExecutionRelease
protected void doExecutionRelease()
Releases the most recentStepExecution
doExecutionRegistration
protected void doExecutionRegistration(StepExecution stepExecution)
Registers theStepExecution
for property resolution viaStepScope
- 参数:
stepExecution
- StepExecution to use when hydrating the StepScoped beans
registerStepExecutionListener
public void registerStepExecutionListener(StepExecutionListener listener)
Register a step listener for callbacks at the appropriate stages in a step execution.- 参数:
listener
- aStepExecutionListener
setStepExecutionListeners
public void setStepExecutionListeners(StepExecutionListener[] listeners)
Register each of the objects as listeners.- 参数:
listeners
- an array of listener objects of known types.
getCompositeListener
protected StepExecutionListener getCompositeListener()
- 返回:
- composite listener that delegates to all registered listeners.
setJobRepository
public void setJobRepository(JobRepository jobRepository)
Public setter forJobRepository
.- 参数:
jobRepository
- is a mandatory dependence (no default).
getJobRepository
protected JobRepository getJobRepository()
toString
public java.lang.String toString()
- 覆盖:
toString
在类中java.lang.Object