directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r157382 - in directory/apacheds/trunk: ./ core/ main/ plugin/ protocol/src/main/java/org/apache/ldap/server/protocol/ protocol/src/test/org/apache/ldap/server/protocol/
Date Mon, 14 Mar 2005 04:31:06 GMT
Author: trustin
Date: Sun Mar 13 20:31:02 2005
New Revision: 157382

URL: http://svn.apache.org/viewcvs?view=rev&rev=157382
Log:
* Updated apacheds-protocol to use MINA DemuxingProtocolHandler
* Changed groupId of apacheds from incubator-directory to directory
* Updated dependencies under apacheds


Removed:
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/CommandHandler.java
Modified:
    directory/apacheds/trunk/core/project.xml
    directory/apacheds/trunk/main/project.xml
    directory/apacheds/trunk/plugin/project.xml
    directory/apacheds/trunk/project.xml
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AbandonHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AddHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/BindHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ExtendedHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java
    directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java
    directory/apacheds/trunk/protocol/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java

Modified: directory/apacheds/trunk/core/project.xml
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/project.xml?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/core/project.xml (original)
+++ directory/apacheds/trunk/core/project.xml Sun Mar 13 20:31:02 2005
@@ -85,12 +85,12 @@
       </properties>
     </dependency>
     <dependency>
-      <groupId>incubator-directory</groupId>
+      <groupId>directory</groupId>
       <artifactId>apacheds-shared</artifactId>
       <version>0.9-SNAPSHOT</version>
     </dependency>
     <dependency>
-      <groupId>incubator-directory</groupId>
+      <groupId>directory</groupId>
       <artifactId>apacheds-protocol</artifactId>
       <version>0.9-SNAPSHOT</version>
     </dependency>

Modified: directory/apacheds/trunk/main/project.xml
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/project.xml?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/main/project.xml (original)
+++ directory/apacheds/trunk/main/project.xml Sun Mar 13 20:31:02 2005
@@ -83,12 +83,12 @@
       </properties>
     </dependency>
     <dependency>
-      <groupId>incubator-directory</groupId>
+      <groupId>directory</groupId>
       <artifactId>apacheds-shared</artifactId>
       <version>0.9-SNAPSHOT</version>
     </dependency>
     <dependency>
-      <groupId>incubator-directory</groupId>
+      <groupId>directory</groupId>
       <artifactId>apacheds-protocol</artifactId>
       <version>0.9-SNAPSHOT</version>
     </dependency>
@@ -113,7 +113,7 @@
       <version>0.7-SNAPSHOT</version>
     </dependency>
     <dependency>
-      <groupId>incubator-directory</groupId>
+      <groupId>directory</groupId>
       <artifactId>apacheds-core</artifactId>
       <version>0.9-SNAPSHOT</version>
     </dependency>

Modified: directory/apacheds/trunk/plugin/project.xml
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/plugin/project.xml?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/plugin/project.xml (original)
+++ directory/apacheds/trunk/plugin/project.xml Sun Mar 13 20:31:02 2005
@@ -49,7 +49,7 @@
       <version>0.9-SNAPSHOT</version>
     </dependency>
     <dependency>
-      <groupId>incubator-directory</groupId>
+      <groupId>directory</groupId>
       <artifactId>apacheds-shared</artifactId>
       <version>0.9-SNAPSHOT</version>
     </dependency>

Modified: directory/apacheds/trunk/project.xml
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/project.xml?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/project.xml (original)
+++ directory/apacheds/trunk/project.xml Sun Mar 13 20:31:02 2005
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 
 <project>
-    <groupId>incubator-directory</groupId>
+    <groupId>directory</groupId>
     <artifactId>apacheds</artifactId>
     <name>Apache Directory Server</name>
     <currentVersion>0.9-SNAPSHOT</currentVersion>
@@ -26,22 +26,22 @@
       /www/incubator.apache.org/directory/subprojects/apacheds
     </siteDirectory>
     <distributionDirectory>
-      /www/cvs.apache.org/dist/incubator/directory
+      /www/cvs.apache.org/dist/directory
     </distributionDirectory>
 
     <gumpRepositoryId>apache-incubator-svn</gumpRepositoryId>
 
     <repository>
       <connection>
-        scm:svn:http://svn.apache.org/repos/asf/incubator:directory/apacheds/trunk/${module.path}
+        scm:svn:http://svn.apache.org/repos/asf:directory/apacheds/trunk/${module.path}
       </connection>
 
       <url>
-        http://svn.apache.org/viewcvs.cgi/incubator/directory/apacheds/trunk/${module.path}/?root=Apache-SVN
+        http://svn.apache.org/viewcvs.cgi/directory/apacheds/trunk/${module.path}/?root=Apache-SVN
       </url>
       
       <developerConnection>
-        https://svn.apache.org/repos/asf/incubator/directory/apacheds/trunk/${module.path}
+        https://svn.apache.org/repos/asf/directory/apacheds/trunk/${module.path}
       </developerConnection>
     </repository>
   

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AbandonHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AbandonHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AbandonHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AbandonHandler.java
Sun Mar 13 20:31:02 2005
@@ -20,6 +20,7 @@
 import org.apache.ldap.common.NotImplementedException;
 import org.apache.ldap.common.message.AbandonRequest;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 
 /**
@@ -28,9 +29,9 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class AbandonHandler implements CommandHandler
+public class AbandonHandler implements MessageHandler
 {
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         AbandonRequest req = ( AbandonRequest ) request;
         int abandonedId = req.getAbandoned();

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AddHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AddHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AddHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/AddHandler.java
Sun Mar 13 20:31:02 2005
@@ -28,6 +28,7 @@
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 /**
  * A single reply handler for {@link org.apache.ldap.common.message.AddRequest}s.
@@ -35,9 +36,9 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class AddHandler implements CommandHandler
+public class AddHandler implements MessageHandler
 {
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         AddRequest req = ( AddRequest ) request;
         AddResponse resp = new AddResponseImpl( req.getMessageId() );

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/BindHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/BindHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/BindHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/BindHandler.java
Sun Mar 13 20:31:02 2005
@@ -33,6 +33,7 @@
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 
 /**
@@ -41,12 +42,12 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class BindHandler implements CommandHandler
+public class BindHandler implements MessageHandler
 {
     private static final Control[] EMPTY = new Control[0];
 
 
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         InitialLdapContext ictx;
         BindRequest req = ( BindRequest ) request;

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java
Sun Mar 13 20:31:02 2005
@@ -30,6 +30,7 @@
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 
 /**
@@ -38,9 +39,9 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class CompareHandler implements CommandHandler
+public class CompareHandler implements MessageHandler
 {
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         CompareRequest req = ( CompareRequest ) request;
         CompareResponse resp = new CompareResponseImpl( req.getMessageId() );

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
Sun Mar 13 20:31:02 2005
@@ -28,6 +28,7 @@
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 /**
  * A single reply handler for {@link org.apache.ldap.common.message.DeleteRequest}s.
@@ -35,9 +36,9 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DeleteHandler implements CommandHandler
+public class DeleteHandler implements MessageHandler
 {
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         DeleteRequest req = ( DeleteRequest ) request;
         DeleteResponse resp = new DeleteResponseImpl( req.getMessageId() );

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ExtendedHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ExtendedHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ExtendedHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ExtendedHandler.java
Sun Mar 13 20:31:02 2005
@@ -19,6 +19,7 @@
 
 import org.apache.ldap.common.NotImplementedException;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 
 /**
@@ -27,9 +28,9 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ExtendedHandler implements CommandHandler
+public class ExtendedHandler implements MessageHandler
 {
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         throw new NotImplementedException( "handle in org.apache.ldap.server.protocol.ExtendedHandler
not implemented!" );
     }

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java
Sun Mar 13 20:31:02 2005
@@ -49,13 +49,15 @@
 import org.apache.ldap.common.message.UnbindRequest;
 import org.apache.ldap.common.message.UnbindRequestImpl;
 import org.apache.ldap.common.message.spi.Provider;
+import org.apache.mina.common.IdleStatus;
+import org.apache.mina.protocol.DemuxingProtocolHandler;
 import org.apache.mina.protocol.ProtocolCodecFactory;
 import org.apache.mina.protocol.ProtocolDecoder;
 import org.apache.mina.protocol.ProtocolEncoder;
 import org.apache.mina.protocol.ProtocolHandler;
-import org.apache.mina.protocol.ProtocolHandlerAdapter;
 import org.apache.mina.protocol.ProtocolProvider;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 import org.apache.mina.protocol.codec.Asn1CodecDecoder;
 import org.apache.mina.protocol.codec.Asn1CodecEncoder;
 
@@ -127,9 +129,6 @@
     /** the MINA protocol handler */
     private final LdapProtocolHandler handler = new LdapProtocolHandler();
 
-    /** the handlers to use while processing requests */
-    private final Map commandHandlers;
-
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
@@ -143,8 +142,6 @@
     public LdapProtocolProvider( Hashtable env ) throws LdapNamingException
     {
         Hashtable copy = ( Hashtable ) env.clone();
-        this.commandHandlers = new HashMap();
-
         copy.put( Context.PROVIDER_URL, "" );
         SessionRegistry.releaseSingleton();
         new SessionRegistry( copy );
@@ -152,7 +149,7 @@
         Iterator requestTypes = DEFAULT_HANDLERS.keySet().iterator();
         while( requestTypes.hasNext() )
         {
-            CommandHandler handler = null;
+            MessageHandler handler = null;
             String type = ( String ) requestTypes.next();
             Class clazz = null;
 
@@ -179,7 +176,7 @@
 
             try
             {
-                handler = ( CommandHandler ) clazz.newInstance();
+                handler = ( MessageHandler ) clazz.newInstance();
             }
             catch( Exception e )
             {
@@ -191,7 +188,7 @@
                 throw lne;
             }
 
-            this.commandHandlers.put( type, handler );
+            this.handler.registerMessageType( clazz, handler );
         }
 
         this.codecFactory = new ProtocolCodecFactoryImpl( copy );
@@ -202,14 +199,13 @@
      */
     public LdapProtocolProvider() throws LdapNamingException
     {
-        this.commandHandlers = new HashMap();
         SessionRegistry.releaseSingleton();
         new SessionRegistry( null );
 
         Iterator requestTypes = DEFAULT_HANDLERS.keySet().iterator();
         while( requestTypes.hasNext() )
         {
-            CommandHandler handler = null;
+            MessageHandler handler = null;
             String type = ( String ) requestTypes.next();
             Class clazz = null;
 
@@ -217,7 +213,7 @@
 
             try
             {
-                handler = ( CommandHandler ) clazz.newInstance();
+                handler = ( MessageHandler ) clazz.newInstance();
             }
             catch( Exception e )
             {
@@ -229,7 +225,7 @@
                 throw lne;
             }
 
-            this.commandHandlers.put( type, handler );
+            this.handler.registerMessageType( clazz, handler );
         }
 
         this.codecFactory = new ProtocolCodecFactoryImpl();
@@ -254,28 +250,6 @@
         return handler;
     }
 
-    public CommandHandler getCommandHandler( Object request )
-    {
-        if( this.commandHandlers.containsKey( request.getClass().getName() ) )
-        {
-            return ( CommandHandler ) this.commandHandlers.get( request
-                    .getClass().getName() );
-        }
-
-        Class[] interfaces = request.getClass().getInterfaces();
-        for( int ii = 0; ii < interfaces.length; ii ++ )
-        {
-            if( this.commandHandlers.containsKey( interfaces[ ii ].getName() ) )
-            {
-                return ( CommandHandler ) this.commandHandlers
-                        .get( interfaces[ ii ].getName() );
-            }
-        }
-
-        String msg = "cannot find a handler for request: " + request;
-        throw new IllegalArgumentException( msg );
-    }
-
     /**
      * A snickers based BER Decoder factory.
      */
@@ -319,13 +293,20 @@
         }
     }
 
