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

java.lang.Object
  extended by org.springframework.batch.core.step.tasklet.CallableTaskletAdapter
All Implemented Interfaces:
Tasklet, InitializingBean

public class CallableTaskletAdapter
extends Object
implements Tasklet, InitializingBean

Adapts a Callable<RepeatStatus> to the Tasklet interface.

Author:
Dave Syer

Constructor Summary
CallableTaskletAdapter()
           
 
Method Summary
 void afterPropertiesSet()
          Assert that the callable is set.
 RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext)
          Execute the provided Callable and return its RepeatStatus.
 void setCallable(Callable<RepeatStatus> callable)
          Public setter for the Callable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallableTaskletAdapter

public CallableTaskletAdapter()
Method Detail

setCallable

public void setCallable(Callable<RepeatStatus> callable)
Public setter for the Callable.

Parameters:
callable - the Callable to set

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Assert that the callable is set.

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

execute

public RepeatStatus execute(StepContribution contribution,
                            ChunkContext chunkContext)
                     throws Exception
Execute the provided Callable and return its RepeatStatus. Ignores the StepContribution and the attributes.

Specified by:
execute in interface Tasklet
Parameters:
contribution - mutable state to be passed back to update the current step execution
chunkContext - attributes shared between invocations but not between restarts
Returns:
an RepeatStatus indicating whether processing is continuable.
Throws:
Exception
See Also:
Tasklet.execute(StepContribution, ChunkContext)


Copyright © 2009 SpringSource. All Rights Reserved.