directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r325850 - in /directory/network: branches/0.7/src/java/org/apache/mina/protocol/handler/ trunk/src/java/org/apache/mina/handler/
Date Mon, 17 Oct 2005 07:07:38 GMT
Author: trustin
Date: Mon Oct 17 00:07:19 2005
New Revision: 325850

URL: http://svn.apache.org/viewcvs?rev=325850&view=rev
Log:
* Added Demuxing(Io|Protocol)Handler.getMessageHandler(Map)(...)
* Renamed (de)registerMessageType(...) to (add|remove)MessageHandler(...).

Related issues: DIRMINA-98 and DIRMINA-99


Modified:
    directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java
    directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/MessageHandler.java
    directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/UnknownMessageTypeException.java
    directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java
    directory/network/trunk/src/java/org/apache/mina/handler/MessageHandler.java
    directory/network/trunk/src/java/org/apache/mina/handler/UnknownMessageTypeException.java

Modified: directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java?rev=325850&r1=325849&r2=325850&view=diff
==============================================================================
--- directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java
(original)
+++ directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java
Mon Oct 17 00:07:19 2005
@@ -3,6 +3,7 @@
  */
 package org.apache.mina.protocol.handler;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -17,8 +18,8 @@
  * to the appropriate {@link MessageHandler}.
  * 
  * You can freely register and deregister {@link MessageHandler}s using
