cgl.narada.service.storage.file
Class StorageServiceFileImpl

java.lang.Object
  extended by cgl.narada.service.storage.file.StorageServiceFileImpl
All Implemented Interfaces:
StorageService

public class StorageServiceFileImpl
extends Object
implements StorageService

Storage Service File implement

Version:
1.0

Field Summary
static StorageServiceFileImpl fileStore
           
 
Method Summary
 void advanceCatenation(int catenation, int templateId, int entityId)
          Advance the catenation associated with an entity
 void advanceSyncpoint(long syncpoint, int templateId, int entityId)
          Advance the sync point associated with an entity
 long[] checkIfSequencesBelongToTemplate(int templateId, long[] sequences)
          This method checks to see if the sequences in the arguments belong to the specified template.
 int getCatenation(int templateId, int entityId)
          Get the catenation associated with an entity
 TemplateInfo[] getListOfManagedTemplates()
          Returns a array containing the list of managed templates
 int[] getListOfRegisteredEntities()
          Returns a list of registered entities
 int[] getListOfRegisteredEntities(int tID)
          Returns a list of registered entities to a given template
 Profile[] getListOfRegisteredProfiles(int templateId)
          Returns a list of profiles registered to a given template
 long getSequenceNumberLastAssigned()
          Returns the sequence number last assigned by the reliable delivery service
 long getSequenceNumberLastAssigned(int templateId)
          Returns the sequence number last assigned by the reliable delivery service for a given templateId
