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/18 19:26:44 UTC

svn commit: r497525 - in /webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification: NotificationConsumer.java TopicListener.java

Author: danj
Date: Thu Jan 18 10:26:43 2007
New Revision: 497525

URL: http://svn.apache.org/viewvc?view=rev&rev=497525
Log:
Added concept of listeners-by-topic to avoid potential performance problems documented here:

http://marc.theaimsgroup.com/?t=116803718800001&r=1&w=2


Added:
    webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/TopicListener.java
Modified:
    webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/NotificationConsumer.java

Modified: webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/NotificationConsumer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/NotificationConsumer.java?view=diff&rev=497525&r1=497524&r2=497525
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/NotificationConsumer.java (original)
+++ webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/NotificationConsumer.java Thu Jan 18 10:26:43 2007
@@ -18,6 +18,8 @@
 
 import java.util.Collection;
 
+import javax.xml.namespace.QName;
+
 import org.apache.muse.core.Capability;
 
 /**
@@ -44,6 +46,18 @@
      *
      */
     void addMessageListener(NotificationMessageListener listener);
+
+    /**
+     * 
+     * Adds the listener to the list of listeners that will be notified 
+     * whenever a message is received that has the given WSN Topic. 
+     * <b>These listeners will be fired whenever a message is received that 
+     * has the listener's topic, regardless of what is returned by accepts().</b>
+     *
+     * @param listener
+     *
+     */
+    void addTopicListener(TopicListener listener);
     
     /**
      * 
@@ -51,6 +65,14 @@
      *
      */
     Collection getMessageListeners();
+
+    /**
+     * 
+     * @return The listeners that are currently receiving notifications for 
+     *         the given WSN Topic.
+     *
+     */
+    Collection getTopicListeners(QName topic);
     
     /**
      * 
@@ -64,4 +86,6 @@
     void notify(NotificationMessage[] messages);
     
     void removeMessageListener(NotificationMessageListener listener);
+    
+    void removeTopicListener(TopicListener listener);
 }

Added: webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/TopicListener.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/TopicListener.java?view=auto&rev=497525
==============================================================================
--- webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/TopicListener.java (added)
+++ webservices/muse/trunk/modules/muse-wsn-api/src/org/apache/muse/ws/notification/TopicListener.java Thu Jan 18 10:26:43 2007
@@ -0,0 +1,34 @@
+/*=============================================================================*
+ *  Copyright 2007 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.ws.notification;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * TopicListener is a NotificationMessageListener that only listens on a 
+ * certain WS-N Topic. It adds on getter method to allow users to discover 
+ * the topic of interest.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface TopicListener extends NotificationMessageListener
+{
+    QName getTopic();
+}



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