directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r664446 - /directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewCompareHandler.java
Date Sun, 08 Jun 2008 05:28:19 GMT
Author: akarasulu
Date: Sat Jun  7 22:28:19 2008
New Revision: 664446

URL: http://svn.apache.org/viewvc?rev=664446&view=rev
Log:
added new CompareRequest handler implementation

Modified:
    directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewCompareHandler.java

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewCompareHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewCompareHandler.java?rev=664446&r1=664445&r2=664446&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewCompareHandler.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewCompareHandler.java
Sat Jun  7 22:28:19 2008
@@ -20,22 +20,18 @@
 package org.apache.directory.server.newldap.handlers;
 
 
-import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.ReferralException;
-import javax.naming.ldap.LdapContext;
 
-import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.newldap.LdapSession;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.message.CompareRequest;
 import org.apache.directory.shared.ldap.message.LdapResult;
-import org.apache.directory.shared.ldap.message.ManageDsaITControl;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
-import org.apache.mina.common.IoSession;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -61,22 +57,7 @@
 
         try
         {
-            LdapContext ctx = getSessionRegistry().getLdapContext( session, null, true );
-            ServerLdapContext newCtx = ( ServerLdapContext ) ctx.lookup( "" );
-
-            if ( req.getControls().containsKey( ManageDsaITControl.CONTROL_OID ) )
-            {
-                newCtx.addToEnvironment( Context.REFERRAL, "ignore" );
-            }
-            else
-            {
-                newCtx.addToEnvironment( Context.REFERRAL, "throw" );
-            }
-
-            // Inject controls into the context
-            setRequestControls( newCtx, req );
-
-            if ( newCtx.compare( req.getName(), req.getAttributeId(), req.getAssertionValue()
) )
+            if ( session.getCoreSession().compare( req ) )
             {
                 result.setResultCode( ResultCodeEnum.COMPARE_TRUE );
             }
@@ -86,8 +67,7 @@
             }
 
             result.setMatchedDn( req.getName() );
-            req.getResultResponse().addAll( newCtx.getResponseControls() );
-            session.write( req.getResultResponse() );
+            session.getIoSession().write( req.getResultResponse() );
         }
         catch ( ReferralException e )
         {
@@ -103,7 +83,7 @@
                 refs.addLdapUrl( ( String ) e.getReferralInfo() );
             }
             while ( e.skipReferral() );
-            session.write( req.getResultResponse() );
+            session.getIoSession().write( req.getResultResponse() );
         }
         catch ( Exception e )
         {
@@ -140,7 +120,7 @@
                 }
             }
 
-            session.write( req.getResultResponse() );
+            session.getIoSession().write( req.getResultResponse() );
         }
     }
 }
\ No newline at end of file



Mime
View raw message