org.springframework.batch.item.support
Class DelegatingItemReader

java.lang.Object
  extended by org.springframework.batch.item.support.AbstractItemReader
      extended by org.springframework.batch.item.support.DelegatingItemReader
All Implemented Interfaces:
ItemReader, InitializingBean
Direct Known Subclasses:
AggregateItemReader, ValidatingItemReader

public class DelegatingItemReader
extends AbstractItemReader
implements InitializingBean

Simple wrapper around ItemReader. The item reader is expected to take care of open and close operations. If necessary it should be registered as a step scoped bean to ensure that the lifecycle methods are called. The implementation is thread-safe if the delegate is thread-safe.

Author:
Dave Syer

Constructor Summary
DelegatingItemReader()
          Default constructor.
DelegatingItemReader(ItemReader itemReader)
          Convenience constructor for setting mandatory property.
 
Method Summary
 void afterPropertiesSet()
           
 void mark()
          Mark the stream so that it can be reset later and the items backed out.
Mark is called before reading a new chunk of items - in case of rollback mark will not be called again before re-processing the chunk.
 Object read()
          Get the next object from the input source.
 void reset()
          Reset the stream to the last mark.
 void setItemReader(ItemReader source)
          Setter for input source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingItemReader

public DelegatingItemReader()
Default constructor.


DelegatingItemReader

public DelegatingItemReader(ItemReader itemReader)
Convenience constructor for setting mandatory property.

Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

read

public Object read()
            throws Exception
Get the next object from the input source.

Specified by:
read in interface ItemReader
Throws:
Exception
See Also:
ItemReader.read()

setItemReader

public void setItemReader(ItemReader source)
Setter for input source.

Parameters:
source -

mark

public void mark()
Description copied from interface: ItemReader
Mark the stream so that it can be reset later and the items backed out.
Mark is called before reading a new chunk of items - in case of rollback mark will not be called again before re-processing the chunk.

Specified by:
mark in interface ItemReader
Overrides:
mark in class AbstractItemReader

reset

public void reset()
Description copied from interface: ItemReader
Reset the stream to the last mark. After a reset the stream state will be such that changes (items read or written) since the last call to mark will not be visible after a call to close.

Specified by:
reset in interface ItemReader
Overrides:
reset in class AbstractItemReader


Copyright © 2009 SpringSource. All Rights Reserved.