Summer.Batch.Infrastructure.Item.Support.AbstractItemCountingItemStreamItemReader< T > Class Template Referenceabstract

Abstract superclass for IItemReaders that supports restart by storing item count in the execution context and therefore requires item ordering to be preserved between runs. More...

Inheritance diagram for Summer.Batch.Infrastructure.Item.Support.AbstractItemCountingItemStreamItemReader< T >:
Summer.Batch.Infrastructure.Item.Support.AbstractItemStreamItemReader< T > Summer.Batch.Infrastructure.Item.Util.ItemStreamSupport Summer.Batch.Infrastructure.Item.IItemStreamReader< T > Summer.Batch.Infrastructure.Item.IItemStream Summer.Batch.Extra.Ebcdic.EbcdicFileReader< T > Summer.Batch.Infrastructure.Item.Database.DataReaderItemReader< T > Summer.Batch.Infrastructure.Item.File.FlatFileItemReader< T >

Public Member Functions

override T Read ()
 Reads a piece of input data and advance to the next one. Implementations must return null at the end of the input data set. In a transactional setting, caller might get the same item twice from successive calls (or otherwise), if the first call was in a transaction that rolled back. More...
 
override void Open (ExecutionContext executionContext)
 Open the stream for the provided ExecutionContext. More...
 
override void Close ()
 If any resources are needed for the stream to operate they need to be destroyed here. Once this method has been called all other methods (except open) may throw an exception. More...
 
override void Update (ExecutionContext executionContext)
 Indicates that the execution context provided during open is about to be saved. If any state is remaining, but has not been put in the context, it should be added here. More...
 
- Public Member Functions inherited from Summer.Batch.Infrastructure.Item.Util.ItemStreamSupport
virtual void Flush ()
 Flushes the stream. More...
 
string GetExecutionContextKey (string key)
 Transform the given key to use the name of this instance as prefix. More...
 
virtual void Dispose ()
 

Protected Member Functions

abstract T DoRead ()
 Reads the next item from input. More...
 
abstract void DoOpen ()
 Opens the stream. More...
 
abstract void DoClose ()
 Closes the stream. More...
 
virtual void JumpToItem (int itemIndex)
 Move to the given item index. More...
 
- Protected Member Functions inherited from Summer.Batch.Infrastructure.Item.Util.ItemStreamSupport
virtual void Dispose (bool disposing)
 Does the actual dipose, delegating to Close(); More...
 

Properties

int CurrentItemCount [protected get, set]
 The index of the item to start reading from. If the execution context contains a key [name].read.count (where [name] is the name of this component), the value from the execution context will be used instead. More...
 
int MaxItemCount [set]
 The maximum index of the items to be read. If the execution context contains a key [name].read.count.max (where [name] is the name of this component), the value from the execution context will be used instead. More...
 
bool SaveState [get, set]
 Flat that determines whether to save internal data in the execution context. Default value is true. Switch to false if you don't want to save any state from this stream or you don't want it to be restartable. More...
 
- Properties inherited from Summer.Batch.Infrastructure.Item.Util.ItemStreamSupport
string Name [set]
 The name of the component that will be used as prefix for keys in the execution context. More...
 

Detailed Description

Abstract superclass for IItemReaders that supports restart by storing item count in the execution context and therefore requires item ordering to be preserved between runs.

Template Parameters
T The type of the read items
Type Constraints
T :class 

Member Function Documentation

If any resources are needed for the stream to operate they need to be destroyed here. Once this method has been called all other methods (except open) may throw an exception.

Exceptions
ItemStreamException 

Reimplemented from Summer.Batch.Infrastructure.Item.Util.ItemStreamSupport.

Reads the next item from input.

Returns
the read item or null if the end of the stream has been reached

Implemented in Summer.Batch.Infrastructure.Item.Database.DataReaderItemReader< T >, Summer.Batch.Infrastructure.Item.File.FlatFileItemReader< T >, and Summer.Batch.Extra.Ebcdic.EbcdicFileReader< T >.

virtual void Summer.Batch.Infrastructure.Item.Support.AbstractItemCountingItemStreamItemReader< T >.JumpToItem ( int  itemIndex)
protectedvirtual

Move to the given item index.

Parameters
itemIndexzero-based index of the item to jump to

Reimplemented in Summer.Batch.Infrastructure.Item.File.FlatFileItemReader< T >.

Open the stream for the provided ExecutionContext.

Parameters
executionContextcurrent step's ExecutionContext. Will be the executionContext from the last run of the step on a restart.
Exceptions
ItemStreamException 
ArgumentException if execution context is null

Reimplemented from Summer.Batch.Infrastructure.Item.Util.ItemStreamSupport.

Reads a piece of input data and advance to the next one. Implementations must return null at the end of the input data set. In a transactional setting, caller might get the same item twice from successive calls (or otherwise), if the first call was in a transaction that rolled back.

Returns
Exceptions
Exception 
UnexpectedInputException 
NonTransientResourceException 
ParseException 

Implements Summer.Batch.Infrastructure.Item.Support.AbstractItemStreamItemReader< T >.

Indicates that the execution context provided during open is about to be saved. If any state is remaining, but has not been put in the context, it should be added here.

Parameters
executionContextto be updated
Exceptions
ItemStreamException 
ArgumentException if execution context is null

Reimplemented from Summer.Batch.Infrastructure.Item.Util.ItemStreamSupport.

Property Documentation

The index of the item to start reading from. If the execution context contains a key [name].read.count (where [name] is the name of this component), the value from the execution context will be used instead.

The maximum index of the items to be read. If the execution context contains a key [name].read.count.max (where [name] is the name of this component), the value from the execution context will be used instead.

Flat that determines whether to save internal data in the execution context. Default value is true. Switch to false if you don't want to save any state from this stream or you don't want it to be restartable.


The documentation for this class was generated from the following file:
  • Summer.Batch.Infrastructure/Item/Support/AbstractItemCountingItemStreamItemReader.cs