You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2007/01/09 18:22:09 UTC

svn commit: r494494 - /webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationProducer.java

Author: danj
Date: Tue Jan  9 09:22:03 2007
New Revision: 494494

URL: http://svn.apache.org/viewvc?view=rev&rev=494494
Log:
Added check to make sure RMD defines the property before reading from the initial/static values in initializeCompleted().

Modified:
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationProducer.java

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationProducer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationProducer.java?view=diff&rev=494494&r1=494493&r2=494494
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationProducer.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationProducer.java Tue Jan  9 09:22:03 2007
@@ -52,6 +52,7 @@
 import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
 import org.apache.muse.ws.resource.lifetime.ScheduledTermination;
 import org.apache.muse.ws.resource.lifetime.WsrlConstants;
+import org.apache.muse.ws.resource.metadata.MetadataDescriptor;
 import org.apache.muse.ws.resource.properties.ResourcePropertyCollection;
 import org.apache.muse.ws.resource.properties.WsrpConstants;
 import org.apache.muse.ws.resource.properties.listeners.PropertyChangeListener;
@@ -353,35 +354,40 @@
             
             PropertyChangeListener listener = factory.newInstance(name, resource);
             props.addChangeListener(listener);
-        }
-        
+        }        
+
+        //
+        // if the resource supports either WS-RL capability, add support 
+        // for the WS-RL termination topic
+        //
+        if (resource.hasCapability(WsrlConstants.IMMEDIATE_TERMINATION_URI) || 
+            resource.hasCapability(WsrlConstants.SCHEDULED_TERMINATION_URI))
+            addTopic(WsrlConstants.TERMINATION_TOPIC_QNAME);
+                
         //
         // read all of the wsnt:TopicExpression values from the RMD doc 
         // and make sure we create Topic objects for them
         //
-        Collection[] values = new Collection[2];
-        values[0] = props.getMetadata().getInitialValues(WsnConstants.TOPIC_EXPRESSION_QNAME);
-        values[1] = props.getMetadata().getStaticValues(WsnConstants.TOPIC_EXPRESSION_QNAME);
+        MetadataDescriptor rmd = props.getMetadata();
         
-        for (int n = 0; n < values.length; ++n)
+        if (rmd.hasProperty(WsnConstants.TOPIC_EXPRESSION_QNAME))
         {
-            i = values[n].iterator();
+            Collection[] values = new Collection[2];
+            values[0] = rmd.getInitialValues(WsnConstants.TOPIC_EXPRESSION_QNAME);
+            values[1] = rmd.getStaticValues(WsnConstants.TOPIC_EXPRESSION_QNAME);
             
-            while (i.hasNext())
+            for (int n = 0; n < values.length; ++n)
             {
-                Element topicExpression = (Element)i.next();
-                QName topicName = XmlUtils.getQName(topicExpression);
-                addTopic(topicName);
+                i = values[n].iterator();
+                
+                while (i.hasNext())
+                {
+                    Element topicExpression = (Element)i.next();
+                    QName topicName = XmlUtils.getQName(topicExpression);
+                    addTopic(topicName);
+                }
             }
         }
-        
-        //
-        // if the resource supports either WS-RL capability, add support 
-        // for the WS-RL termination topic
-        //
-        if (resource.hasCapability(WsrlConstants.IMMEDIATE_TERMINATION_URI) || 
-            resource.hasCapability(WsrlConstants.SCHEDULED_TERMINATION_URI))
-            addTopic(WsrlConstants.TERMINATION_TOPIC_QNAME);
     }
     
     public void prepareShutdown() 



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org