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/02/18 22:06:33 UTC

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

Author: danj
Date: Sun Feb 18 13:06:32 2007
New Revision: 509002

URL: http://svn.apache.org/viewvc?view=rev&rev=509002
Log:
Overloaded publish() to add arrays of content, as requested on muse-user. Users can now publish notifications 
with multiple events (they can already receive them).

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=509002&r1=509001&r2=509002
==============================================================================
--- 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 Sun Feb 18 13:06:32 2007
@@ -413,11 +413,19 @@
     public void publish(QName topicName, Element content)
         throws SoapFault
     {
+        publish(topicName, new Element[]{ content });
+    }
+    
+    public void publish(QName topicName, Element[] content)
+        throws SoapFault
+    {
         //
         // construct the message/payload
         //
         NotificationMessage message = createNotificationMessage();
-        message.addMessageContent(content);
+        
+        for (int n = 0; n < content.length; ++n)
+            message.addMessageContent(content[n]);
         
         message.setTopic(topicName);
         
@@ -447,19 +455,42 @@
     public void publish(QName topicName, XmlSerializable content)
         throws SoapFault
     {
-        publish(topicName, content.toXML());
+        publish(topicName, new XmlSerializable[]{ content });
+    }
+    
+    public void publish(QName topicName, XmlSerializable[] content)
+        throws SoapFault
+    {
+        Element[] contentXML = new Element[content.length];
+        
+        for (int n = 0; n < content.length; ++n)
+            contentXML[n] = content[n].toXML();
+        
+        publish(topicName, contentXML);
     }
     
     public void publish(QName topicName, QName contentName, Object content)
         throws SoapFault
     {
+        publish(topicName, new QName[]{ contentName }, new Object[]{ content });
+    }
+    
+    public void publish(QName topicName, QName[] contentNames, Object[] content)
+        throws SoapFault
+    {
+        SerializerRegistry registry = SerializerRegistry.getInstance();
+        
+        Element[] contentXML = new Element[content.length];
+        
         //
         // get the right serializer and transform POJO to XML
         //
-        Class contentType = content.getClass();
-        SerializerRegistry registry = SerializerRegistry.getInstance();
-        Serializer ser = registry.getSerializer(contentType);
-        Element contentXML = ser.toXML(content, contentName);
+        for (int n = 0; n < content.length; ++n)
+        {
+            Class contentType = content[n].getClass();
+            Serializer ser = registry.getSerializer(contentType);
+            contentXML[n] = ser.toXML(content[n], contentNames[n]);
+        }
         
         publish(topicName, contentXML);
     }



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