directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r330766 - in /directory/protocol-providers/ldap/trunk: ./ src/main/java/org/apache/ldap/server/protocol/ src/main/java/org/apache/ldap/server/protocol/support/ src/test/org/apache/ldap/server/protocol/
Date Fri, 04 Nov 2005 09:21:49 GMT
Author: trustin
Date: Fri Nov  4 01:21:37 2005
New Revision: 330766

URL: http://svn.apache.org/viewcvs?rev=330766&view=rev
Log:
Related issue: DIR-114 Migrate all protocol providers to MINA 0.9.
* Migrated protocol-provider for LDAP to MINA 0.9.

Modified:
    directory/protocol-providers/ldap/trunk/project.xml
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ExtendedOperationHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SessionRegistry.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AbandonHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/BindHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ExtendedHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/UnbindHandler.java
    directory/protocol-providers/ldap/trunk/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java

Modified: directory/protocol-providers/ldap/trunk/project.xml
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/project.xml?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/project.xml (original)
+++ directory/protocol-providers/ldap/trunk/project.xml Fri Nov  4 01:21:37 2005
@@ -174,7 +174,7 @@
     <dependency>
       <groupId>directory-network</groupId>
       <artifactId>mina</artifactId>
-      <version>0.8.0</version>
+      <version>0.9.0-SNAPSHOT</version>
       <url>http://directory.apache.org/subprojects/network/mina</url>
     </dependency>
     <dependency>

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ExtendedOperationHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ExtendedOperationHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ExtendedOperationHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ExtendedOperationHandler.java
Fri Nov  4 01:21:37 2005
@@ -20,7 +20,7 @@
 
 import org.apache.ldap.common.message.ExtendedRequest;
 import org.apache.ldap.common.message.ExtendedResponse;
-import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.common.IoSession;
 
 /**
  * An extension (hook) point that enables an implementor to provide his or her
@@ -48,5 +48,5 @@
      * 
      * @throws Exception if failed to handle the operation
      */
-    void handleExtendedOperation( ProtocolSession session, SessionRegistry registry, ExtendedRequest
req, ExtendedResponse res ) throws Exception;
+    void handleExtendedOperation( IoSession session, SessionRegistry registry, ExtendedRequest
req, ExtendedResponse res ) throws Exception;
 }

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java
Fri Nov  4 01:21:37 2005
@@ -61,14 +61,13 @@
 import org.apache.ldap.server.protocol.support.ModifyHandler;
 import org.apache.ldap.server.protocol.support.SearchHandler;
 import org.apache.ldap.server.protocol.support.UnbindHandler;
-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.ProtocolProvider;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.DemuxingProtocolHandler;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.handler.DemuxingIoHandler;
+import org.apache.mina.handler.MessageHandler;
 
 /**
  * An LDAP protocol provider implementation which dynamically associates
@@ -77,7 +76,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class LdapProtocolProvider implements ProtocolProvider
+public class LdapProtocolProvider
 {
     /** the constant service name of this ldap protocol provider **/
     public static final String SERVICE_NAME = "ldap";
@@ -254,7 +253,7 @@
         return codecFactory;
     }
 
-    public ProtocolHandler getHandler()
+    public IoHandler getHandler()
     {
         return handler;
     }
@@ -316,7 +315,7 @@
             this.env = env;
         }
 
-        public ProtocolEncoder newEncoder()
+        public ProtocolEncoder getEncoder()
         {
             if( env == null || env.get( Provider.BERLIB_PROVIDER ) == null )
             {
@@ -328,7 +327,7 @@
             }
         }
 
-        public ProtocolDecoder newDecoder()
+        public ProtocolDecoder getDecoder()
         {
             if( env == null || env.get( Provider.BERLIB_PROVIDER ) == null )
             {
@@ -341,14 +340,14 @@
         }
     }
 
