org.globus.wsrf.impl
Class ResourcePropertyTopic

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

public class ResourcePropertyTopic
extends java.lang.Object
implements ResourceProperty, Topic

This class can be used to expose arbitrary ResourceProperty as a Topic.


Field Summary
protected  boolean autoNotify
           
private static org.globus.util.I18n i18n
           
private static org.apache.commons.logging.Log logger
           
protected  ResourceProperty rp
           
protected  boolean sendOldValue
           
protected  Topic topic
           
 
Constructor Summary
protected ResourcePropertyTopic()
           
  ResourcePropertyTopic(ResourceProperty rp)
          Construct a new ResourcePropertyTopic.
  ResourcePropertyTopic(ResourceProperty rp, javax.xml.namespace.QName qname)
          Construct a new ResourcePropertyTopic
 
Method Summary
 void add(java.lang.Object value)
          Adds a value.
 void addTopic(Topic topic)
          Add a sub-topic.
 void addTopicListener(TopicListener listener)
          Add a topic listener
 boolean autoNotify()
           
 void clear()
          Removes all values.
private  ResourcePropertyValueChangeNotificationElementType createValueChangeMessage(boolean sendOld)
           
protected  void fireNotification(ResourcePropertyValueChangeNotificationElementType message)
           
 java.lang.Object get(int index)
          Retrieves a value at a specific index.
 java.lang.Object getCurrentMessage()
          Get the current notification message if there is any
 ResourcePropertyMetaData getMetaData()
          Gets meta data of this resource property.
 javax.xml.namespace.QName getName()
          Get the name of the topic.
 ResourceProperty getResourceProperty()
          Get the resource property associated with this topic
 boolean getSendOldValue()
          Determine whether notifications send the old resource property value as well as the new value.
 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 isEmpty()
          Returns true if the resource property has any values.
 boolean isReference()
          Is this a topic reference?
 java.util.Iterator iterator()
          Returns iterator over the values of this resource property.
 void notify(java.lang.Object obj)
          Send out a notification on this topic
 boolean remove(java.lang.Object value)
          Removes a specific value.
 void removeTopic(Topic topic)
          Remove a sub-topic
 void removeTopicListener(TopicListener listener)
          Remove a topic listener
 void set(int index, java.lang.Object value)
          Sets a value at a specific index.
 void setAutoNotify(boolean autoNotify)
           
private  void setNewValue(ResourcePropertyValueChangeNotificationElementType message)
           
 void setSendOldValue(boolean sendOldValue)
          Set the "send old value" behavior.
 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.
 int size()
          Returns the number of values in the resource property.
 org.w3c.dom.Element[] toElements()
          Converts the resource property value into a DOM Element array.
 java.util.Iterator topicIterator()
          Iterator for the set of child topics
 java.util.Iterator topicListenerIterator()
          Get a iterator for the list of TopicListeners.
 javax.xml.soap.SOAPElement[] toSOAPElements()
          Converts the resource property value into a SOAPElement array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.apache.commons.logging.Log logger

i18n

private static org.globus.util.I18n i18n

rp

protected ResourceProperty rp

topic

protected Topic topic

autoNotify

protected boolean autoNotify

sendOldValue

protected boolean sendOldValue
Constructor Detail

ResourcePropertyTopic

protected ResourcePropertyTopic()

ResourcePropertyTopic

public ResourcePropertyTopic(ResourceProperty rp,
                             javax.xml.namespace.QName qname)
Construct a new ResourcePropertyTopic

Parameters:
rp - A ResourceProperty object.
qname - A name of the topic.

ResourcePropertyTopic

public ResourcePropertyTopic(ResourceProperty rp)
Construct a new ResourcePropertyTopic. The topic name is the name of the ResourceProperty.

Parameters:
rp - A ResourceProperty object.
Method Detail

getResourceProperty

public ResourceProperty getResourceProperty()
Get the resource property associated with this topic

