org.springframework.batch.core.job
Class SimpleStepHandler

java.lang.Object
  extended by org.springframework.batch.core.job.SimpleStepHandler
All Implemented Interfaces:
StepHandler, InitializingBean

public class SimpleStepHandler
extends Object
implements StepHandler, InitializingBean

Implementation of StepHandler that manages repository and restart concerns.

Author:
Dave Syer

Constructor Summary
SimpleStepHandler()
          Convenient default constructor for configuration usage.
SimpleStepHandler(JobRepository jobRepository)
           
SimpleStepHandler(JobRepository jobRepository, ExecutionContext executionContext)
           
 
Method Summary
 void afterPropertiesSet()
          Check mandatory properties (jobRepository).
 StepExecution handleStep(Step step, JobExecution execution)
          Handle a step and return the execution for it.
 void setExecutionContext(ExecutionContext executionContext)
          A context containing values to be added to the step execution before it is handled.
 void setJobRepository(JobRepository jobRepository)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleStepHandler

public SimpleStepHandler()
Convenient default constructor for configuration usage.


SimpleStepHandler

public SimpleStepHandler(JobRepository jobRepository)
Parameters:
jobRepository -

SimpleStepHandler

public SimpleStepHandler(JobRepository jobRepository,
                         ExecutionContext executionContext)
Parameters:
jobRepository -
executionContext -
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Check mandatory properties (jobRepository).

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

setJobRepository

public void setJobRepository(JobRepository jobRepository)
Parameters:
jobRepository - the jobRepository to set

setExecutionContext

public void setExecutionContext(ExecutionContext executionContext)
A context containing values to be added to the step execution before it is handled.

Parameters:
executionContext - the execution context to set

handleStep

public StepExecution handleStep(Step step,
                                JobExecution execution)
                         throws JobInterruptedException,
                                JobRestartException,
                                StartLimitExceededException
Description copied from interface: StepHandler
Handle a step and return the execution for it. Does not save the JobExecution, but should manage the persistence of the StepExecution if required (e.g. at least it needs to be added to a repository before the step can eb executed).

Specified by:
handleStep in interface StepHandler
Parameters:
step - a Step
execution - a JobExecution
Returns:
an execution of the step
Throws:
JobInterruptedException - if there is an interruption
JobRestartException - if there is a problem restarting a failed step
StartLimitExceededException - if the step exceeds its start limit
See Also:
Job.execute(JobExecution), Step.execute(StepExecution)


Copyright © 2013 SpringSource. All Rights Reserved.