-    private class LdapProtocolHandler extends ProtocolHandlerAdapter
+    private class LdapProtocolHandler extends DemuxingProtocolHandler
     {
+        private LdapProtocolHandler()
+        {
+        }
+
+        protected void deregisterMessageType( Class arg0 )
+        {
+            super.deregisterMessageType( arg0 );
+        }
 
-        public void messageReceived( ProtocolSession session, Object request )
+        protected void registerMessageType( Class arg0, MessageHandler arg1 )
         {
-            CommandHandler handler = getCommandHandler( request );
-            handler.handle( session, request );
+            super.registerMessageType( arg0, arg1 );
         }
 
         public void sessionClosed( ProtocolSession session )
@@ -336,6 +317,18 @@
         public void exceptionCaught( ProtocolSession session, Throwable cause )
         {
             cause.printStackTrace();
+        }
+
+        public void messageSent( ProtocolSession arg0, Object arg1 )
+        {
+        }
+
+        public void sessionIdle( ProtocolSession arg0, IdleStatus arg1 )
+        {
+        }
+
+        public void sessionOpened( ProtocolSession arg0 )
+        {
         }
     }
 }

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java
Sun Mar 13 20:31:02 2005
@@ -30,6 +30,7 @@
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 
 /**
@@ -38,9 +39,9 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ModifyDnHandler implements CommandHandler
+public class ModifyDnHandler implements MessageHandler
 {
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         ModifyDnRequest req = ( ModifyDnRequest ) request;
         ModifyDnResponse resp = new ModifyDnResponseImpl( req.getMessageId() );

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java
Sun Mar 13 20:31:02 2005
@@ -30,6 +30,7 @@
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 
 /**
@@ -38,11 +39,11 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ModifyHandler implements CommandHandler
+public class ModifyHandler implements MessageHandler
 {
     private static final ModificationItem[] EMPTY = new ModificationItem[0];
 
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         ModifyRequest req = ( ModifyRequest ) request;
         ModifyResponse resp = new ModifyResponseImpl( req.getMessageId() );

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java
Sun Mar 13 20:31:02 2005
@@ -44,6 +44,7 @@
 import org.apache.ldap.common.util.ArrayUtils;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 /**
  * A handler for processing search requests.
@@ -51,12 +52,12 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class SearchHandler implements CommandHandler
+public class SearchHandler implements MessageHandler
 {
     private static final String DEREFALIASES_KEY = "java.naming.ldap.derefAliases";
 
 
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         LdapContext ctx;
         SearchRequest req = ( SearchRequest ) request;

Modified: directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java
(original)
+++ directory/apacheds/trunk/protocol/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java
Sun Mar 13 20:31:02 2005
@@ -21,6 +21,7 @@
 import javax.naming.ldap.InitialLdapContext;
 
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 
 /**
@@ -30,9 +31,9 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class UnbindHandler implements CommandHandler
+public class UnbindHandler implements MessageHandler
 {
-    public void handle( ProtocolSession session, Object request )
+    public void messageReceived( ProtocolSession session, Object request )
     {
         SessionRegistry registry = SessionRegistry.getSingleton();
 

Modified: directory/apacheds/trunk/protocol/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/protocol/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java?view=diff&r1=157381&r2=157382
==============================================================================
--- directory/apacheds/trunk/protocol/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java
(original)
+++ directory/apacheds/trunk/protocol/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java
Sun Mar 13 20:31:02 2005
@@ -44,18 +44,18 @@
 import org.apache.ldap.common.message.UnbindRequest;
 import org.apache.ldap.common.message.UnbindRequestImpl;
 import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
 
 
 /**
  * Tests the LdapProtocolProvider.
+ * FIXME: This test case doesn't test enough now.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public class LdapProtocolProviderTest extends TestCase
 {
-
-
     /**
      * Tests to make sure all the default handlers are kicking in properly with
      * the right request type.
@@ -68,41 +68,8 @@
         LdapProtocolProvider provider = new LdapProtocolProvider();
         assertNotNull( provider.getCodecFactory() );
         assertTrue( provider.getName() == LdapProtocolProvider.SERVICE_NAME );
-
-        Object req = null;
-
-        req = new AbandonRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof AbandonHandler );
-
-        req = new AddRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof AddHandler );
-
-        req = new BindRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof BindHandler );
-
-        req = new CompareRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof CompareHandler );
-
-        req = new DeleteRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof DeleteHandler );
-
-        req = new ExtendedRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof ExtendedHandler );
-
-        req = new ModifyDnRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof ModifyDnHandler );
-
-        req = new ModifyRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof ModifyHandler );
-
-        req = new SearchRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof SearchHandler );
-
-        req = new UnbindRequestImpl( 0 );
-        assertTrue( provider.getCommandHandler( req ) instanceof UnbindHandler );
     }
 
-
     /**
      * Tests to make sure handlers for alternative configurations are kicking
      * in properly with the right request type.
@@ -147,136 +114,88 @@
         LdapProtocolProvider provider = new LdapProtocolProvider( props );
         assertNotNull( provider.getCodecFactory() );
         assertTrue( provider.getName() == LdapProtocolProvider.SERVICE_NAME );
-
-        Object req = null;
-        CommandHandler handler = null;
-
-        req = new AbandonRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusAbandonHandler );
-
-        req = new AddRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusAddHandler );
-
-        req = new BindRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusBindHandler );
-
-        req = new CompareRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusCompareHandler );
-
-        req = new DeleteRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusDeleteHandler );
-
-        req = new ExtendedRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusExtendedHandler );
-
-        req = new ModifyDnRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusModifyDnHandler );
-
-        req = new ModifyRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusModifyHandler );
-
-        req = new SearchRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusSearchHandler );
-
-        req = new UnbindRequestImpl( 0 );
-        handler = provider.getCommandHandler( req );
-        assertTrue( handler instanceof BogusUnbindHandler );
     }
 
 
-    public static class BogusAbandonHandler implements CommandHandler
+    public static class BogusAbandonHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
-
-    public static class BogusUnbindHandler implements CommandHandler
+    public static class BogusUnbindHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
-
-    public static class BogusAddHandler implements CommandHandler
+    public static class BogusAddHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
-
-    public static class BogusBindHandler implements CommandHandler
+    public static class BogusBindHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
-
-    public static class BogusCompareHandler implements CommandHandler
+    public static class BogusCompareHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
-
-    public static class BogusDeleteHandler implements CommandHandler
+    public static class BogusDeleteHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
 
-    public static class BogusExtendedHandler implements CommandHandler
+    public static class BogusExtendedHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
 
-    public static class BogusModifyDnHandler implements CommandHandler
+    public static class BogusModifyDnHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
 
-    public static class BogusModifyHandler implements CommandHandler
+    public static class BogusModifyHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
     }
 
 
-    public static class BogusSearchHandler implements CommandHandler
+    public static class BogusSearchHandler implements MessageHandler
     {
-        public void handle( ProtocolSession session, Object request )
+        public void messageReceived( ProtocolSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }



Mime
View raw message