static StorageService getStorageService(Properties props)
           
 InventoryEvent getStoredEvent(long seq)
          Upon receipt of a NAK request we need to retrieve the inventory event that corresponds to
 long getSyncpoint(int templateId, int entityId)
          Get the syncpoint associated with an entity
 long getTimestamp(long sequnceNumber, int templateId)
           
 void printEntityInventory()
           
 void printEntityTemplate()
           
 void printInventory()
           
 void processAcknowledgement(long seq, int eID)
          Process the acknowledgement of an event's receipt by an entity
 void removeEntityFromTemplate(int eID, int tID)
          Deregister's an entity from a managed template
 void removeProfile(int templateId, Profile profile)
           
 void removeRegisteredEntity(int entityId)
          Removes a registered entity.
 void removeTemplateManagement(int templateId)
           
 LinkedList retrieveMaximumSequeceNumberAndTimestamp(int temlateId)
           
 LinkedList retrieveMinimumSequeceNumberAndTimestamp(int temlateId)
           
 long[] retrieveMissedSequences(long startingAt, long endingAt, int templateId, int entityId)
          Retrieves a list of missed sequences between the specified range of sequence numbers.
 long[] retrieveSequences(long startingAt, long endingAt, int templateId, int maxOccur)
          Between the sequence range specified, this method returns all sequences which belong to the specified template.
 LinkedList retrieveSequencesAndTimestamps(int templateId)
           
 LinkedList retrieveSequencesAndTimestamps(long startingTimestamp, long endingTimestamp, int templateId)
           
 LinkedList retrieveSequencesAndTimestampsStartingAt(long startingSequenceNumber, long endingTimestamp, int templateId)
           
 LinkedList retrieveSequencesByTimestamps(long startingTimestamp, long endingTimestamp, int templateId)
           
 long retrieveTimestamp(int templateId, long sequenceNumber)
           
 void store(CompanionDbInfo companionDbInfo, InventoryEvent iEvent, SequenceDestinations seqDestinations)
          This method should not return unless the event has been written to stable storage
 void storeEntityForTemplate(int eID, int tID)
           
 void storeProfile(int templateId, Profile profile)
           
 void storeRegisteredEntity(int entityId)
          Stores a registered entity
 void storeTemplate(TemplateInfo templateInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileStore

public static StorageServiceFileImpl fileStore
Method Detail

getStorageService

public static StorageService getStorageService(Properties props)

storeProfile

public void storeProfile(int templateId,
                         Profile profile)
                  throws ServiceException
Specified by:
storeProfile in interface StorageService
Throws:
ServiceException

removeProfile

public void removeProfile(int templateId,
                          Profile profile)
                   throws ServiceException
Specified by:
removeProfile in interface StorageService
Throws:
ServiceException

storeRegisteredEntity

public void storeRegisteredEntity(int entityId)
                           throws ServiceException
Description copied from interface: StorageService
Stores a registered entity

Specified by:
storeRegisteredEntity in interface StorageService
Throws:
ServiceException

removeRegisteredEntity

public void removeRegisteredEntity(int entityId)
                            throws ServiceException
Removes a registered entity. This method should also remove the entity from any profiles that it was subscribed to and and templateId to which it was registered

Specified by:
removeRegisteredEntity in interface StorageService
Throws:
ServiceException

storeTemplate

public void storeTemplate(TemplateInfo templateInfo)
                   throws ServiceException
Specified by:
storeTemplate in interface StorageService
Throws:
ServiceException

removeTemplateManagement

public void removeTemplateManagement(int templateId)
                              throws ServiceException
Specified by:
removeTemplateManagement in interface StorageService
Throws:
ServiceException

storeEntityForTemplate

public void storeEntityForTemplate(int eID,
                                   int tID)
                            throws ServiceException
Specified by:
storeEntityForTemplate in interface StorageService
Throws:
ServiceException

removeEntityFromTemplate

public void removeEntityFromTemplate(int eID,
                                     int tID)
                              throws ServiceException
Description copied from interface: StorageService
Deregister's an entity from a managed template

Specified by:
removeEntityFromTemplate in interface StorageService
Throws:
ServiceException

getListOfRegisteredEntities

public int[] getListOfRegisteredEntities()
                                  throws ServiceException
Description copied from interface: StorageService
Returns a list of registered entities

Specified by:
getListOfRegisteredEntities in interface StorageService
Throws:
ServiceException

printEntityInventory

public void printEntityInventory()

printInventory

public void printInventory()

printEntityTemplate

public void printEntityTemplate()

getListOfRegisteredEntities

public int[] getListOfRegisteredEntities(int tID)
                                  throws ServiceException
Description copied from interface: StorageService
Returns a list of registered entities to a given template

Specified by:
getListOfRegisteredEntities in interface StorageService
Throws:
ServiceException

getListOfRegisteredProfiles

public Profile[] getListOfRegisteredProfiles(int templateId)
                                      throws ServiceException
Description copied from interface: StorageService
Returns a list of profiles registered to a given template

Specified by:
getListOfRegisteredProfiles in interface StorageService
Throws:
ServiceException

getListOfManagedTemplates

public TemplateInfo[] getListOfManagedTemplates()
                                         throws ServiceException
Description copied from interface: StorageService
Returns a array containing the list of managed templates

Specified by:
getListOfManagedTemplates in interface StorageService
Throws:
ServiceException

store

public void store(CompanionDbInfo companionDbInfo,
                  InventoryEvent iEvent,
                  SequenceDestinations seqDestinations)
           throws ServiceException
Description copied from interface: StorageService
This method should not return unless the event has been written to stable storage

Specified by:
store in interface StorageService
Throws:
ServiceException

getStoredEvent

public InventoryEvent getStoredEvent(long seq)
                              throws ServiceException
Description copied from interface: StorageService
Upon receipt of a NAK request we need to retrieve the inventory event that corresponds to

Specified by:
getStoredEvent in interface StorageService
Throws:
ServiceException

processAcknowledgement

public void processAcknowledgement(long seq,
                                   int eID)
                            throws ServiceException
Description copied from interface: StorageService
Process the acknowledgement of an event's receipt by an entity

Specified by:
processAcknowledgement in interface StorageService
Throws:
ServiceException

retrieveMissedSequences

public long[] retrieveMissedSequences(long startingAt,
                                      long endingAt,
                                      int templateId,
                                      int entityId)
                               throws ServiceException
Description copied from interface: StorageService
Retrieves a list of missed sequences between the specified range of sequence numbers. This method will return a null if there are indeed no missed sequences

Specified by:
retrieveMissedSequences in interface StorageService
Throws:
ServiceException

advanceSyncpoint

public void advanceSyncpoint(long syncpoint,
                             int templateId,
                             int entityId)
                      throws ServiceException
Description copied from interface: StorageService
Advance the sync point associated with an entity

Specified by:
advanceSyncpoint in interface StorageService
Throws:
ServiceException

getSyncpoint

public long getSyncpoint(int templateId,
                         int entityId)
                  throws ServiceException
Description copied from interface: StorageService
Get the syncpoint associated with an entity

Specified by:
getSyncpoint in interface StorageService
Throws:
ServiceException

advanceCatenation

public void advanceCatenation(int catenation,
                              int templateId,
                              int entityId)
                       throws ServiceException
Description copied from interface: StorageService
Advance the catenation associated with an entity

Specified by:
advanceCatenation in interface StorageService
Throws:
ServiceException

getCatenation

public int getCatenation(int templateId,
                         int entityId)
                  throws ServiceException
Description copied from interface: StorageService
Get the catenation associated with an entity

Specified by:
getCatenation in interface StorageService
Throws:
ServiceException

getSequenceNumberLastAssigned

public long getSequenceNumberLastAssigned()
                                   throws ServiceException
Description copied from interface: StorageService
Returns the sequence number last assigned by the reliable delivery service

Specified by:
getSequenceNumberLastAssigned in interface StorageService
Throws:
ServiceException

getSequenceNumberLastAssigned

public long getSequenceNumberLastAssigned(int templateId)
                                   throws ServiceException
Description copied from interface: StorageService
Returns the sequence number last assigned by the reliable delivery service for a given templateId

Specified by:
getSequenceNumberLastAssigned in interface StorageService
Throws:
ServiceException

checkIfSequencesBelongToTemplate

public long[] checkIfSequencesBelongToTemplate(int templateId,
                                               long[] sequences)
                                        throws ServiceException
Description copied from interface: StorageService
This method checks to see if the sequences in the arguments belong to the specified template. The return argument of this method, is the list of sequences that did not belong to the template in question. If the return value is null it implies that all the sequences passed as an argument to this method did indeed belong to the template in question

Specified by:
checkIfSequencesBelongToTemplate in interface StorageService
Throws:
ServiceException

retrieveSequences

public long[] retrieveSequences(long startingAt,
                                long endingAt,
                                int templateId,
                                int maxOccur)
                         throws ServiceException
Description copied from interface: StorageService
Between the sequence range specified, this method returns all sequences which belong to the specified template. The maxOccurs variable controls the maximum number of sequences that needs to be returned by this method.

Specified by:
retrieveSequences in interface StorageService
Throws:
ServiceException

retrieveSequencesAndTimestamps

public LinkedList retrieveSequencesAndTimestamps(int templateId)
                                          throws ServiceException
Specified by:
retrieveSequencesAndTimestamps in interface StorageService
Throws:
ServiceException

retrieveSequencesAndTimestamps

public LinkedList retrieveSequencesAndTimestamps(long startingTimestamp,
                                                 long endingTimestamp,
                                                 int templateId)
                                          throws ServiceException
Specified by:
retrieveSequencesAndTimestamps in interface StorageService
Throws:
ServiceException

retrieveTimestamp

public long retrieveTimestamp(int templateId,
                              long sequenceNumber)
                       throws ServiceException
Specified by:
retrieveTimestamp in interface StorageService
Throws:
ServiceException

retrieveSequencesAndTimestampsStartingAt

public LinkedList retrieveSequencesAndTimestampsStartingAt(long startingSequenceNumber,
                                                           long endingTimestamp,
                                                           int templateId)
                                                    throws ServiceException
Specified by:
retrieveSequencesAndTimestampsStartingAt in interface StorageService
Throws:
ServiceException

retrieveSequencesByTimestamps

public LinkedList retrieveSequencesByTimestamps(long startingTimestamp,
                                                long endingTimestamp,
                                                int templateId)
                                         throws ServiceException
Specified by:
retrieveSequencesByTimestamps in interface StorageService
Throws:
ServiceException

getTimestamp

public long getTimestamp(long sequnceNumber,
                         int templateId)
                  throws ServiceException
Specified by:
getTimestamp in interface StorageService
Throws:
ServiceException

retrieveMinimumSequeceNumberAndTimestamp

public LinkedList retrieveMinimumSequeceNumberAndTimestamp(int temlateId)
                                                    throws ServiceException
Specified by:
retrieveMinimumSequeceNumberAndTimestamp in interface StorageService
Throws:
ServiceException

retrieveMaximumSequeceNumberAndTimestamp

public LinkedList retrieveMaximumSequeceNumberAndTimestamp(int temlateId)
                                                    throws ServiceException
Specified by:
retrieveMaximumSequeceNumberAndTimestamp in interface StorageService
Throws:
ServiceException


For comments and suggestions please send e-mail to The NaradaBrokering Project