com.endeca.itl.recordstore
Class RecordStoreReader

java.lang.Object
  extended by com.endeca.itl.recordstore.RecordStoreReader

public class RecordStoreReader
extends Object

Used to Read Records out of a Record Store


Method Summary
 void close()
          Frees resources on the CAS server that were in use by this instance of RecordStoreReader.
static RecordStoreReader createBaselineReader(RecordStore recordStore, TransactionId transactionId)
          Creates a RecordStoreReader that performs a baseline read of the last committed generation Id.
static RecordStoreReader createBaselineReader(RecordStore recordStore, TransactionId transactionId, GenerationId generationId)
          Creates a RecordStoreReader that performs a baseline read.
static RecordStoreReader createBaselineReader(RecordStore recordStore, TransactionId transactionId, GenerationId generationId, Integer recordsPerTransfer)
          Creates a RecordStoreReader that performs a baseline read.
static RecordStoreReader createDeltaReader(RecordStore recordStore, TransactionId transactionId, GenerationId startGenerationId)
          Creates a RecordStoreReader that performs a delta read.
static RecordStoreReader createDeltaReader(RecordStore recordStore, TransactionId transactionId, GenerationId startGenerationId, GenerationId endGenerationId)
          Creates a RecordStoreReader that performs a delta read.
static RecordStoreReader createDeltaReader(RecordStore recordStore, TransactionId transactionId, GenerationId startGenerationId, GenerationId endGenerationId, Integer recordsPerTransfer)
          Creates a RecordStoreReader that performs a delta read.
static RecordStoreReader createReaderWithExistingCursor(RecordStore recordStore, ReadCursorId readCursorId)
           
static RecordStoreReader createReaderWithExistingCursor(RecordStore recordStore, ReadCursorId readCursorId, Integer recordsPerTransfer)
           
 boolean hasNext()
           
 Record next()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createBaselineReader

public static RecordStoreReader createBaselineReader(RecordStore recordStore,
                                                     TransactionId transactionId,
                                                     GenerationId generationId,
                                                     Integer recordsPerTransfer)
                                              throws RecordStoreException,
                                                     TransactionStateException,
                                                     TransactionNotFoundException,
                                                     InvalidGenerationException
Creates a RecordStoreReader that performs a baseline read.

Parameters:
recordStore - Record Store to read from
transactionId - Transaction to read on
generationId - Generation to read from
recordsPerTransfer - Number of records transferred at once
Returns:
A new reader to read a baseline out of the Record Store
Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow the creation of this Reader
TransactionNotFoundException - If the transaction Id does not exist
InvalidGenerationException - If the generation Id does not exist

createBaselineReader

public static RecordStoreReader createBaselineReader(RecordStore recordStore,
                                                     TransactionId transactionId,
                                                     GenerationId generationId)
                                              throws RecordStoreException,
                                                     TransactionStateException,
                                                     TransactionNotFoundException,
                                                     InvalidGenerationException
Creates a RecordStoreReader that performs a baseline read.

Parameters:
recordStore - Record Store to read from
transactionId - Transaction to read on
generationId - Generation to read from
Returns:
A new reader to read a baseline out of the Record Store
Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow the creation of this Reader
TransactionNotFoundException - If the transaction Id does not exist
InvalidGenerationException - If the generation Id does not exist

createBaselineReader

public static RecordStoreReader createBaselineReader(RecordStore recordStore,
                                                     TransactionId transactionId)
                                              throws RecordStoreException,
                                                     TransactionStateException,
                                                     TransactionNotFoundException,
                                                     InvalidGenerationException
Creates a RecordStoreReader that performs a baseline read of the last committed generation Id.

Parameters:
recordStore - Record Store to read from
transactionId - Transaction to read on
Returns:
A new reader to read a baseline out of the Record Store
Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow the creation of this Reader
TransactionNotFoundException - If the transaction Id does not exist
InvalidGenerationException - If the generation Id does not exist

createDeltaReader

public static RecordStoreReader createDeltaReader(RecordStore recordStore,
                                                  TransactionId transactionId,
                                                  GenerationId startGenerationId,
                                                  GenerationId endGenerationId,
                                                  Integer recordsPerTransfer)
                                           throws RecordStoreException,
                                                  TransactionStateException,
                                                  TransactionNotFoundException,
                                                  InvalidGenerationException
