org.globus.wsrf.impl
Class SimpleTopic

java.lang.Object
  |
  +--org.globus.wsrf.impl.SimpleTopic
All Implemented Interfaces:
Topic, TopicListener, TopicListenerList

public class SimpleTopic
extends Object
implements Topic, TopicListener

Simple in-memory implementation of the Topic interface


Field Summary
protected  Object current
           
protected  Collection listeners
           
protected  QName name
           
protected  TopicExpressionType reference
           
protected  Collection subscriptions
           
protected  Map subTopics
           
protected  List topicPath
           
 
Constructor Summary
SimpleTopic(Map subTopics, TopicExpressionType reference, Collection listeners, Collection subscriptions, QName name, Object current, List topicPath)
          Create a topic with the given parameters
SimpleTopic(QName name)
          Create a topic with the given name
 
Method Summary
 void addTopic(Topic topic)
          Add a sub-topic.
 void addTopicListener(TopicListener listener)
          Add a topic listener
 Object getCurrentMessage()
          Get the current notification message if there is any
 QName getName()
          Get the name of the topic.
 Topic getTopic(QName topicName)
          Get the sub-topic with the given topic name
 List getTopicPath()
          Get the topic path.
 TopicExpressionType getTopicReference()
          Get the topic expression for the topic(s) that this topic references.
 boolean isReference()
          Is this a topic reference?
 void notify(Object obj)
          Send out a notification on this topic
 void removeTopic(Topic topic)
          Remove a sub-topic
 void removeTopicListener(TopicListener listener)
          Remove a topic listener
 void setTopicPath(List topicPath)
          Set the topic path.
 void setTopicReference(TopicExpressionType topicPath)
          Set the topic expression that resolves to a set of topics that this topic references.
 void topicAdded(Topic topic)
          Called when a topic is added
 void topicChanged(Topic topic)
          Called when the value of the topic changes
 Iterator topicIterator()
          Iterator for the set of child topics
 Iterator topicListenerIterator()
          Get a iterator for the list of TopicListeners
 void topicRemoved(Topic topic)
          Called when a topic is removed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subTopics

protected Map subTopics

reference

protected TopicExpressionType reference

listeners

protected Collection listeners

subscriptions

protected Collection subscriptions

name

protected QName name

current

protected Object current

topicPath

protected List topicPath
Constructor Detail

SimpleTopic

public SimpleTopic(QName name)
Create a topic with the given name
Parameters:
name - The name of the created topic

SimpleTopic

public SimpleTopic(Map subTopics,
                   TopicExpressionType reference,
                   Collection listeners,
                   Collection subscriptions,
                   QName name,
                   Object current,
                   List topicPath)
Create a topic with the given parameters
Parameters:
subTopics - A map of child topics
reference - A topic expression (only used if this is a topic alias)
listeners - A collection of topic listeners
subscriptions - A collection of subscriptions
name - The name of this topic
current - The current value of this topic
topicPath - The concrete topic path of this topic
Method Detail

addTopic

public void addTopic(Topic topic)
              throws Exception
Description copied from interface: Topic
Add a sub-topic.
Specified by:
addTopic in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Parameters:
topic - The sub-topic to add
Throws:
Exception -  

addTopicListener

public void addTopicListener(TopicListener listener)
Description copied from interface: TopicListenerList
Add a topic listener
Specified by:
addTopicListener in interface TopicListenerList
Following copied from interface: org.globus.wsrf.TopicListenerList
Parameters:
listener - The topic listener to add
See Also:
TopicListener

getName

public QName getName()
Description copied from interface: Topic
Get the name of the topic. Only root topics should actually be qualified names, other topic should be non-qualified
Specified by:
getName in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Returns:
The name of the topic

getTopic

public Topic getTopic(QName topicName)
Description copied from interface: Topic
Get the sub-topic with the given topic name
Specified by:
getTopic in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Parameters:
topicName - The topic name of the sub topic
Returns:
The sub-topic

getTopicReference

public TopicExpressionType getTopicReference()
Description copied from interface: Topic
Get the topic expression for the topic(s) that this topic references.
Specified by:
getTopicReference in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Returns:
The topic expression that this topic reference or null if this topic is not a reference.

isReference

public boolean isReference()
Description copied from interface: Topic
Is this a topic reference?
Specified by:
isReference in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Returns:
true if this topic is a reference to another topic false if not

topicIterator

public Iterator topicIterator()
Description copied from interface: Topic
Iterator for the set of child topics
Specified by:
topicIterator in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Returns:
The iterator

notify

public void notify(Object obj)
            throws Exception
Description copied from interface: Topic
Send out a notification on this topic
Specified by:
notify in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Parameters:
obj - Object representation of the message to send
Throws:
Exception -  

getCurrentMessage

public Object getCurrentMessage()
Description copied from interface: Topic
Get the current notification message if there is any
Specified by:
getCurrentMessage in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Returns:
A object containing the current message, may be null

removeTopic

public void removeTopic(Topic topic)
Description copied from interface: Topic
Remove a sub-topic
Specified by:
removeTopic in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Parameters:
topic - The sub-topic to remove

removeTopicListener

public void removeTopicListener(TopicListener listener)
Description copied from interface: TopicListenerList
Remove a topic listener
Specified by:
removeTopicListener in interface TopicListenerList
Following copied from interface: org.globus.wsrf.TopicListenerList
Parameters:
listener - The topic listener to remove.
See Also:
TopicListener

topicListenerIterator

public Iterator topicListenerIterator()
Description copied from interface: TopicListenerList
Get a iterator for the list of TopicListeners
Specified by:
topicListenerIterator in interface TopicListenerList
Following copied from interface: org.globus.wsrf.TopicListenerList
Returns:
The iterator
See Also:
TopicListener

setTopicReference

public void setTopicReference(TopicExpressionType topicPath)
Description copied from interface: Topic
Set the topic expression that resolves to a set of topics that this topic references. Only used for reference topics.
Specified by:
setTopicReference in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Parameters:
topicPath - The topic expression to set.

setTopicPath

public void setTopicPath(List topicPath)
Description copied from interface: Topic
Set the topic path. The topic path is represented as a ordered list of topic names
Specified by:
setTopicPath in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Parameters:
topicPath - The topic path to associate with this topic

getTopicPath

public List getTopicPath()
Description copied from interface: Topic
Get the topic path. The topic path is represented as a ordered list of topic names
Specified by:
getTopicPath in interface Topic
Following copied from interface: org.globus.wsrf.Topic
Returns:
The topic path of this topic

topicAdded

public void topicAdded(Topic topic)
Description copied from interface: TopicListener
Called when a topic is added
Specified by:
topicAdded in interface TopicListener
Following copied from interface: org.globus.wsrf.TopicListener
Parameters:
topic - The topic being added

topicChanged

public void topicChanged(Topic topic)
Description copied from interface: TopicListener
Called when the value of the topic changes
Specified by:
topicChanged in interface TopicListener
Following copied from interface: org.globus.wsrf.TopicListener
Parameters:
topic - The topic that changed

topicRemoved

public void topicRemoved(Topic topic)
Description copied from interface: TopicListener
Called when a topic is removed
Specified by:
topicRemoved in interface TopicListener
Following copied from interface: org.globus.wsrf.TopicListener
Parameters:
topic - The topic being removed


Copyright © 1999-2003 University of Chicago and The University of Southern California. All rights reserved.