Returns:
The resource property

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

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

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

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

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

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

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

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

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.

autoNotify

public boolean autoNotify()
Returns:
Returns the auto notify setting.

setAutoNotify

public void setAutoNotify(boolean autoNotify)
Parameters:
autoNotify - The autoNotify to set.

fireNotification

protected void fireNotification(ResourcePropertyValueChangeNotificationElementType message)

add

public void add(java.lang.Object value)
Description copied from interface: ResourceProperty
Adds a value.

Specified by:
add in interface ResourceProperty
Parameters:
value - the value to add.

set

public void set(int index,
                java.lang.Object value)
Description copied from interface: ResourceProperty
Sets a value at a specific index.

Specified by:
set in interface ResourceProperty
Parameters:
index - the index to set value at.
value - the new value

remove

public boolean remove(java.lang.Object value)
Description copied from interface: ResourceProperty
Removes a specific value. If the resource property contains multiple of the same value, only the first one is removed.

Specified by:
remove in interface ResourceProperty
Parameters:
value - value to remove.
Returns:
true if the value was removed. False otherwise.

get

public java.lang.Object get(int index)
Description copied from interface: ResourceProperty
Retrieves a value at a specific index.

Specified by:
get in interface ResourceProperty
Parameters:
index - the index of value to retrieve.
Returns:
the value at the given index. This operation might fail if the index is out of bounds.

clear

public void clear()
Description copied from interface: ResourceProperty
Removes all values.

Specified by:
clear in interface ResourceProperty

size

public int size()
Description copied from interface: ResourceProperty
Returns the number of values in the resource property.

Specified by:
size in interface ResourceProperty
Returns:
the number of values.

isEmpty

public boolean isEmpty()
Description copied from interface: ResourceProperty
Returns true if the resource property has any values.

Specified by:
isEmpty in interface ResourceProperty
Returns:
true if the resource property has any values. False, otherwise.

iterator

public java.util.Iterator iterator()
Description copied from interface: ResourceProperty
Returns iterator over the values of this resource property.

Specified by:
iterator in interface ResourceProperty
Returns:
iterator over the values of this resource property.

getMetaData

public ResourcePropertyMetaData getMetaData()
Description copied from interface: ResourceProperty
Gets meta data of this resource property.

Specified by:
getMetaData in interface ResourceProperty
Returns:
meta data of this resource property. Never null.

toSOAPElements

public javax.xml.soap.SOAPElement[] toSOAPElements()
                                            throws SerializationException
Description copied from interface: ResourceProperty
Converts the resource property value into a SOAPElement array. Each value is wrapped into an element named after the resource property. If the RP has no values (is null), and RP element was defined as:

Specified by:
toSOAPElements in interface ResourceProperty
Returns:
the resource property as a SOAPElement array.
Throws:
SerializationException - if conversion fails.

toElements

public org.w3c.dom.Element[] toElements()
                                 throws SerializationException
Description copied from interface: ResourceProperty
Converts the resource property value into a DOM Element array. Each value is wrapped into an element named after the resource property. If the RP has no values (is null), and RP element was defined as:

Specified by:
toElements in interface ResourceProperty
Returns:
the resource property as a DOM Element array.
Throws:
SerializationException - if conversion fails.

getSendOldValue

public boolean getSendOldValue()
Determine whether notifications send the old resource property value as well as the new value. This setting defaults to only sending the new value.

Returns:
The setting

setSendOldValue

public void setSendOldValue(boolean sendOldValue)
Set the "send old value" behavior. This setting determines if notifications include the old as well as the new value of the resource property.

Parameters:
sendOldValue - If true the old value will be sent, if false (default) only the new value will be sent.

setNewValue

private void setNewValue(ResourcePropertyValueChangeNotificationElementType message)

createValueChangeMessage

private ResourcePropertyValueChangeNotificationElementType createValueChangeMessage(boolean sendOld)