- * {@link #registerMessageType(Class, MessageHandler)} and
- * {@link #deregisterMessageType(Class)}.
+ * {@link #addMessageHandler(Class, MessageHandler)} and
+ * {@link #removeMessageHandler(Class)}.
  * 
  * @author The Apache Directory Project
  * @version $Rev$, $Date$
@@ -38,7 +39,7 @@
      * Registers a {@link MessageHandler} that receives the messages of
      * the specified <code>type</code>.
      */
-    public void registerMessageType( Class type, MessageHandler handler )
+    public void addMessageHandler( Class type, MessageHandler handler )
     {
         synchronized( type2handler )
         {
@@ -50,17 +51,35 @@
      * Deregisters a {@link MessageHandler} that receives the messages of
      * the specified <code>type</code>.
      */
-    public void deregisterMessageType( Class clazz )
+    public void removeMessageHandler( Class type )
     {
         synchronized( type2handler )
         {
-            type2handler.remove( clazz );
+            type2handler.remove( type );
         }
     }
+    
+    /**
+     * Returns the {@link MessageHandler} which is registered to process
+     * the specified <code>type</code>. 
+     */
+    public MessageHandler getMessageHandler( Class type )
+    {
+        return ( MessageHandler ) type2handler.get( type );
+    }
+    
+    /**
+     * Returns the {@link Map} which contains all messageType-{@link MessageHandler}
+     * pairs registered to this handler.
+     */
+    public Map getMessageHandlerMap()
+    {
+        return Collections.unmodifiableMap( type2handler );
+    }
 
     /**
      * Forwards the received events into the appropriate {@link MessageHandler}
-     * which is registered by {@link #registerMessageType(Class, MessageHandler)}.
+     * which is registered by {@link #addMessageHandler(Class, MessageHandler)}.
      */
     public void messageReceived( ProtocolSession session, Object message )
     {

Modified: directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/MessageHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/MessageHandler.java?rev=325850&r1=325849&r2=325850&view=diff
==============================================================================
--- directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/MessageHandler.java
(original)
+++ directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/MessageHandler.java
Mon Oct 17 00:07:19 2005
@@ -24,7 +24,7 @@
  * A handler interface that {@link DemuxingProtocolHandler} forwards
  * <code>messageReceived</code> events to.  You have to register your
  * handler with the type of message you want to get notified using
- * {@link DemuxingProtocolHandler#registerMessageType(Class, MessageHandler)}.
+ * {@link DemuxingProtocolHandler#addMessageHandler(Class, MessageHandler)}.
  * 
  * @author The Apache Directory Project
  * @version $Rev$, $Date$

Modified: directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/UnknownMessageTypeException.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/UnknownMessageTypeException.java?rev=325850&r1=325849&r2=325850&view=diff
==============================================================================
--- directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/UnknownMessageTypeException.java
(original)
+++ directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/UnknownMessageTypeException.java
Mon Oct 17 00:07:19 2005
@@ -23,7 +23,7 @@
  * An exception that is thrown when {@link DemuxingProtocolHandler}
  * cannot find any {@link MessageHandler}s associated with the specific
  * message type.  You have to use
- * {@link DemuxingProtocolHandler#registerMessageType(Class, MessageHandler)}
+ * {@link DemuxingProtocolHandler#addMessageHandler(Class, MessageHandler)}
  * to associate a message type and a message handler. 
  * 
  * @author The Apache Directory Project

Modified: directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java?rev=325850&r1=325849&r2=325850&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java Mon Oct
17 00:07:19 2005
@@ -3,6 +3,7 @@
  */
 package org.apache.mina.handler;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -17,8 +18,8 @@
  * to the appropriate {@link MessageHandler}.
  * 
  * You can freely register and deregister {@link MessageHandler}s using
- * {@link #registerMessageType(Class, MessageHandler)} and
- * {@link #deregisterMessageType(Class)}.
+ * {@link #addMessageHandler(Class, MessageHandler)} and
+ * {@link #removeMessageHandler(Class)}.
  * 
  * @author The Apache Directory Project
  * @version $Rev$, $Date$
@@ -38,7 +39,7 @@
      * Registers a {@link MessageHandler} that receives the messages of
      * the specified <code>type</code>.
      */
-    public void registerMessageType( Class type, MessageHandler handler )
+    public void addMessageHandler( Class type, MessageHandler handler )
     {
         synchronized( type2handler )
         {
@@ -50,17 +51,36 @@
      * Deregisters a {@link MessageHandler} that receives the messages of
      * the specified <code>type</code>.
      */
-    public void deregisterMessageType( Class clazz )
+    public void removeMessageHandler( Class type )
     {
         synchronized( type2handler )
         {
-            type2handler.remove( clazz );
+            type2handler.remove( type );
         }
     }
+    
+    
+    /**
+     * Returns the {@link MessageHandler} which is registered to process
+     * the specified <code>type</code>. 
+     */
+    public MessageHandler getMessageHandler( Class type )
+    {
+        return ( MessageHandler ) type2handler.get( type );
+    }
+    
+    /**
+     * Returns the {@link Map} which contains all messageType-{@link MessageHandler}
+     * pairs registered to this handler.
+     */
+    public Map getMessageHandlerMap()
+    {
+        return Collections.unmodifiableMap( type2handler );
+    }
 
     /**
      * Forwards the received events into the appropriate {@link MessageHandler}
-     * which is registered by {@link #registerMessageType(Class, MessageHandler)}.
+     * which is registered by {@link #addMessageHandler(Class, MessageHandler)}.
      */
     public void messageReceived( IoSession session, Object message )
     {

Modified: directory/network/trunk/src/java/org/apache/mina/handler/MessageHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/handler/MessageHandler.java?rev=325850&r1=325849&r2=325850&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/handler/MessageHandler.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/handler/MessageHandler.java Mon Oct 17
00:07:19 2005
@@ -24,7 +24,7 @@
  * A handler interface that {@link DemuxingIoHandler} forwards
  * <code>messageReceived</code> events to.  You have to register your
  * handler with the type of message you want to get notified using
- * {@link DemuxingIoHandler#registerMessageType(Class, MessageHandler)}.
+ * {@link DemuxingIoHandler#addMessageHandler(Class, MessageHandler)}.
  * 
  * @author The Apache Directory Project
  * @version $Rev$, $Date$

Modified: directory/network/trunk/src/java/org/apache/mina/handler/UnknownMessageTypeException.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/handler/UnknownMessageTypeException.java?rev=325850&r1=325849&r2=325850&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/handler/UnknownMessageTypeException.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/handler/UnknownMessageTypeException.java
Mon Oct 17 00:07:19 2005
@@ -23,7 +23,7 @@
  * An exception that is thrown when {@link DemuxingIoHandler}
  * cannot find any {@link MessageHandler}s associated with the specific
  * message type.  You have to use
- * {@link DemuxingIoHandler#registerMessageType(Class, MessageHandler)}
+ * {@link DemuxingIoHandler#addMessageHandler(Class, MessageHandler)}
  * to associate a message type and a message handler. 
  * 
  * @author The Apache Directory Project



Mime
View raw message