directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r682614 - /directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewModifyDnHandler.java
Date Tue, 05 Aug 2008 07:43:49 GMT
Author: akarasulu
Date: Tue Aug  5 00:43:49 2008
New Revision: 682614

URL: http://svn.apache.org/viewvc?rev=682614&view=rev
Log:
modify dn operation handling now extends the single reply request handler which contains the
referral handling code: the crusty old code dealing with JNDI was removed

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

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewModifyDnHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewModifyDnHandler.java?rev=682614&r1=682613&r2=682614&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewModifyDnHandler.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewModifyDnHandler.java
Tue Aug  5 00:43:49 2008
@@ -20,17 +20,12 @@
 package org.apache.directory.server.newldap.handlers;
 
  
-import javax.naming.NamingException;
-import javax.naming.ReferralException;
-
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.newldap.LdapSession;
-import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.message.LdapResult;
 import org.apache.directory.shared.ldap.message.ModifyDnRequest;
-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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,13 +37,10 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 664302 $
  */
-public class NewModifyDnHandler extends LdapRequestHandler<ModifyDnRequest>
+public class NewModifyDnHandler extends SingleReplyRequestHandler<ModifyDnRequest>
 {
     private static final Logger LOG = LoggerFactory.getLogger( NewModifyDnHandler.class );
 
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
     
     /**
      * Deal with a ModifyDN request received from a client.
@@ -66,14 +58,11 @@
      * - newSuperior : this is a move operation. The entry is removed from its
      * current location, and created in the new one.
      */
-    public void handle( LdapSession session, ModifyDnRequest req ) throws Exception
+    public void handleIgnoringReferrals( LdapSession session, LdapDN reqTargetDn, 
+        ClonedServerEntry entry, ModifyDnRequest req )
     {
         LdapResult result = req.getResultResponse().getLdapResult();
-
-        if ( IS_DEBUG )
-        {
-            LOG.debug( "Received: ", req );
-        }
+        LOG.debug( "Handling modify dn request while ignoring referrals: {}", req );
 
         if ( req.getName().isEmpty() )
         {
@@ -106,53 +95,9 @@
             result.setResultCode( ResultCodeEnum.SUCCESS );
             session.getIoSession().write( req.getResultResponse() );
         }
-        catch ( ReferralException e )
+        catch ( Exception e )
         {
-            ReferralImpl refs = new ReferralImpl();
-            result.setReferral( refs );
-            result.setResultCode( ResultCodeEnum.REFERRAL );
-            result.setErrorMessage( "Encountered referral attempting to handle modifyDn request."
);
-            result.setMatchedDn( ( LdapDN ) e.getResolvedName() );
-
-            do
-            {
-                refs.addLdapUrl( ( String ) e.getReferralInfo() );
-            }
-            while ( e.skipReferral() );
-
-            session.getIoSession().write( req.getResultResponse() );
-        }
-        catch ( NamingException e )
-        {
-            String msg = "failed to modify DN of entry " + req.getName() + ": " + e.getMessage();
-
-            if ( IS_DEBUG )
-            {
-                msg += ":\n" + ExceptionUtils.getStackTrace( e );
-            }
-
-            ResultCodeEnum code;
-
-            if ( e instanceof LdapException )
-            {
-                code = ( ( LdapException ) e ).getResultCode();
-            }
-            else
-            {
-                code = ResultCodeEnum.getBestEstimate( e, req.getType() );
-            }
-
-            result.setResultCode( code );
-            result.setErrorMessage( msg );
-
-            if ( ( e.getResolvedName() != null )
-                && ( ( code == ResultCodeEnum.NO_SUCH_OBJECT ) || ( code == ResultCodeEnum.ALIAS_PROBLEM
)
-                    || ( code == ResultCodeEnum.INVALID_DN_SYNTAX ) || ( code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM
) ) )
-            {
-                result.setMatchedDn( (LdapDN)e.getResolvedName() );
-            }
-
-            session.getIoSession().write( req.getResultResponse() );
+            handleException( session, req, e );
         }
     }
 }
\ No newline at end of file



Mime
View raw message