uk.ac.soton.ecs.iam.grid.comms.client
Interface StateRepository

All Known Implementing Classes:
AbstractStateRepository, FileStateRepository, MemoryStateRepository

public interface StateRepository

A state repository is a database of conversations. New Conversation objects are created by the StateRepository, which typically stores them in a persistant database.


Method Summary
 void addListener(StateRepositoryListener listener)
          Add a listener which will receive RespositoryChangedEvents.
 void addObject(StorableInStateRepository object)
          Add this object to the repository.
 void checkForUpdates()
          Ensure that the repository is up-to-date.
 Conversation[] getAccountConversations()
          Deprecated. - use getConversationsByType(java.lang.Class) instead.
 StorableInStateRepository[] getAll()
          Returns all items in the state repository
 StorableInStateRepository[] getByParent(URL parent_cid)
          Returns a list of all children of the given conversation.
 Conversation getConversationByID(URL cid)
          Returns the Conversation object corresponding to the given URL.
<T extends Conversation>
T[]
getConversationsByType(Class<T> type)
          Return all conversations of the given type (a subclass of Conversation).
 StorableInStateRepository getObject(URL id)
          Get an object based on its URL.
<T extends StorableInStateRepository>
T
getOrCreateObject(Class<T> type, org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the existing object with this EPR's ID.
 StorableInStateRepository getOrCreateObject(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the existing object with this EPR's ID.
 String getProperty(QName name)
          Get a property set with setProperty.
 StorableInStateRepository[] getToplevel()
          Returns an array of all top-level object (those whose parent is null).
<T extends StorableInStateRepository>
T
instantiateObject(Class<T> type, org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Convenience wrapper for instantiateObject that sets the type in the EPR first.
 StorableInStateRepository instantiateObject(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Create a new object, in the same way that the StateRepository does when loading saved instances.
 void notifyChanged(StorableInStateRepository object)
          Deprecated. use notifyChanged(StorableInStateRepository, RepositoryChangedEventType)
 void notifyChanged(StorableInStateRepository object, RepositoryChangedEventType event)
          Notify listeners that this object has changed.
 void removeListener(StateRepositoryListener listener)
          Remove a listener previously added with addListener().
 void removeObject(StorableInStateRepository object)
          Remove this object from the repository.
 void setProperty(QName name, String value)
          Set a general property on the repository.
 

Method Detail

addObject

void addObject(StorableInStateRepository object)
               throws NoSuchConversation,
                      ObjectAlreadyExists
Add this object to the repository.

Throws:
ObjectAlreadyExists - if an object with the URL is already present.
NoSuchConversation - if the parent isn't in the repository

removeObject

void removeObject(StorableInStateRepository object)
                  throws NoSuchConversation
Remove this object from the repository.

Throws:
NoSuchConversation - if the object is not in the repository.

getObject

StorableInStateRepository getObject(URL id)
                                    throws NoSuchConversation
Get an object based on its URL.

Throws:
NoSuchConversation - if no object has this ID.

getConversationByID

Conversation getConversationByID(URL cid)
                                 throws NoSuchConversation
Returns the Conversation object corresponding to the given URL.

Throws:
NoSuchConversation

getAccountConversations

@Deprecated
Conversation[] getAccountConversations()
Deprecated. - use getConversationsByType(java.lang.Class) instead.

Returns an array of all account conversations.


getConversationsByType

<T extends Conversation> T[] getConversationsByType(Class<T> type)
Return all conversations of the given type (a subclass of Conversation).


getToplevel

StorableInStateRepository[] getToplevel()
Returns an array of all top-level object (those whose parent is null).


getByParent

StorableInStateRepository[] getByParent(URL parent_cid)
                                        throws NoSuchConversation
Returns a list of all children of the given conversation.

Throws:
NoSuchConversation

getAll

StorableInStateRepository[] getAll()
Returns all items in the state repository


addListener

void addListener(StateRepositoryListener listener)
Add a listener which will receive RespositoryChangedEvents.


removeListener

void removeListener(StateRepositoryListener listener)
Remove a listener previously added with addListener().


checkForUpdates

void checkForUpdates()
Ensure that the repository is up-to-date. If not, events will be sent to registered listeners. This call is only needed when the repository may have been modified by another process (if two programs are using the same repository at once).


instantiateObject

StorableInStateRepository instantiateObject(org.apache.axis.message.addressing.EndpointReferenceType EPR)
                                            throws ObjectAlreadyExists
Create a new object, in the same way that the StateRepository does when loading saved instances.

Throws:
ObjectAlreadyExists

instantiateObject

<T extends StorableInStateRepository> T instantiateObject(Class<T> type,
                                                          org.apache.axis.message.addressing.EndpointReferenceType EPR)
                                                      throws ObjectAlreadyExists
Convenience wrapper for instantiateObject that sets the type in the EPR first.

Throws:
ObjectAlreadyExists

getOrCreateObject

<T extends StorableInStateRepository> T getOrCreateObject(Class<T> type,
                                                          org.apache.axis.message.addressing.EndpointReferenceType EPR)
                                                      throws ClassCastException
Get the existing object with this EPR's ID. If there isn't one, create a new one.

Parameters:
EPR - EPR for the object to find or create
type - class of object's interface
Returns:
an implementation of type for this EPR
Throws:
ClassCastException - if the object exists but with a different type
See Also:
instantiateObject(org.apache.axis.message.addressing.EndpointReferenceType), getObject(java.net.URL)

getOrCreateObject

StorableInStateRepository getOrCreateObject(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the existing object with this EPR's ID. If there isn't one, create a new one.

Parameters:
EPR - EPR for the object to find or create
Returns:
a StorableInStateRepository for this EPR
See Also:
instantiateObject(org.apache.axis.message.addressing.EndpointReferenceType), getObject(java.net.URL)

notifyChanged

@Deprecated
void notifyChanged(StorableInStateRepository object)
Deprecated. use notifyChanged(StorableInStateRepository, RepositoryChangedEventType)

Notify listeners that this object has changed. Typically, this is called by the object itself.

Parameters:
object - the object that changed, or null if changes are not limited to a specific object

notifyChanged

void notifyChanged(StorableInStateRepository object,
                   RepositoryChangedEventType event)
Notify listeners that this object has changed. Typically, this is called by the object itself.

Parameters:
object - the object that changed, or null if changes are not limited to a specific object
event - the type of event that has occured RepositoryChangedEventType

setProperty

void setProperty(QName name,
                 String value)
Set a general property on the repository. This is saved with the object inside the repository. Calls notifyChanged.

Parameters:
name - a unique name for the property
value - the value of the property (null to unset)

getProperty

String getProperty(QName name)
Get a property set with setProperty.

Parameters:
name - the name passed to setProperty
Returns:
the value passed to setProperty, or null if not set


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.