gr.uoa.di.madgik.grs.store.event
Class FileEventStore

java.lang.Object
  extended by gr.uoa.di.madgik.grs.store.event.FileEventStore
All Implemented Interfaces:
IEventStore

public class FileEventStore
extends java.lang.Object
implements IEventStore

Implementation of the IEventStore using a RandomAccessFile over a local file as the persistency medium

Author:
gpapanikos

Constructor Summary
FileEventStore()
          Creates a new instance
 
Method Summary
 void dispose()
          Disposes the IEventStore instance as well as any permanent storage resources occupied
 long getEventCount()
          Retrieves the number of BufferEvents stored using this IEventStore
 void persist(BufferEvent event)
          Persists the provided BufferEvent
 BufferEvent retrieveByIndex(long eventIndex)
          Retrieve a previously stored BufferEvent based on the index by which it was stored
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileEventStore

public FileEventStore()
               throws java.io.IOException
Creates a new instance

Throws:
java.io.IOException
Method Detail

getEventCount

public long getEventCount()
Retrieves the number of BufferEvents stored using this IEventStore

Specified by:
getEventCount in interface IEventStore
Returns:
the number of BufferEvents stored
See Also:
IEventStore.getEventCount()

dispose

public void dispose()
             throws GRS2EventStoreException
Disposes the IEventStore instance as well as any permanent storage resources occupied

Specified by:
dispose in interface IEventStore
Throws:
GRS2EventStoreException - the state of the IEventStore does not allow for this operation to be completed
See Also:
IEventStore.dispose()

persist

public void persist(BufferEvent event)
             throws GRS2EventStoreException
Persists the provided BufferEvent

Specified by:
persist in interface IEventStore
Parameters:
event - the BufferEvent to persist
Throws:
GRS2EventStoreException - the state of the IEventStore does not allow for this operation to be completed
See Also:
IEventStore.persist(BufferEvent)

retrieveByIndex

public BufferEvent retrieveByIndex(long eventIndex)
                            throws GRS2EventStoreException
Retrieve a previously stored BufferEvent based on the index by which it was stored

Specified by:
retrieveByIndex in interface IEventStore
Parameters:
eventIndex - The index by which the BufferEvent to be retrieved was stored
Returns:
the BufferEvent retrieved
Throws:
GRS2EventStoreException - the state of the IEventStore does not allow for this operation to be completed
See Also:
IEventStore.retrieveByIndex(long)