com.northconcepts.datapipeline.jdbc
Class JdbcReader

java.lang.Object
  extended by com.northconcepts.datapipeline.core.DataEndpoint
      extended by com.northconcepts.datapipeline.core.DataReader
          extended by com.northconcepts.datapipeline.jdbc.JdbcReader

public class JdbcReader
extends DataReader

Obtains records from a database query.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State
 
Field Summary
protected  Record currentRecord
           
 
Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
BUFFER_SIZE, log
 
Constructor Summary
JdbcReader(Connection connection, String queryString)
           
JdbcReader(Connection connection, String queryString, Object... parameters)
           
JdbcReader(Connection connection, String queryString, Object[] parameters, int[] parameterSqlTypes)
           
 
Method Summary
 DataException addExceptionProperties(DataException exception)
          Adds this endpoint's current state to a DataException.
 void close()
          Indicates that this endpoint has finished reading or writing.
 boolean getAutoCloseConnection()
           
 JdbcValueReader getValueReader()
           
 void open()
          Makes this endpoint ready for reading or writing.
 Record read()
          Reads the next record from this DataReader and increases the record-count by 1.
protected  Record readImpl()
          Overridden by subclasses to read the next record from this DataReader.
 JdbcReader setAutoCloseConnection(boolean closeConnection)
           
 JdbcReader setValueReader(JdbcValueReader valueReader)
           
 
Methods inherited from class com.northconcepts.datapipeline.core.DataReader
available, getBufferSize, getNestedReader, getRootReader, peek, pop, push, skip
 
Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
assertNotOpened, assertOpened, decrementRecordCount, exception, exception, exception, finalize, getDescription, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, getState, incrementRecordCount, isClosed, isOpen, isRecordCountBigInteger, resetRecordCount, setDescription, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentRecord

protected Record currentRecord
Constructor Detail

JdbcReader

public JdbcReader(Connection connection,
                  String queryString)

JdbcReader

public JdbcReader(Connection connection,
                  String queryString,
                  Object... parameters)

JdbcReader

public JdbcReader(Connection connection,
                  String queryString,
                  Object[] parameters,
                  int[] parameterSqlTypes)
Method Detail

getAutoCloseConnection

public boolean getAutoCloseConnection()

setAutoCloseConnection

public JdbcReader setAutoCloseConnection(boolean closeConnection)

getValueReader

public JdbcValueReader getValueReader()

setValueReader

public JdbcReader setValueReader(JdbcValueReader valueReader)

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

read

public Record read()
            throws DataException
Description copied from class: DataReader
Reads the next record from this DataReader and increases the record-count by 1. This method will first read any pushed (DataReader.push(Record)) records before reading from the underlying source.

If no record is available, null will be returned. This method blocks until a record is available, the end of the stream is reached, or an exception is thrown.

Any exception raised while writing will be converted to a DataException using DataEndpoint.exception(Throwable).

Subclasses generally do not need to override this method, instead they should implement DataReader.readImpl().

Overrides:
read in class DataReader
Throws:
DataException
See Also:
DataReader.push(Record), DataReader.peek(int), DataReader.read()

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

open

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

Overrides:
open in class DataEndpoint

close

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

Overrides:
close in class DataEndpoint


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