gr.uoa.di.madgik.grs.store.buffer
Class BufferStoreEntry

java.lang.Object
  extended by gr.uoa.di.madgik.grs.store.buffer.BufferStoreEntry

public class BufferStoreEntry
extends java.lang.Object

This entry holds information per incoming locator to be used by IBufferStore implementations. This information includes the locator that is managed, the reader that is used to iterate over the Records accessible through the locator, the IRecordStore that persists the retrieved Records, the IEventStore that persists the received BufferEvents as well as a persisted location holding the RecordDefinitions that are needed to be available for the Records to be reused

Author:
gpapanikos

Nested Class Summary
static class BufferStoreEntry.EntryStatus
          The status of the entry
 
Constructor Summary
BufferStoreEntry(java.net.URI locator)
          Create a new instance
 
Method Summary
 void dispose()
          Disposes all state kept as well as the initialized ForwardReader.close(), IRecordStore.dispose() and removes the persisted RecordDefinitions
 RecordDefinition[] getDefinitions()
          Retrieves the RecordDefinitions from the persisted location it has stored them at initialization
 IEventStore getEventManager()
          Retrieves the IEventStore manager that is used to persist incoming BufferEvents
 ForwardReader<Record> getReader()
          Retrieves the reader used to iterate over the Records of the incoming locator
 long getReaderTimeout()
          Retrieves the timeout set to be used by the reader of the incoming locator.
 java.util.concurrent.TimeUnit getReaderTimeoutTimeUnit()
          Retrieves the timeout time unit set to be used by the reader of the incoming locator.
 IRecordStore getRecordManager()
          Retrieves the IRecordStore manager that is used to persist incoming Records
 BufferStoreEntry.EntryStatus getStatus()
          Retrieves the status of the entry
 void initialize()
          After all configuration values have been set, this method initializes the IRecordStore, the ForwardReader, and persists the reader available RecordDefinitions
 void setReaderTimeout(long timeout)
          Sets the timeout set to be used by the reader of the incoming locator.
 void setReaderTimeoutTimeUnit(java.util.concurrent.TimeUnit unit)
          Sets the timeout time unit set to be used by the reader of the incoming locator.
 void setStatus(BufferStoreEntry.EntryStatus status)
          Sets the status of the entry
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferStoreEntry

public BufferStoreEntry(java.net.URI locator)
Create a new instance

Parameters:
locator - the locator pointing to the incoming IBuffer
Method Detail

getStatus

public BufferStoreEntry.EntryStatus getStatus()
Retrieves the status of the entry

Returns:
the status

setStatus

public void setStatus(BufferStoreEntry.EntryStatus status)
Sets the status of the entry

Parameters:
status - the status

getReader

public ForwardReader<Record> getReader()
Retrieves the reader used to iterate over the Records of the incoming locator

Returns:
the reader

getRecordManager

public IRecordStore getRecordManager()
Retrieves the IRecordStore manager that is used to persist incoming Records

Returns:
the used manager

getEventManager

public IEventStore getEventManager()
Retrieves the IEventStore manager that is used to persist incoming BufferEvents

Returns:
the used manager

getReaderTimeout

public long getReaderTimeout()
Retrieves the timeout set to be used by the reader of the incoming locator. This value is to be used in conjunction with the getReaderTimeoutTimeUnit()

Returns:
the timeout

setReaderTimeout

public void setReaderTimeout(long timeout)
Sets the timeout set to be used by the reader of the incoming locator. This value is to be used in conjunction with the setReaderTimeoutTimeUnit(TimeUnit)

Parameters:
timeout - the timeout

getReaderTimeoutTimeUnit

public java.util.concurrent.TimeUnit getReaderTimeoutTimeUnit()
Retrieves the timeout time unit set to be used by the reader of the incoming locator. This value is to be used in conjunction with the getReaderTimeout()

Returns:
the time unit

setReaderTimeoutTimeUnit

public void setReaderTimeoutTimeUnit(java.util.concurrent.TimeUnit unit)
Sets the timeout time unit set to be used by the reader of the incoming locator. This value is to be used in conjunction with the setReaderTimeout(long)

Parameters:
unit - the time unit

initialize

public void initialize()
                throws GRS2RecordStoreException,
                       GRS2ReaderException,
                       GRS2BufferStoreAccessException,
                       GRS2EventStoreException
After all configuration values have been set, this method initializes the IRecordStore, the ForwardReader, and persists the reader available RecordDefinitions

Throws:
GRS2RecordStoreException - the state of the IRecordStore does not allow for this operation to be completed
GRS2ReaderException - the state of the ForwardReader does not allow for this operation to be completed
GRS2BufferStoreAccessException - the state of the IBufferStore does not allow for this operation to be completed
GRS2EventStoreException - the state of the IEventStore does not allow for this operation to be completed

dispose

public void dispose()
Disposes all state kept as well as the initialized ForwardReader.close(), IRecordStore.dispose() and removes the persisted RecordDefinitions


getDefinitions

public RecordDefinition[] getDefinitions()
                                  throws GRS2BufferStoreAccessException
Retrieves the RecordDefinitions from the persisted location it has stored them at initialization

Returns:
the RecordDefinitions of the incoming locator
Throws:
GRS2BufferStoreAccessException - the state of the IBufferStore does not allow for this operation to be completed