Creates a RecordStoreReader that performs a delta read.

Parameters:
recordStore - Record Store to read from
transactionId - Transaction to read on
startGenerationId - Generation to start on
endGenerationId - Generation to end on
recordsPerTransfer - Number of records transferred at once
Returns:
A new reader to read a delta between the given generations
Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow the creation of this Reader
TransactionNotFoundException - If the transaction Id does not exist
InvalidGenerationException - If one of the generation Id does not exist

createDeltaReader

public static RecordStoreReader createDeltaReader(RecordStore recordStore,
                                                  TransactionId transactionId,
                                                  GenerationId startGenerationId,
                                                  GenerationId endGenerationId)
                                           throws RecordStoreException,
                                                  TransactionStateException,
                                                  TransactionNotFoundException,
                                                  InvalidGenerationException
Creates a RecordStoreReader that performs a delta read.

Parameters:
recordStore - Record Store to read from
transactionId - Transaction to read on
startGenerationId - Generation to start on
endGenerationId - Generation to end on
Returns:
A new reader to read a delta between the given generations
Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow the creation of this Reader
TransactionNotFoundException - If the transaction Id does not exist
InvalidGenerationException - If one of the generation Id does not exist

createDeltaReader

public static RecordStoreReader createDeltaReader(RecordStore recordStore,
                                                  TransactionId transactionId,
                                                  GenerationId startGenerationId)
                                           throws RecordStoreException,
                                                  TransactionStateException,
                                                  TransactionNotFoundException,
                                                  InvalidGenerationException
Creates a RecordStoreReader that performs a delta read.

Parameters:
recordStore - Record Store to read from
transactionId - Transaction to read on
startGenerationId - Generation to start on
Returns:
A new reader to read a delta between the given generation and the last written generation
Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow the creation of this Reader
TransactionNotFoundException - If the transaction Id does not exist
InvalidGenerationException - If the generation Id does not exist

createReaderWithExistingCursor

public static RecordStoreReader createReaderWithExistingCursor(RecordStore recordStore,
                                                               ReadCursorId readCursorId,
                                                               Integer recordsPerTransfer)
Parameters:
recordStore - Record Store to read from
readCursorId - The cursor that will be used by the Reader
recordsPerTransfer - Number of records transferred at once
Returns:
A new Reader

createReaderWithExistingCursor

public static RecordStoreReader createReaderWithExistingCursor(RecordStore recordStore,
                                                               ReadCursorId readCursorId)
Parameters:
recordStore - Record Store to read from
readCursorId - The cursor that will be used by the Reader
Returns:
A new Reader

hasNext

public boolean hasNext()
                throws RecordStoreException,
                       TransactionStateException,
                       ReadCursorNotFoundException,
                       TransactionNotFoundException
Returns:
True if this Reader has more records to read
Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow this operation
ReadCursorNotFoundException - If the read cursor is invalid
TransactionNotFoundException - If a valid transaction cannot be found (or the transaction tied to this Reader doesn't exist anymore)

next

public Record next()
            throws RecordStoreException,
                   TransactionStateException,
                   ReadCursorNotFoundException,
                   TransactionNotFoundException
Returns:
The next Record in the Reader
Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow this operation
ReadCursorNotFoundException - If the read cursor is invalid
TransactionNotFoundException - If a valid transaction cannot be found (or the transaction tied to this Reader doesn't exist anymore)

close

public void close()
           throws RecordStoreException,
                  TransactionStateException,
                  ReadCursorNotFoundException,
                  TransactionNotFoundException
Frees resources on the CAS server that were in use by this instance of RecordStoreReader.

Throws:
RecordStoreException - If there is an error in the Record Store
TransactionStateException - If the transaction is not in a state that will allow this operation
ReadCursorNotFoundException - If the read cursor is invalid
TransactionNotFoundException - If a valid transaction cannot be found (or the transaction tied to this Reader doesn't exist anymore)


Copyright © 2011 Endeca. All Rights Reserved.