org.globus.wsrf.impl
Class SimpleTopic

java.lang.Object
  extended byorg.globus.wsrf.impl.SimpleTopic
All Implemented Interfaces:
Topic, TopicListener, TopicListenerList

public class SimpleTopic
extends java.lang.Object
implements Topic, TopicListener

Simple in-memory implementation of the Topic interface


Field Summary
protected  java.lang.Object current
           
private static org.globus.util.I18n i18n
           
protected  java.util.Collection listeners
           
(package private) static org.apache.commons.logging.Log logger
           
protected  javax.xml.namespace.QName name
           
protected  TopicExpressionType reference
           
protected  java.util.Map subTopics
           
protected  java.util.List topicPath
           
 
Constructor Summary
SimpleTopic(java.util.Map subTopics, TopicExpressionType reference, java.util.Collection listeners, javax.xml.namespace.QName name, org.apache.axis.message.MessageElement[] current, java.util.List topicPath)
          Create a topic with the given parameters
SimpleTopic(javax.xml.namespace.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
 java.lang.Object getCurrentMessage()
          Get the current notification message if there is any
 javax.xml.namespace.QName getName()
          Get the name of the topic.
 Topic getTopic(javax.xml.namespace.QName topicName)
          Get the sub-topic with the given topic name
 java.util.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(java.lang.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(java.util.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
 java.util.Iterator topicIterator()
          Iterator for the set of child topics
 java.util.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

i18n

private static org.globus.util.I18n i18n

subTopics

protected java.util.Map subTopics

reference

protected TopicExpressionType reference

listeners

protected java.util.Collection listeners

name

protected javax.xml.namespace.QName name

current

protected java.lang.Object current

topicPath

protected java.util.List topicPath

logger

static org.apache.commons.logging.Log logger
Constructor Detail

SimpleTopic

public SimpleTopic(javax.xml.namespace.QName name)
Create a topic with the given name

Parameters:
name - The name of the created topic

SimpleTopic

public SimpleTopic(java.util.Map subTopics,
                   TopicExpressionType reference,
                   java.util.Collection listeners,
                   javax.xml.namespace.QName name,
                   org.apache.axis.message.MessageElement[] current,
                   java.util.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
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 java.lang.Exception
Description copied from interface: Topic
Add a sub-topic.

Specified by:
addTopic in interface Topic
Parameters:
topic - The sub-topic to add
Throws:
java.lang.Exception

addTopicListener

public void addTopicListener(TopicListener listener)
Description copied from interface: TopicListenerList
Add a topic listener

Specified by:
addTopicListener in interface TopicListenerList
Parameters:
listener - The topic listener to add
See Also:
TopicListener

getName

public javax.xml.namespace.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
Returns:
The name of the topic

getTopic

public Topic getTopic(javax.xml.namespace.QName topicName)
Description copied from interface: Topic
Get the sub-topic with the given topic name

Specified by:
getTopic in interface 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
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
Returns:
true if this topic is a reference to another topic false if not

topicIterator

public java.util.Iterator topicIterator()
Description copied from interface: Topic
Iterator for the set of child topics

Specified by:
topicIterator in interface Topic
Returns:
The iterator

notify

public void notify(java.lang.Object obj)
            throws java.lang.Exception
Description copied from interface: Topic
Send out a notification on this topic

Specified by:
notify in interface Topic
Parameters:
obj - Object representation of the message to send
Throws:
java.lang.Exception

getCurrentMessage

public java.lang.Object getCurrentMessage()
Description copied from interface: Topic
Get the current notification message if there is any

Specified by:
getCurrentMessage in interface 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
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
Parameters:
listener - The topic listener to remove.
See Also:
TopicListener

topicListenerIterator

public java.util.Iterator topicListenerIterator()
Description copied from interface: TopicListenerList
Get a iterator for the list of TopicListeners.
The function should be called in and iteration performed in a synchronized block on the TopicListenerList instance.

Specified by:
topicListenerIterator in interface 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
Parameters:
topicPath - The topic expression to set.

setTopicPath

public void setTopicPath(java.util.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
Parameters:
topicPath - The topic path to associate with this topic

getTopicPath

public java.util.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
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
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
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
Parameters:
topic - The topic being removed