-    private class LdapProtocolHandler extends DemuxingProtocolHandler
+    private class LdapProtocolHandler extends DemuxingIoHandler
     {
-        public void sessionClosed( ProtocolSession session )
+        public void sessionClosed( IoSession session )
         {
             SessionRegistry.getSingleton().remove( session );
         }
 
-        public void exceptionCaught( ProtocolSession session, Throwable cause )
+        public void exceptionCaught( IoSession session, Throwable cause )
         {
             cause.printStackTrace();
         }

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SessionRegistry.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SessionRegistry.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SessionRegistry.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SessionRegistry.java
Fri Nov  4 01:21:37 2005
@@ -29,10 +29,10 @@
 import javax.naming.spi.InitialContextFactory;
 
 import org.apache.ldap.common.exception.LdapNoPermissionException;
-import org.apache.ldap.server.jndi.ServerLdapContext;
 import org.apache.ldap.server.configuration.Configuration;
 import org.apache.ldap.server.configuration.StartupConfiguration;
-import org.apache.mina.protocol.ProtocolSession;
+import org.apache.ldap.server.jndi.ServerLdapContext;
+import org.apache.mina.common.IoSession;
 
 
 /**
@@ -131,7 +131,7 @@
      * InitialContext if one is not present for the operation
      * @return the InitialContext or null
      */
-    public LdapContext getLdapContext( ProtocolSession session, Control[] connCtls, boolean
allowAnonymous )
+    public LdapContext getLdapContext( IoSession session, Control[] connCtls, boolean allowAnonymous
)
             throws NamingException
     {
         LdapContext ctx = null;
@@ -206,7 +206,7 @@
      * @param connCtls connection controls if any to use if creating anon context
      * @return the InitialContext or null
      */
-    public LdapContext getLdapContextOnRootDSEAccess( ProtocolSession session, Control[]
connCtls )
+    public LdapContext getLdapContextOnRootDSEAccess( IoSession session, Control[] connCtls
)
             throws NamingException
     {
         LdapContext ctx = null;
@@ -249,7 +249,7 @@
      * @param session the client session
      * @param ictx the initial context gotten
      */
-    public void setLdapContext( ProtocolSession session, LdapContext ictx )
+    public void setLdapContext( IoSession session, LdapContext ictx )
     {
         synchronized( contexts )
         {
@@ -263,7 +263,7 @@
      *
      * @param session the client's key
      */
-    public void remove( ProtocolSession session )
+    public void remove( IoSession session )
     {
         synchronized( contexts )
         {
@@ -277,7 +277,7 @@
      *
      * @param session the client key of the client to disconnect
      */
-    public void terminateSession( ProtocolSession session )
+    public void terminateSession( IoSession session )
     {
         session.close();
     }

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AbandonHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AbandonHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AbandonHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AbandonHandler.java
Fri Nov  4 01:21:37 2005
@@ -18,8 +18,8 @@
 
 
 import org.apache.ldap.common.message.AbandonRequest;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -34,7 +34,7 @@
 {
     private static final Logger log = LoggerFactory.getLogger( AbandonHandler.class );
 
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         AbandonRequest req = ( AbandonRequest ) request;
         int abandonedId = req.getAbandoned();

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/AddHandler.java
Fri Nov  4 01:21:37 2005
@@ -27,8 +27,8 @@
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,7 +43,7 @@
 {
     private static final Logger log = LoggerFactory.getLogger( AddHandler.class );
 
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         AddRequest req = ( AddRequest ) request;
         
@@ -83,18 +83,13 @@
             resp.getLdapResult().setResultCode( code );
             resp.getLdapResult().setErrorMessage( msg );
             
-            if ( e instanceof NamingException )
+            if ( ( e.getResolvedName() != null ) &&
+                    ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
+                      ( code == ResultCodeEnum.ALIASPROBLEM ) ||
+                      ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
+                      ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-            	NamingException ne = (NamingException)e;
-            	
-                if ( ( ne.getResolvedName() != null ) &&
-                        ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
-                          ( code == ResultCodeEnum.ALIASPROBLEM ) ||
-                          ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
-                          ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
-                {
-                    resp.getLdapResult().setMatchedDn( ne.getResolvedName().toString() );
-                }
+                resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
             }
 
             session.write( resp );

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/BindHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/BindHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/BindHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/BindHandler.java
Fri Nov  4 01:21:37 2005
@@ -35,11 +35,9 @@
 import org.apache.ldap.common.message.LdapResultImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
-//import org.apache.ldap.server.configuration.Configuration;
-//import org.apache.ldap.server.configuration.StartupConfiguration;
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -55,7 +53,7 @@
     private static final Control[] EMPTY = new Control[0];
 
 
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         LdapContext ctx;
         BindRequest req = ( BindRequest ) request;
@@ -141,18 +139,13 @@
                 msg += "\n\nBindRequest = \n" + req.toString();
             }
 
-            if ( e instanceof NamingException )
+            if ( ( e.getResolvedName() != null ) &&
+                    ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
+                      ( code == ResultCodeEnum.ALIASPROBLEM ) ||
+                      ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
+                      ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-            	NamingException ne = (NamingException)e;
-            	
-                if ( ( ne.getResolvedName() != null ) &&
-                        ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
-                          ( code == ResultCodeEnum.ALIASPROBLEM ) ||
-                          ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
-                          ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
-                {
-                    resp.getLdapResult().setMatchedDn( ne.getResolvedName().toString() );
-                }
+                resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
             }
             
             result.setErrorMessage( msg );

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/CompareHandler.java
Fri Nov  4 01:21:37 2005
@@ -30,8 +30,8 @@
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.jndi.ServerLdapContext;
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,7 +46,7 @@
 {
     private static final Logger log = LoggerFactory.getLogger( CompareHandler.class );
 
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         CompareRequest req = ( CompareRequest ) request;
         CompareResponse resp = new CompareResponseImpl( req.getMessageId() );

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/DeleteHandler.java
Fri Nov  4 01:21:37 2005
@@ -27,8 +27,8 @@
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,7 +44,7 @@
     private static final Logger LOG = LoggerFactory.getLogger( DeleteHandler.class );
 
 
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         DeleteRequest req = ( DeleteRequest ) request;
         DeleteResponse resp = new DeleteResponseImpl( req.getMessageId() );
@@ -78,18 +78,13 @@
             resp.getLdapResult().setResultCode( code );
             resp.getLdapResult().setErrorMessage( msg );
 
-            if ( e instanceof NamingException )
+            if ( ( e.getResolvedName() != null ) &&
+                    ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
+                      ( code == ResultCodeEnum.ALIASPROBLEM ) ||
+                      ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
+                      ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-            	NamingException ne = (NamingException)e;
-            	
-                if ( ( ne.getResolvedName() != null ) &&
-                        ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
-                          ( code == ResultCodeEnum.ALIASPROBLEM ) ||
-                          ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
-                          ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
-                {
-                    resp.getLdapResult().setMatchedDn( ne.getResolvedName().toString() );
-                }
+                resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
             }
 
             session.write( resp );

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ExtendedHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ExtendedHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ExtendedHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ExtendedHandler.java
Fri Nov  4 01:21:37 2005
@@ -30,8 +30,8 @@
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.protocol.ExtendedOperationHandler;
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 
 /**
  * A single reply handler for {@link org.apache.ldap.common.message.ExtendedRequest}s.
@@ -69,7 +69,7 @@
         return Collections.unmodifiableMap( handlers );
     }
     
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         ExtendedRequest req = ( ExtendedRequest ) request;
         ExtendedResponse res = new ExtendedResponseImpl( req.getMessageId() );

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyDnHandler.java
Fri Nov  4 01:21:37 2005
@@ -29,8 +29,8 @@
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,7 +45,7 @@
 {
     private static final Logger LOG = LoggerFactory.getLogger( ModifyDnHandler.class );
 
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         ModifyDnRequest req = ( ModifyDnRequest ) request;
         ModifyDnResponse resp = new ModifyDnResponseImpl( req.getMessageId() );
@@ -104,18 +104,13 @@
             resp.getLdapResult().setResultCode( code );
             resp.getLdapResult().setErrorMessage( msg );
 
-            if ( e instanceof NamingException )
+            if ( ( e.getResolvedName() != null ) &&
+                    ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
+                      ( code == ResultCodeEnum.ALIASPROBLEM ) ||
+                      ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
+                      ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-            	NamingException ne = (NamingException)e;
-            	
-                if ( ( ne.getResolvedName() != null ) &&
-                        ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
-                          ( code == ResultCodeEnum.ALIASPROBLEM ) ||
-                          ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
-                          ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
-                {
-                    resp.getLdapResult().setMatchedDn( ne.getResolvedName().toString() );
-                }
+                resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
             }
 
             session.write( resp );

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/ModifyHandler.java
Fri Nov  4 01:21:37 2005
@@ -29,8 +29,8 @@
 import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -47,7 +47,7 @@
     private static final ModificationItem[] EMPTY = new ModificationItem[0];
 
 
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         ModifyRequest req = ( ModifyRequest ) request;
         ModifyResponse resp = new ModifyResponseImpl( req.getMessageId() );
@@ -81,18 +81,13 @@
             resp.getLdapResult().setResultCode( code );
             resp.getLdapResult().setErrorMessage( msg );
 
-            if ( e instanceof NamingException )
+            if ( ( e.getResolvedName() != null ) &&
+                    ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
+                      ( code == ResultCodeEnum.ALIASPROBLEM ) ||
+                      ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
+                      ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-            	NamingException ne = (NamingException)e;
-            	
-                if ( ( ne.getResolvedName() != null ) &&
-                        ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
-                          ( code == ResultCodeEnum.ALIASPROBLEM ) ||
-                          ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
-                          ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
-                {
-                    resp.getLdapResult().setMatchedDn( ne.getResolvedName().toString() );
-                }
+                resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
             }
 
             session.write( resp );

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/SearchHandler.java
Fri Nov  4 01:21:37 2005
@@ -23,23 +23,33 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.ldap.LdapContext;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
+import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
-import org.apache.ldap.common.message.*;
+import org.apache.ldap.common.filter.PresenceNode;
+import org.apache.ldap.common.message.LdapResultImpl;
+import org.apache.ldap.common.message.ReferralImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
+import org.apache.ldap.common.message.ScopeEnum;
+import org.apache.ldap.common.message.SearchRequest;
+import org.apache.ldap.common.message.SearchResponseDone;
+import org.apache.ldap.common.message.SearchResponseDoneImpl;
+import org.apache.ldap.common.message.SearchResponseEntry;
+import org.apache.ldap.common.message.SearchResponseEntryImpl;
+import org.apache.ldap.common.message.SearchResponseReference;
+import org.apache.ldap.common.message.SearchResponseReferenceImpl;
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.util.ArrayUtils;
 import org.apache.ldap.common.util.ExceptionUtils;
-import org.apache.ldap.common.filter.PresenceNode;
+import org.apache.ldap.server.configuration.Configuration;
+import org.apache.ldap.server.configuration.StartupConfiguration;
 import org.apache.ldap.server.jndi.ServerLdapContext;
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.ldap.server.configuration.StartupConfiguration;
-import org.apache.ldap.server.configuration.Configuration;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -55,7 +65,7 @@
     private static final String DEREFALIASES_KEY = "java.naming.ldap.derefAliases";
 
 
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         LdapContext ctx;
         SearchRequest req = ( SearchRequest ) request;
@@ -182,18 +192,13 @@
             resp.getLdapResult().setResultCode( code );
             resp.getLdapResult().setErrorMessage( msg );
 
-            if ( e instanceof NamingException )
+            if ( ( e.getResolvedName() != null ) &&
+                    ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
+                      ( code == ResultCodeEnum.ALIASPROBLEM ) ||
+                      ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
+                      ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-            	NamingException ne = (NamingException)e;
-            	
-                if ( ( ne.getResolvedName() != null ) &&
-                        ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
-                          ( code == ResultCodeEnum.ALIASPROBLEM ) ||
-                          ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
-                          ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
-                {
-                    resp.getLdapResult().setMatchedDn( ne.getResolvedName().toString() );
-                }
+                resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
             }
 
             Iterator it = Collections.singleton( resp ).iterator();
@@ -234,18 +239,13 @@
 
         resp.getLdapResult().setErrorMessage( msg );
 
-        if ( e instanceof NamingException )
+        if ( ( e.getResolvedName() != null ) &&
+                ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
+                  ( code == ResultCodeEnum.ALIASPROBLEM ) ||
+                  ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
+                  ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
         {
-        	NamingException ne = (NamingException)e;
-        	
-            if ( ( ne.getResolvedName() != null ) &&
-                    ( ( code == ResultCodeEnum.NOSUCHOBJECT ) ||
-                      ( code == ResultCodeEnum.ALIASPROBLEM ) ||
-                      ( code == ResultCodeEnum.INVALIDDNSYNTAX ) ||
-                      ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
-            {
-                resp.getLdapResult().setMatchedDn( ne.getResolvedName().toString() );
-            }
+            resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
         }
 
         return resp;

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/UnbindHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/UnbindHandler.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/UnbindHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/support/UnbindHandler.java
Fri Nov  4 01:21:37 2005
@@ -21,8 +21,8 @@
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.server.protocol.SessionRegistry;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 
 
 /**
@@ -34,7 +34,7 @@
  */
 public class UnbindHandler implements MessageHandler
 {
-    public void messageReceived( ProtocolSession session, Object request )
+    public void messageReceived( IoSession session, Object request )
     {
         SessionRegistry registry = SessionRegistry.getSingleton();
 

Modified: directory/protocol-providers/ldap/trunk/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java?rev=330766&r1=330765&r2=330766&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/test/org/apache/ldap/server/protocol/LdapProtocolProviderTest.java
Fri Nov  4 01:21:37 2005
@@ -43,12 +43,12 @@
 import org.apache.ldap.common.message.SearchRequestImpl;
 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.handler.MessageHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.MessageHandler;
 
 
 /**
- * Tests the LdapProtocolProvider.
+ * Tests the .
  * FIXME: This test case doesn't test enough now.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -119,7 +119,7 @@
 
     public static class BogusAbandonHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -127,7 +127,7 @@
 
     public static class BogusUnbindHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -135,7 +135,7 @@
 
     public static class BogusAddHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -143,7 +143,7 @@
 
     public static class BogusBindHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -151,7 +151,7 @@
 
     public static class BogusCompareHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -159,7 +159,7 @@
 
     public static class BogusDeleteHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -168,7 +168,7 @@
 
     public static class BogusExtendedHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -177,7 +177,7 @@
 
     public static class BogusModifyDnHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -186,7 +186,7 @@
 
     public static class BogusModifyHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }
@@ -195,7 +195,7 @@
 
     public static class BogusSearchHandler implements MessageHandler
     {
-        public void messageReceived( ProtocolSession session, Object request )
+        public void messageReceived( IoSession session, Object request )
         {
             throw new NotImplementedException( "handler not implemented!" );
         }



Mime
View raw message