org.springframework.batch.core.step.tasklet
Class TaskletStep

java.lang.Object
  extended by org.springframework.batch.core.step.AbstractStep
      extended by org.springframework.batch.core.step.tasklet.TaskletStep
All Implemented Interfaces:
Step, BeanNameAware, InitializingBean

public class TaskletStep
extends AbstractStep

A Step that executes a Tasklet directly. This step does not manage transactions or any looping functionality. The tasklet should do this on its own. If the Tasklet itself implements StepExecutionListener it will be registered automatically, but its injected dependencies will not be. This is a good way to get access to job parameters and execution context if the tasklet is parameterized.

Author:
Ben Hale, Robert Kasanicky

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.batch.core.step.AbstractStep
AbstractStep.FatalException
 
Field Summary
 
Fields inherited from class org.springframework.batch.core.step.AbstractStep
JOB_INTERRUPTED
 
Constructor Summary
TaskletStep()
          Default constructor is useful for XML configuration.
TaskletStep(Tasklet tasklet, JobRepository jobRepository)
          Creates a new Step for executing a Tasklet
 
Method Summary
 void afterPropertiesSet()
          Check mandatory properties.
protected  void close(ExecutionContext ctx)
           
protected  ExitStatus doExecute(StepExecution stepExecution)
          Delegate to tasklet.
protected  void open(ExecutionContext ctx)
           
 void setStepListeners(StepExecutionListener[] listeners)
          Deprecated. use AbstractStep.setStepExecutionListeners(StepExecutionListener[]) instead
 void setTasklet(Tasklet tasklet)
          Public setter for the Tasklet.
 
Methods inherited from class org.springframework.batch.core.step.AbstractStep
execute, getCompositeListener, getJobRepository, getName, getStartLimit, isAllowStartIfComplete, registerStepExecutionListener, setAllowStartIfComplete, setBeanName, setJobRepository, setName, setStartLimit, setStepExecutionListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskletStep

public TaskletStep()
Default constructor is useful for XML configuration.


TaskletStep

public TaskletStep(Tasklet tasklet,
                   JobRepository jobRepository)
Creates a new Step for executing a Tasklet

Parameters:
tasklet - The Tasklet to execute
jobRepository - The JobRepository to use for persistence of incremental state
Method Detail

setStepListeners

public void setStepListeners(StepExecutionListener[] listeners)
Deprecated. use AbstractStep.setStepExecutionListeners(StepExecutionListener[]) instead

Register each of the objects as listeners.


afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Check mandatory properties.

Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class AbstractStep
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()

setTasklet

public void setTasklet(Tasklet tasklet)
Public setter for the Tasklet.

Parameters:
tasklet - the Tasklet to set

doExecute

protected ExitStatus doExecute(StepExecution stepExecution)
                        throws Exception
Delegate to tasklet.

Specified by:
doExecute in class AbstractStep
Throws:
Exception

close

protected void close(ExecutionContext ctx)
              throws Exception
Specified by:
close in class AbstractStep
Throws:
Exception

open

protected void open(ExecutionContext ctx)
             throws Exception
Specified by:
open in class AbstractStep
Throws:
Exception


Copyright © 2008 SpringSource. All Rights Reserved.