org.globus.wsrf.utils
Class SubscriptionPersistenceUtils

java.lang.Object
  extended byorg.globus.wsrf.utils.SubscriptionPersistenceUtils

public class SubscriptionPersistenceUtils
extends Object


Constructor Summary
SubscriptionPersistenceUtils()
           
 
Method Summary
private static void addSubscriptionListenersToTable(Topic topic, Map topicListenerTable)
          Gather all registered topic listeners for the topic and all of its subtopics (recursive) and drop them into the provided table, which maps topics to their listeners.
static Map getListenerToTopicsTable(TopicList topicList)
          Return a table of listeners and their corresponding topics.
static void loadSubscriptionListeners(TopicList topicList, ObjectInputStream ois)
          Deserialize the table containing the registered subscription related topic listeners and reregister said listeners in the provided topic list.
static void storeSubscriptionListeners(TopicList topicList, ObjectOutputStream oos)
          Serialize any registered subscription topic listeners of type SimpleSubscriptionListener to the provided output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubscriptionPersistenceUtils

public SubscriptionPersistenceUtils()
Method Detail

storeSubscriptionListeners

public static void storeSubscriptionListeners(TopicList topicList,
                                              ObjectOutputStream oos)
                                       throws IOException
Serialize any registered subscription topic listeners of type SimpleSubscriptionListener to the provided output stream.

Parameters:
topicList - The topic list on which the listeners are registered
oos - The output stream
Throws:
IOException - If writing to the output stream failed

getListenerToTopicsTable

public static Map getListenerToTopicsTable(TopicList topicList)
Return a table of listeners and their corresponding topics.

This function is used to flatten an input tree of topics into a form that is simpler to persist (for instance, it is called by storeSubscriptionListeners()).

Each key is of type SimpleSubscriptionTopicListener and is mapped to a List of topic paths. Each topic path is a List of QName objects.

Parameters:
topicList - TopicList The topic list on which the listeners are registered
Returns:
Map The map of listeners to topics

addSubscriptionListenersToTable

private static void addSubscriptionListenersToTable(Topic topic,
                                                    Map topicListenerTable)
Gather all registered topic listeners for the topic and all of its subtopics (recursive) and drop them into the provided table, which maps topics to their listeners.

Parameters:
topic - The topic to process
topicListenerTable - The table into which to insert the discovered listeners

loadSubscriptionListeners

public static void loadSubscriptionListeners(TopicList topicList,
                                             ObjectInputStream ois)
                                      throws IOException,
                                             ClassNotFoundException
Deserialize the table containing the registered subscription related topic listeners and reregister said listeners in the provided topic list.

Parameters:
topicList - The topic list on which to register the deserialized listeners
ois - The input stream from which to read the table of listeners
Throws:
IOException - If there was a IO error when reading from the input stream
ClassNotFoundException - If the class of the object being read could not be found