com.northconcepts.datapipeline.core
Class ProxyReader

java.lang.Object
  extended by com.northconcepts.datapipeline.core.DataEndpoint
      extended by com.northconcepts.datapipeline.core.DataReader
          extended by com.northconcepts.datapipeline.core.ProxyReader
Direct Known Subclasses:
AggregateReader, AsyncReader, DebugReader, FilteringReader, MeteredReader, RemoveDuplicatesReader, SortingReader, TransformingReader

public class ProxyReader
extends DataReader

Abstract super-class for obtaining records from another DataReader, possibly transforming them along the way. The only method that a subclass should implement is interceptRecord(Record).


Nested Class Summary
 
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State
 
Field Summary
 
Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
BUFFER_SIZE, log
 
Constructor Summary
ProxyReader(DataReader nestedDataReader)
           
 
Method Summary
 DataException addExceptionProperties(DataException exception)
          Adds this endpoint's current state to a DataException.
 int available()
          Returns the number of records that can probably be read without blocking.
 void close()
          Indicates that this endpoint has finished reading or writing.
 DataReader getNestedReader()
          Returns the DataReader held inside this one or null if there isn't one.
protected  Record interceptRecord(Record record)
           
 void open()
          Makes this endpoint ready for reading or writing.
protected  Record readImpl()
          Overridden by subclasses to read the next record from this DataReader.
protected  void setNestedDataReader(DataReader nestedDataReader)
          Make sure to close old target and open the new one or call #setTargetDataReader(DataReader, boolean) with true.
protected  void setNestedDataReader(DataReader nestedDataReader, boolean manageLifecycle)
           
 
Methods inherited from class com.northconcepts.datapipeline.core.DataReader
getBufferSize, getRootReader, peek, pop, push, read, skip
 
Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
assertNotOpened, assertOpened, decrementRecordCount, exception, exception, exception, finalize, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, getState, incrementRecordCount, isClosed, isOpen, isRecordCountBigInteger, resetRecordCount, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProxyReader

public ProxyReader(DataReader nestedDataReader)
Method Detail

getNestedReader

public DataReader getNestedReader()
Description copied from class: DataReader
Returns the DataReader held inside this one or null if there isn't one.

Overrides:
getNestedReader in class DataReader

setNestedDataReader

protected void setNestedDataReader(DataReader nestedDataReader)
Make sure to close old target and open the new one or call #setTargetDataReader(DataReader, boolean) with true.


setNestedDataReader

protected void setNestedDataReader(DataReader nestedDataReader,
                                   boolean manageLifecycle)
                            throws DataException
Throws:
DataException

available

public int available()
              throws DataException
Description copied from class: DataReader
Returns the number of records that can probably be read without blocking.

Overrides:
available in class DataReader
Throws:
DataException

open

public void open()
          throws DataException
Description copied from class: DataEndpoint
Makes this endpoint ready for reading or writing.

Overrides:
open in class DataEndpoint
Throws:
DataException

close

public void close()
           throws DataException
Description copied from class: DataEndpoint
Indicates that this endpoint has finished reading or writing.

Overrides:
close in class DataEndpoint
Throws:
DataException

interceptRecord

protected Record interceptRecord(Record record)
                          throws Throwable
Throws:
Throwable

readImpl

protected Record readImpl()
                   throws Throwable
Description copied from class: DataReader
Overridden by subclasses to read the next record from this DataReader.

If no record is available, null will be returned.

Specified by:
readImpl in class DataReader
Throws:
Throwable

addExceptionProperties

public DataException addExceptionProperties(DataException exception)
Description copied from class: DataEndpoint
Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.

Overrides:
addExceptionProperties in class DataReader


Copyright (c) 2007-2009 North Concepts Inc. All Rights Reserved.