|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.endeca.itl.recordstore.RecordStoreReader
public class RecordStoreReader
Used to read records out of a Record Store. This hides the details of the batching required for communication with the Record Store web service. Here's an example of an incremental read of the last committed generation in the Record Store:
RecordStoreLocator locator = RecordStoreLocator.create(casHost, casPort, "MyRecordStore"); RecordStore recordStore = locator.getService(); TransactionId transactionId = recordStore.startTransaction(TransactionType.READ); RecordStoreReader reader = RecordStoreReader.createBaselineReader(recordStore, transactionId); while (reader.hasNext()) { Record record = reader.next(); // Do something with the record } reader.close(); recordStore.commitTransaction(transactionId);
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 |
---|
public static RecordStoreReader createBaselineReader(RecordStore recordStore, TransactionId transactionId, GenerationId generationId, Integer recordsPerTransfer) throws RecordStoreException, TransactionStateException, TransactionNotFoundException, InvalidGenerationException
recordStore
- Record Store to read fromtransactionId
- Transaction to read ongenerationId
- Generation to read fromrecordsPerTransfer
- Number of records transferred at once
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 existpublic static RecordStoreReader createBaselineReader(RecordStore recordStore, TransactionId transactionId, GenerationId generationId) throws RecordStoreException, TransactionStateException, TransactionNotFoundException, InvalidGenerationException
recordStore
- Record Store to read fromtransactionId
- Transaction to read ongenerationId
- Generation to read from
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 existpublic static RecordStoreReader createBaselineReader(RecordStore recordStore, TransactionId transactionId) throws RecordStoreException, TransactionStateException, TransactionNotFoundException, InvalidGenerationException
recordStore
- Record Store to read fromtransactionId
- Transaction to read on
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 existpublic static RecordStoreReader createDeltaReader(RecordStore recordStore, TransactionId transactionId, GenerationId startGenerationId, GenerationId endGenerationId, Integer recordsPerTransfer) throws RecordStoreException, TransactionStateException, TransactionNotFoundException, InvalidGenerationException
recordStore
- Record Store to read fromtransactionId
- Transaction to read onstartGenerationId
- Generation to start onendGenerationId
- Generation to end onrecordsPerTransfer
- Number of records transferred at once
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 existpublic static RecordStoreReader createDeltaReader(RecordStore recordStore, TransactionId transactionId, GenerationId startGenerationId, GenerationId endGenerationId) throws RecordStoreException, TransactionStateException, TransactionNotFoundException, InvalidGenerationException
recordStore
- Record Store to read fromtransactionId
- Transaction to read onstartGenerationId
- Generation to start onendGenerationId
- Generation to end on
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 existpublic static RecordStoreReader createDeltaReader(RecordStore recordStore, TransactionId transactionId, GenerationId startGenerationId) throws RecordStoreException, TransactionStateException, TransactionNotFoundException, InvalidGenerationException
recordStore
- Record Store to read fromtransactionId
- Transaction to read onstartGenerationId
- Generation to start on
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 existpublic static RecordStoreReader createReaderWithExistingCursor(RecordStore recordStore, ReadCursorId readCursorId, Integer recordsPerTransfer)
recordStore
- Record Store to read fromreadCursorId
- The cursor that will be used by the ReaderrecordsPerTransfer
- Number of records transferred at once
public static RecordStoreReader createReaderWithExistingCursor(RecordStore recordStore, ReadCursorId readCursorId)
recordStore
- Record Store to read fromreadCursorId
- The cursor that will be used by the Reader
public boolean hasNext() throws RecordStoreException, TransactionStateException, ReadCursorNotFoundException, TransactionNotFoundException
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)public Record next() throws RecordStoreException, TransactionStateException, ReadCursorNotFoundException, TransactionNotFoundException
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)public void close() throws RecordStoreException, TransactionStateException, ReadCursorNotFoundException, TransactionNotFoundException
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |