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 2006/12/08 21:28:45 UTC

svn commit: r484750 - in /webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification: impl/ properties/

Author: danj
Date: Fri Dec  8 12:28:44 2006
New Revision: 484750

URL: http://svn.apache.org/viewvc?view=rev&rev=484750
Log:
Fix for MUSE-146

Modified:
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Messages.properties
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationConsumer.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ChangeNotificationListener.java
    webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Messages.properties?view=diff&rev=484750&r1=484749&r2=484750
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Messages.properties (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/Messages.properties Fri Dec  8 12:28:44 2006
@@ -1,4 +1,3 @@
-#Wed Aug 16 21:49:58 EDT 2006
 NullConsumerElement=The Subscribe message does not contain a wsn\:ConsumerReference element.
 NoMessageContent=The NotificationMessage XML does not have a Message element. All messages must have a message payload associated with them.
 NoMessageAvailable=The topic 'XXX' has not published any messages.
@@ -10,11 +9,9 @@
 NullMessageContent=The message content item is null.
 NullMessageElement=The DOM Element representing the NotificationMessage is null.
 NoSubscriptionEPR=The SubscribeResponse message does not contain a SubscriptionReference EPR.
-NoTopicPath=The NotificationMessage XML does not have a Topic element. All messages must have a topic associated with them.
 NullContentName=The name for the message content element is null.
 TopicNotFound=The topic 'XXX' does not exist.
 PolicyNotSupported=WS-N SubscriptionPolicy is not supported. The policy value was\: XXX
-NullTopicPath=The QName with the topic path is null.
 NullConsumerEPR=The ConsumerReference EPR is null.
 InvalidFilterType=The filter provided is not valid according to the WS-N spec - there is no filter type for element 'XXX'.
 InvalidDialect=Subscription filters do not support the dialect 'XXX'. The supported dialects are: XXX

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationConsumer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationConsumer.java?view=diff&rev=484750&r1=484749&r2=484750
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationConsumer.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationConsumer.java Fri Dec  8 12:28:44 2006
@@ -20,7 +20,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.logging.Logger;
 
 import org.apache.muse.core.AbstractCapability;
 import org.apache.muse.core.serializer.SerializerRegistry;
@@ -124,8 +123,7 @@
                     
                     catch (Throwable error)
                     {
-                        Logger log = getLog();
-                        LoggingUtils.logError(log, error);
+                        LoggingUtils.logError(getLog(), error);
                     }
                 }
             }

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java?view=diff&rev=484750&r1=484749&r2=484750
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/impl/SimpleNotificationMessage.java Fri Dec  8 12:28:44 2006
@@ -95,9 +95,6 @@
         
         _topicPath = XmlUtils.getQNameFromChild(root, WsnConstants.TOPIC_QNAME);
         
-        if (_topicPath == null)
-            throw new SoapFault(_MESSAGES.get("NoTopicPath"));
-        
         Element producerXML = XmlUtils.getElement(root, WsnConstants.PRODUCER_QNAME);
         
         if (producerXML != null)
@@ -216,16 +213,13 @@
     
     public void setTopic(QName topicPath)
     {
-        if (topicPath == null)
-            throw new NullPointerException(_MESSAGES.get("NullTopicPath"));
-        
         _topicPath = topicPath;
     }
     
     public void setTopicDialect(String dialect) 
         throws TopicExpressionDialectUnknownFault
     {
-        if (!dialect.equals(WstConstants.CONCRETE_TOPIC_URI))
+        if (dialect == null || !dialect.equals(WstConstants.CONCRETE_TOPIC_URI))
         {
             Object[] filler = { dialect, XPathUtils.NAMESPACE_URI };
             throw new TopicExpressionDialectUnknownFault(_MESSAGES.get("InvalidDialect", filler));

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ChangeNotificationListener.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ChangeNotificationListener.java?view=diff&rev=484750&r1=484749&r2=484750
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ChangeNotificationListener.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ChangeNotificationListener.java Fri Dec  8 12:28:44 2006
@@ -85,18 +85,18 @@
     public void propertyChanged(Element oldValue, Element newValue)
         throws BaseFault
     {
+        QName propertyName = getPropertyName();
         Element[] oldValues = new Element[]{ oldValue };
         Element[] newValues = new Element[]{ newValue };
         
-        ResourcePropertyChangeEvent event = 
-            new ResourcePropertyChangeEvent(oldValues, newValues);
+        ResourcePropertyChangeEvent event = new ResourcePropertyChangeEvent(propertyName, oldValues, newValues);
         
         //
         // publish to the property's topic
         //
         try
         {
-            getNotificationProducer().publish(getPropertyName(), event);
+            getNotificationProducer().publish(propertyName, event);
         }
         
         catch (SoapFault error)

Modified: webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java?view=diff&rev=484750&r1=484749&r2=484750
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-impl/src/org/apache/muse/ws/notification/properties/ResourcePropertyChangeEvent.java Fri Dec  8 12:28:44 2006
@@ -16,6 +16,8 @@
  
 package org.apache.muse.ws.notification.properties;
 
+import javax.xml.namespace.QName;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -41,8 +43,11 @@
     
     private Element[] _oldValues = null;
     
-    public ResourcePropertyChangeEvent(Element[] oldValues, Element[] newValues)
+    private QName _propertyName = null;
+    
+    public ResourcePropertyChangeEvent(QName propertyName, Element[] oldValues, Element[] newValues)
     {
+        _propertyName = propertyName;
         _oldValues = oldValues;
         _newValues = newValues;
     }
@@ -57,6 +62,8 @@
      */
     public ResourcePropertyChangeEvent(NotificationMessage message)
     {
+        _propertyName = message.getTopic();
+        
         Element wsrpXML = message.getMessageContent(WsrpConstants.NOTIFICATION_QNAME);
         Element oldValuesXML = XmlUtils.getElement(wsrpXML, WsrpConstants.OLD_VALUES_QNAME);
         Element newValuesXML = XmlUtils.getElement(wsrpXML, WsrpConstants.NEW_VALUES_QNAME);
@@ -74,6 +81,11 @@
     {
         return _oldValues;
     }
+    
+    public QName getPropertyName()
+    {
+        return _propertyName;
+    }
 
     public Element toXML()
     {
@@ -84,6 +96,7 @@
     {
         Element root = XmlUtils.createElement(doc, WsrpConstants.NOTIFICATION_QNAME);
         
+        QName propertyName = getPropertyName();
         Element[] oldValues = getOldValues();
         Element[] newValues = getNewValues();
         
@@ -94,13 +107,23 @@
         
         for (int n = 0; n < oldValues.length; ++n)
         {
-            oldValues[n] = (Element)doc.importNode(oldValues[n], true);
+            if (oldValues[n] == null)
+                oldValues[n] = XmlUtils.createElement(doc, propertyName);
+            
+            else
+                oldValues[n] = (Element)doc.importNode(oldValues[n], true);
+            
             oldValueXML.appendChild(oldValues[n]);
         }
         
         for (int n = 0; n < newValues.length; ++n)
         {
-            newValues[n] = (Element)doc.importNode(newValues[n], true);
+            if (newValues[n] == null)
+                newValues[n] = XmlUtils.createElement(doc, propertyName);
+            
+            else
+                newValues[n] = (Element)doc.importNode(newValues[n], true);
+            
             newValueXML.appendChild(newValues[n]);
         }
         



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