org.springframework.batch.core.step.item
Class SimpleChunkProvider<I>

java.lang.Object
  extended by org.springframework.batch.core.step.item.SimpleChunkProvider<I>
All Implemented Interfaces:
ChunkProvider<I>
Direct Known Subclasses:
FaultTolerantChunkProvider

public class SimpleChunkProvider<I>
extends java.lang.Object
implements ChunkProvider<I>

Simple implementation of the ChunkProvider interface that does basic chunk providing from an ItemReader.

Author:
Dave Syer
See Also:
ChunkOrientedTasklet

Field Summary
protected  org.springframework.batch.item.ItemReader<? extends I> itemReader
           
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
SimpleChunkProvider(org.springframework.batch.item.ItemReader<? extends I> itemReader, org.springframework.batch.repeat.RepeatOperations repeatOperations)
           
 
Method Summary
protected  I doRead()
          Surrounds the read call with listener callbacks.
protected  MulticasterBatchListener<I,?> getListener()
           
 void postProcess(StepContribution contribution, Chunk<I> chunk)
           
 Chunk<I> provide(StepContribution contribution)
           
protected  I read(StepContribution contribution, Chunk<I> chunk)
           
 void registerListener(StepListener listener)
          Register a listener for callbacks at the appropriate stages in a process.
 void setListeners(java.util.List<? extends StepListener> listeners)
          Register some StepListeners with the handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

itemReader

protected final org.springframework.batch.item.ItemReader<? extends I> itemReader
Constructor Detail

SimpleChunkProvider

public SimpleChunkProvider(org.springframework.batch.item.ItemReader<? extends I> itemReader,
                           org.springframework.batch.repeat.RepeatOperations repeatOperations)
Method Detail

setListeners

public void setListeners(java.util.List<? extends StepListener> listeners)
Register some StepListeners with the handler. Each will get the callbacks in the order specified at the correct stage.

Parameters:
listeners -

registerListener

public void registerListener(StepListener listener)
Register a listener for callbacks at the appropriate stages in a process.

Parameters:
listener - a StepListener

getListener

protected MulticasterBatchListener<I,?> getListener()
Returns:
the listener

doRead

protected final I doRead()
                  throws java.lang.Exception
Surrounds the read call with listener callbacks.

Returns:
item
Throws:
java.lang.Exception

provide

public Chunk<I> provide(StepContribution contribution)
                 throws java.lang.Exception
Specified by:
provide in interface ChunkProvider<I>
Throws:
java.lang.Exception

postProcess

public void postProcess(StepContribution contribution,
                        Chunk<I> chunk)
Specified by:
postProcess in interface ChunkProvider<I>

read

protected I read(StepContribution contribution,
                 Chunk<I> chunk)
          throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2009. All Rights Reserved.