You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/08/19 19:40:58 UTC

svn commit: r687105 [1/3] - in /directory/apacheds/trunk: protocol-newldap/src/main/java/org/apache/directory/server/ldap/ protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ protocol-newldap/src/main/java/org/apache/directory/server/l...

Author: elecharny
Date: Tue Aug 19 10:40:48 2008
New Revision: 687105

URL: http://svn.apache.org/viewvc?rev=687105&view=rev
Log:
Renamed newXXXHandler to the previous XXXHandler name.

Added:
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/ExtendedOperationHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolConstants.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapProtocolConstants.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapProtocolUtils.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapServer.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapSession.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/
      - copied from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/gui/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AbandonHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AddHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/CompareHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/DeleteHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/LdapRequestHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/PersistentSearchListener.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/ReferralAwareRequestHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/UnbindHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractMechanismHandler.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/AbstractMechanismHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/AbstractSaslCallbackHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslServer.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/AbstractSaslServer.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/MechanismHandler.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/MechanismHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SaslConstants.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/SaslConstants.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SaslFilter.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/SaslFilter.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/SimpleMechanismHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/
      - copied from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/cramMD5/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/
      - copied from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/digestMD5/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/gssapi/
      - copied from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/gssapi/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/
      - copied from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/ntlm/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/package-info.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/package-info.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/
      - copied from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/bind/plain/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/
      - copied from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/package-info.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/package-info.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/
      - copied from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/ssl/
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/package-info.java
      - copied, changed from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/package-info.java
Removed:
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/
Modified:
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsModel.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsModel.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/package-info.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5MechanismHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5MechanismHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/gssapi/GssapiCallbackHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/gssapi/GssapiMechanismHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmMechanismHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainMechanismHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainSaslServer.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/package-info.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/LdapsInitializer.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/ServerX509TrustManager.java
    directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/package-info.java
    directory/apacheds/trunk/protocol-newldap/src/test/java/org/apache/directory/server/newldap/LdapServerSettingsTest.java
    directory/apacheds/trunk/protocol-newldap/src/test/java/org/apache/directory/server/newldap/SettingAlternativeHandlersTest.java
    directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/LdapServerFactory.java
    directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
    directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/state/StartedPristineState.java
    directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/state/TestServerContext.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/PasswordPolicyServiceIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddingEntriesWithSpecialCharactersInRDNIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/MatchingRuleCompareIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/ExtendedIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/StoredProcedureIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/IllegalModificationIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyRemoveIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyDnReferralIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyRdnIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/NegationSearchIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchTest.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/ReferralSearchIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SchemaSearchIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/LdapsIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java
    directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
    directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java
    directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java

Copied: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java (from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/ExtendedOperationHandler.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java?p2=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java&p1=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/ExtendedOperationHandler.java&r1=687026&r2=687105&rev=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/ExtendedOperationHandler.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap;
+package org.apache.directory.server.ldap;
 
 
 import java.util.Set;

Copied: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolConstants.java (from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapProtocolConstants.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolConstants.java?p2=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolConstants.java&p1=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapProtocolConstants.java&r1=687026&r2=687105&rev=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapProtocolConstants.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolConstants.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *   under the License.
  *
  */
-package org.apache.directory.server.newldap;
+package org.apache.directory.server.ldap;
 
 import javax.naming.ldap.Control;
 

Copied: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java (from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapProtocolUtils.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java?p2=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java&p1=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapProtocolUtils.java&r1=687026&r2=687105&rev=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapProtocolUtils.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *   under the License.
  *
  */
-package org.apache.directory.server.newldap;
+package org.apache.directory.server.ldap;
 
 
 import org.apache.directory.server.core.interceptor.context.OperationContext;

Copied: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapServer.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?p2=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java&p1=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapServer.java&r1=687026&r2=687105&rev=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapServer.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap;
+package org.apache.directory.server.ldap;
 
 
 import java.io.IOException;
@@ -33,19 +33,19 @@
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.security.CoreKeyStoreSpi;
-import org.apache.directory.server.newldap.handlers.NewExtendedHandler;
-import org.apache.directory.server.newldap.handlers.NewModifyHandler;
-import org.apache.directory.server.newldap.handlers.NewSearchHandler;
-import org.apache.directory.server.newldap.handlers.NewUnbindHandler;
-import org.apache.directory.server.newldap.handlers.LdapRequestHandler;
-import org.apache.directory.server.newldap.handlers.NewAbandonHandler;
-import org.apache.directory.server.newldap.handlers.NewAddHandler;
-import org.apache.directory.server.newldap.handlers.NewBindHandler;
-import org.apache.directory.server.newldap.handlers.NewCompareHandler;
-import org.apache.directory.server.newldap.handlers.NewDeleteHandler;
-import org.apache.directory.server.newldap.handlers.NewModifyDnHandler;
-import org.apache.directory.server.newldap.handlers.bind.*;
-import org.apache.directory.server.newldap.handlers.ssl.LdapsInitializer;
+import org.apache.directory.server.ldap.handlers.LdapRequestHandler;
+import org.apache.directory.server.ldap.handlers.AbandonHandler;
+import org.apache.directory.server.ldap.handlers.AddHandler;
+import org.apache.directory.server.ldap.handlers.BindHandler;
+import org.apache.directory.server.ldap.handlers.CompareHandler;
+import org.apache.directory.server.ldap.handlers.DeleteHandler;
+import org.apache.directory.server.ldap.handlers.ExtendedHandler;
+import org.apache.directory.server.ldap.handlers.ModifyDnHandler;
+import org.apache.directory.server.ldap.handlers.ModifyHandler;
+import org.apache.directory.server.ldap.handlers.SearchHandler;
+import org.apache.directory.server.ldap.handlers.UnbindHandler;
+import org.apache.directory.server.ldap.handlers.bind.*;
+import org.apache.directory.server.ldap.handlers.ssl.LdapsInitializer;
 import org.apache.directory.server.protocol.shared.DirectoryBackedService;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.asn1.codec.Asn1CodecDecoder;
@@ -121,7 +121,7 @@
     private static final int MAX_TIME_LIMIT_DEFAULT = 10000;
 
     /** The default service pid. */
-    private static final String SERVICE_PID_DEFAULT = "org.apache.directory.server.newldap";
+    private static final String SERVICE_PID_DEFAULT = "org.apache.directory.server.ldap";
 
     /** The default service name. */
     private static final String SERVICE_NAME_DEFAULT = "ApacheDS LDAP Service";
@@ -239,54 +239,54 @@
     {
         if ( getAbandonHandler() == null )
         {
-            setAbandonHandler( new NewAbandonHandler() );
+            setAbandonHandler( new AbandonHandler() );
         }
         
         if ( getAddHandler() == null )
         {
-            setAddHandler( new NewAddHandler() );
+            setAddHandler( new AddHandler() );
         }
         
         if ( getBindHandler() == null )
         {
-            NewBindHandler handler = new NewBindHandler();
+            BindHandler handler = new BindHandler();
             handler.setSaslMechanismHandlers( saslMechanismHandlers );
             setBindHandler( handler );
         }
         
         if ( getCompareHandler() == null )
         {
-            setCompareHandler( new NewCompareHandler() );
+            setCompareHandler( new CompareHandler() );
         }
         
         if ( getDeleteHandler() == null )
         {
-            setDeleteHandler( new NewDeleteHandler() );
+            setDeleteHandler( new DeleteHandler() );
         }
         
         if ( getExtendedHandler() == null )
         {
-            setExtendedHandler( new NewExtendedHandler() );
+            setExtendedHandler( new ExtendedHandler() );
         }
         
         if ( getModifyHandler() == null )
         {
-            setModifyHandler( new NewModifyHandler() );
+            setModifyHandler( new ModifyHandler() );
         }
         
         if ( getModifyDnHandler() == null )
         {
-            setModifyDnHandler( new NewModifyDnHandler() );
+            setModifyDnHandler( new ModifyDnHandler() );
         }
         
         if ( getSearchHandler() == null )
         {
-            setSearchHandler( new NewSearchHandler() );
+            setSearchHandler( new SearchHandler() );
         }
         
         if ( getUnbindHandler() == null )
         {
-            setUnbindHandler( new NewUnbindHandler() );
+            setUnbindHandler( new UnbindHandler() );
         }
     }
 
@@ -661,7 +661,7 @@
     /**
      * Sets the {@link ExtendedOperationHandler}s.
      *
-     * @org.apache.xbean.Property nestedType="org.apache.directory.server.newldap.ExtendedOperationHandler"
+     * @org.apache.xbean.Property nestedType="org.apache.directory.server.ldap.ExtendedOperationHandler"
      *
      * @param handlers A collection of {@link ExtendedOperationHandler}s.
      */

Copied: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java (from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapSession.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java?p2=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java&p1=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapSession.java&r1=687026&r2=687105&rev=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/LdapSession.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *   under the License.
  *
  */
-package org.apache.directory.server.newldap;
+package org.apache.directory.server.ldap;
 
 
 import java.util.Collections;

Modified: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java?rev=687105&r1=687026&r2=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap.gui;
+package org.apache.directory.server.ldap.gui;
 
 
 import java.awt.BorderLayout;
@@ -31,8 +31,8 @@
 import javax.swing.JTable;
 import javax.swing.JButton;
 
-import org.apache.directory.server.newldap.LdapServer;
-import org.apache.directory.server.newldap.LdapSession;
+import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.ldap.LdapSession;
 import org.apache.directory.shared.ldap.message.AbandonableRequest;
 import javax.swing.JTextArea;
 import javax.swing.event.ListSelectionEvent;

Modified: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsModel.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsModel.java?rev=687105&r1=687026&r2=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsModel.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsModel.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap.gui;
+package org.apache.directory.server.ldap.gui;
 
 
 import javax.swing.event.TableModelListener;

Modified: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java?rev=687105&r1=687026&r2=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap.gui;
+package org.apache.directory.server.ldap.gui;
 
 
 import java.awt.BorderLayout;
@@ -45,9 +45,9 @@
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
 
-import org.apache.directory.server.newldap.LdapServer;
-import org.apache.directory.server.newldap.LdapSession;
-import org.apache.directory.server.newldap.handlers.extended.GracefulShutdownHandler;
+import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.server.ldap.handlers.extended.GracefulShutdownHandler;
 import org.apache.directory.shared.ldap.message.extended.GracefulDisconnect;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 import org.apache.mina.common.CloseFuture;

Modified: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsModel.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsModel.java?rev=687105&r1=687026&r2=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsModel.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsModel.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap.gui;
+package org.apache.directory.server.ldap.gui;
 
 
 import java.net.InetSocketAddress;
@@ -25,7 +25,7 @@
 import javax.swing.event.TableModelListener;
 import javax.swing.table.TableModel;
 
-import org.apache.directory.server.newldap.LdapSession;
+import org.apache.directory.server.ldap.LdapSession;
 
 
 public class SessionsModel implements TableModel

Modified: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java?rev=687105&r1=687026&r2=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap.gui;
+package org.apache.directory.server.ldap.gui;
 
 
 import java.awt.BorderLayout;

Modified: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java?rev=687105&r1=687026&r2=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java Tue Aug 19 10:40:48 2008
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap.gui;
+package org.apache.directory.server.ldap.gui;
 
 
 import java.awt.BorderLayout;

Modified: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/package-info.java?rev=687105&r1=687026&r2=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/package-info.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/gui/package-info.java Tue Aug 19 10:40:48 2008
@@ -24,4 +24,4 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-package org.apache.directory.server.newldap.gui;
+package org.apache.directory.server.ldap.gui;

Added: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AbandonHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AbandonHandler.java?rev=687105&view=auto
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AbandonHandler.java (added)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AbandonHandler.java Tue Aug 19 10:40:48 2008
@@ -0,0 +1,50 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.server.ldap.handlers;
+
+
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.message.AbandonRequest;
+
+
+/**
+ * AbandonRequest handler implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AbandonHandler extends LdapRequestHandler<AbandonRequest>
+{
+    /**
+     * @see org.apache.directory.server.ldap.handlers.LdapRequestHandler#
+     * handle(org.apache.directory.server.ldap.LdapSession, org.apache.directory.shared.ldap.message.Request)
+     */
+    public void handle( LdapSession session, AbandonRequest request ) throws Exception
+    {
+        int abandonedId = request.getAbandoned();
+
+        if ( abandonedId < 0 )
+        {
+            return;
+        }
+
+        session.abandonOutstandingRequest( request.getMessageId() );
+    }
+}

Added: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AddHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AddHandler.java?rev=687105&view=auto
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AddHandler.java (added)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/AddHandler.java Tue Aug 19 10:40:48 2008
@@ -0,0 +1,72 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.server.ldap.handlers;
+
+
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.message.AddRequest;
+import org.apache.directory.shared.ldap.message.LdapResult;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * An LDAP add operation {@link AddRequest} handler.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AddHandler extends ReferralAwareRequestHandler<AddRequest>
+{
+	/** The logger for this class */
+    private static final Logger LOG = LoggerFactory.getLogger( AddHandler.class );
+    
+    
+    /**
+     * @see ReferralAwareRequestHandler#handleIgnoringReferrals(LdapSession, LdapDN, ClonedServerEntry, 
+     * org.apache.directory.shared.ldap.message.SingleReplyRequest)
+     */
+    public void handleIgnoringReferrals( LdapSession session, LdapDN reqTargetDn, 
+        ClonedServerEntry entry, AddRequest req ) 
+    {
+        LOG.debug( "Handling add request while ignoring referrals: {}", req );
+        LdapResult result = req.getResultResponse().getLdapResult();
+
+        try
+        {
+        	// Call the underlying layer to inject the new entry 
+            session.getCoreSession().add( req );
+
+            // If success, here now, otherwise, we would have an exception.
+            result.setResultCode( ResultCodeEnum.SUCCESS );
+            
+            // Write the AddResponse message
+            session.getIoSession().write( req.getResultResponse() );
+        }
+        catch ( Exception e )
+        {
+            handleException( session, req, e );
+        }
+    }
+}

Added: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=687105&view=auto
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java (added)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java Tue Aug 19 10:40:48 2008
@@ -0,0 +1,708 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.ldap.handlers;
+
+
+import java.util.Map;
+
+import javax.naming.Name;
+import javax.naming.NameNotFoundException;
+import javax.security.auth.Subject;
+import javax.security.auth.kerberos.KerberosKey;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.sasl.SaslException;
+import javax.security.sasl.SaslServer;
+
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.interceptor.context.BindOperationContext;
+import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
+import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
+import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
+import org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal;
+import org.apache.directory.server.ldap.LdapProtocolUtils;
+import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.server.ldap.handlers.bind.MechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.SaslConstants;
+import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.BindRequest;
+import org.apache.directory.shared.ldap.message.BindResponse;
+import org.apache.directory.shared.ldap.message.LdapResult;
+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.directory.shared.ldap.util.StringTools;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A single reply handler for {@link BindRequest}s.
+ *
+ * Implements server-side of RFC 2222, sections 4.2 and 4.3.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664302 $, $Date: 2008-06-07 04:44:00 -0400 (Sat, 07 Jun 2008) $
+ */
+public class BindHandler extends LdapRequestHandler<BindRequest>
+{
+    private static final Logger LOG = LoggerFactory.getLogger( BindHandler.class );
+
+    /** A Hashed Adapter mapping SASL mechanisms to their handlers. */
+    private Map<String, MechanismHandler> handlers;
+
+    /**
+     * Set the mechanisms handler map.
+     * 
+     * @param handlers The associations btween a machanism and its handler
+     */
+    public void setSaslMechanismHandlers( Map<String, MechanismHandler> handlers )
+    {
+        this.handlers = handlers;
+    }
+    
+
+    /**
+     * Handle the Simple authentication.
+     *
+     * @param session The associated Session
+     * @param message The BindRequest received
+     * @throws Exception If the authentication cannot be done
+     */
+    public void handleSimpleAuth( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
+    {
+        // if the user is already bound, we have to unbind him
+        if ( !ldapSession.isAnonymous() )
+        {
+            // We already have a bound session for this user. We have to
+            // abandon it first.
+            ldapSession.getCoreSession().unbind();
+            
+            // Reset the status to Anonymous
+            ldapSession.setAnonymous();
+        }
+
+        // Now, bind the user
+        
+        // create a new Bind context, with a null session, as we don't have 
+        // any context yet.
+        BindOperationContext opContext = new BindOperationContext( null );
+        
+        // Stores the DN of the user to check, and its password
+        opContext.setDn( bindRequest.getName() );
+        opContext.setCredentials( bindRequest.getCredentials() );
+
+        // Stores the request controls into the operation context
+        LdapProtocolUtils.setRequestControls( opContext, bindRequest );
+        
+        try
+        {
+            /*
+             * Referral handling as specified by RFC 3296 here:
+             *    
+             *      http://www.faqs.org/rfcs/rfc3296.html
+             *      
+             * See section 5.6.1 where if the bind principal DN is a referral 
+             * we return an invalidCredentials result response.  Optionally we
+             * could support delegated authentication in the future with this
+             * potential.  See the following JIRA for more on this possibility:
+             * 
+             *      https://issues.apache.org/jira/browse/DIRSERVER-1217
+             *      
+             * NOTE: if this is done then this handler should extend the 
+             * a modified form of the ReferralAwareRequestHandler so it can 
+             * detect conditions where ancestors of the DN are referrals
+             * and delegate appropriately.
+             */
+            ClonedServerEntry principalEntry = null;
+            
+            try
+            {
+                principalEntry = getLdapServer().getDirectoryService()
+                    .getAdminSession().lookup( bindRequest.getName() );
+            }
+            catch ( NameNotFoundException e ) 
+            {
+                // this is OK
+            }
+
+            if ( principalEntry == null || 
+                 principalEntry.getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT, 
+                     SchemaConstants.REFERRAL_OC ) )
+            {
+                LdapResult result = bindRequest.getResultResponse().getLdapResult();
+                result.setErrorMessage( "Bind principalDn points to referral." );
+                result.setResultCode( ResultCodeEnum.INVALID_CREDENTIALS );
+                ldapSession.getIoSession().write( bindRequest.getResultResponse() );
+                return;
+            }
+
+            // TODO - might cause issues since lookups are not returning all 
+            // attributes right now - this is an optimization that can be 
+            // enabled later after determining whether or not this will cause
+            // issues.
+            // reuse the looked up entry so we don't incur another lookup
+            // opContext.setEntry( principalEntry );
+
+            // And call the OperationManager bind operation.
+	        getLdapServer().getDirectoryService().getOperationManager().bind( opContext );
+	        
+	        // As a result, store the created session in the Core Session
+	        ldapSession.setCoreSession( opContext.getSession() );
+	        
+	        if ( ! ldapSession.getCoreSession().isAnonymous() )
+	        {
+	            ldapSession.setAuthenticated();
+	        }
+	        
+	        // Return the successful response
+	        sendBindSuccess( ldapSession, bindRequest, null );
+        }
+        catch ( Exception e )
+        {
+        	// Something went wrong. Write back an error message        	
+            ResultCodeEnum code = null;
+            LdapResult result = bindRequest.getResultResponse().getLdapResult();
+
+            if ( e instanceof LdapException )
+            {
+                code = ( ( LdapException ) e ).getResultCode();
+                result.setResultCode( code );
+            }
+            else
+            {
+                code = ResultCodeEnum.getBestEstimate( e, bindRequest.getType() );
+                result.setResultCode( code );
+            }
+
+            String msg = "Bind failed: " + e.getMessage();
+
+            if ( LOG.isDebugEnabled() )
+            {
+                msg += ":\n" + ExceptionUtils.getStackTrace( e );
+                msg += "\n\nBindRequest = \n" + bindRequest.toString();
+            }
+
+            Name name = null;
+            
+            if ( e instanceof LdapAuthenticationException )
+            {
+            	name = ((LdapAuthenticationException)e).getResolvedName();
+            }
+            
+            if ( ( name != null )
+                && ( ( code == ResultCodeEnum.NO_SUCH_OBJECT ) || ( code == ResultCodeEnum.ALIAS_PROBLEM )
+                    || ( code == ResultCodeEnum.INVALID_DN_SYNTAX ) || ( code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ) ) )
+            {
+                result.setMatchedDn( new LdapDN( name ) );
+            }
+
+            result.setErrorMessage( msg );
+            ldapSession.getIoSession().write( bindRequest.getResultResponse() );
+        }
+    }
+    
+    
+    /**
+     * Check if the mechanism exists.
+     */
+    private boolean checkMechanism( LdapSession ldapSession, String saslMechanism ) throws Exception
+    {
+        // Guard clause:  Reject unsupported SASL mechanisms.
+        if ( ! ldapServer.getSupportedMechanisms().contains( saslMechanism ) )
+        {
+            LOG.error( "Bind error : {} mechanism not supported. Please check the server.xml " + 
+                "configuration file (supportedMechanisms field)", 
+                saslMechanism );
+
+            return false;
+        }
+        else
+        {
+            return true;
+        }
+    }
+    
+    
+    /**
+     * For challenge/response exchange, generate the challenge 
+     *
+     * @param ldapSession
+     * @param ss
+     * @param bindRequest
+     */
+    private void generateSaslChallenge( LdapSession ldapSession, SaslServer ss, BindRequest bindRequest )
+    {
+        LdapResult result = bindRequest.getResultResponse().getLdapResult();
+
+        // SaslServer will throw an exception if the credentials are null.
+        if ( bindRequest.getCredentials() == null )
+        {
+            bindRequest.setCredentials( StringTools.EMPTY_BYTES );
+        }
+
+        try
+        {
+            // Compute the challenge
+            byte[] tokenBytes = ss.evaluateResponse( bindRequest.getCredentials() );
+    
+            if ( ss.isComplete() )
+            {
+                // This is the end of the C/R exchange
+                if ( tokenBytes != null )
+                {
+                    /*
+                     * There may be a token to return to the client.  We set it here
+                     * so it will be returned in a SUCCESS message, after an LdapContext
+                     * has been initialized for the client.
+                     */
+                    ldapSession.putSaslProperty( SaslConstants.SASL_CREDS, tokenBytes );
+                }
+                
+                // Return the successful response
+                sendBindSuccess( ldapSession, bindRequest, tokenBytes );
+            }
+            else
+            {
+                // The SASL bind must continue, we are sending the computed challenge
+                LOG.info( "Continuation token had length " + tokenBytes.length );
+                
+                // Build the response
+                result.setResultCode( ResultCodeEnum.SASL_BIND_IN_PROGRESS );
+                BindResponse resp = ( BindResponse ) bindRequest.getResultResponse();
+
+                // Store the challenge
+                resp.setServerSaslCreds( tokenBytes );
+                
+                // Switch to AuthPending
+                ldapSession.setAuthPending();
+                
+                // And write back the response
+                ldapSession.getIoSession().write( resp );
+                LOG.debug( "Returning final authentication data to client to complete context." );
+            }
+        }
+        catch ( SaslException se )
+        {
+            LOG.error( se.getMessage() );
+            result.setResultCode( ResultCodeEnum.INVALID_CREDENTIALS );
+            result.setErrorMessage( se.getMessage() );
+            
+            // Reinitialize the state to Anonymous and clear the sasl properties
+            ldapSession.clearSaslProperties();
+            ldapSession.setAnonymous();
+            
+            // Write back the error response
+            ldapSession.getIoSession().write( bindRequest.getResultResponse() );
+        }
+    }
+    
+    
+    /**
+     * Send back an AUTH-METH-NOT-SUPPORTED error message to the client
+     */
+    private void sendAuthMethNotSupported( LdapSession ldapSession, BindRequest bindRequest )
+    {
+        // First, r-einit the state to Anonymous, and clear the
+        // saslProperty map
+        ldapSession.clearSaslProperties();
+        ldapSession.setAnonymous();
+        
+        // And send the response to the client
+        LdapResult bindResult = bindRequest.getResultResponse().getLdapResult();
+        bindResult.setResultCode( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED );
+        bindResult.setErrorMessage( bindRequest.getSaslMechanism() + " is not a supported mechanism." );
+        
+        // Write back the error
+        ldapSession.getIoSession().write( bindRequest.getResultResponse() );
+
+        return;
+    }
+    
+    
+    /**
+     * Send back an INVALID-CREDENTIAL error message to the user. If we have an exception
+     * as a third argument, then send back the associated message to the client. 
+     */
+    private void sendInvalidCredentials( LdapSession ldapSession, BindRequest bindRequest, Exception e )
+    {
+        LdapResult result = bindRequest.getResultResponse().getLdapResult();
+        
+        String message = "";
+        
+        if ( e != null )
+        {
+            message = e.getMessage();
+        }
+        
+        LOG.error( message );
+        result.setResultCode( ResultCodeEnum.INVALID_CREDENTIALS );
+        result.setErrorMessage( message );
+        
+        // Reinitialize the state to Anonymous and clear the sasl properties
+        ldapSession.clearSaslProperties();
+        ldapSession.setAnonymous();
+        
+        // Write back the error response
+        ldapSession.getIoSession().write( bindRequest.getResultResponse() );
+    }
+    
+    
+    /**
+     * Send a SUCCESS message back to the client.
+     */
+    private void sendBindSuccess( LdapSession ldapSession, BindRequest bindRequest, byte[] tokenBytes )
+    {
+        // Return the successful response
+        BindResponse response = ( BindResponse ) bindRequest.getResultResponse();
+        response.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+        response.setServerSaslCreds( tokenBytes );
+        
+        if ( ! ldapSession.getCoreSession().isAnonymous() )
+        {
+            // If we have not been asked to authenticate as Anonymous, authenticate the user
+            ldapSession.setAuthenticated();
+        }
+        else
+        {
+            // Otherwise, switch back to Anonymous
+            ldapSession.setAnonymous();
+        }
+        
+        // Clean the SaslProperties, we don't need them anymore
+        MechanismHandler handler = (MechanismHandler)ldapSession.getSaslProperty( SaslConstants.SASL_MECH_HANDLER );
+        
+        if ( handler != null )
+        {
+            handler.cleanup( ldapSession );
+        }
+
+        ldapSession.getIoSession().write( response );
+        
+        LOG.debug( "Returned SUCCESS message: {}.", response );
+    }
+
+    
+    private void handleSaslAuthPending( LdapSession ldapSession, BindRequest bindRequest, DirectoryService ds ) throws Exception
+    {
+        // First, check that we have the same mechanism
+        String saslMechanism = bindRequest.getSaslMechanism();
+        
+        // The empty mechanism is also a request for a new Bind session
+        if ( StringTools.isEmpty( saslMechanism ) || 
+            !ldapSession.getSaslProperty( SaslConstants.SASL_MECH ).equals( saslMechanism ) )
+        {
+            sendAuthMethNotSupported( ldapSession, bindRequest );
+            return;
+        }
+        
+        // We have already received a first BindRequest, and sent back some challenge.
+        // First, check if the mechanism is the same
+        MechanismHandler mechanismHandler = handlers.get( saslMechanism );
+
+        if ( mechanismHandler == null )
+        {
+            String message = "Handler unavailable for " + saslMechanism;
+            
+            // Clear the saslProperties, and move to the anonymous state
+            ldapSession.clearSaslProperties();
+            ldapSession.setAnonymous();
+            
+            LOG.error( message );
+            throw new IllegalArgumentException( message );
+        }
+
+        // Get the previously created SaslServer instance
+        SaslServer ss = mechanismHandler.handleMechanism( ldapSession, bindRequest );
+        
+        /*
+         * SaslServer will throw an exception if the credentials are null.
+         */
+        if ( bindRequest.getCredentials() == null )
+        {
+            bindRequest.setCredentials( StringTools.EMPTY_BYTES );
+        }
+        
+        byte[] tokenBytes = ss.evaluateResponse( bindRequest.getCredentials() );
+        
+        if ( ss.isComplete() )
+        {
+            if ( tokenBytes != null )
+            {
+                /*
+                 * There may be a token to return to the client.  We set it here
+                 * so it will be returned in a SUCCESS message, after an LdapContext
+                 * has been initialized for the client.
+                 */
+                ldapSession.putSaslProperty( SaslConstants.SASL_CREDS, tokenBytes );
+            }
+            
+            // Create the user's coreSession
+            try
+            {
+                LdapPrincipal ldapPrincipal = (LdapPrincipal)ldapSession.getSaslProperty( SaslConstants.SASL_AUTHENT_USER );
+                
+                CoreSession userSession = ds.getSession( ldapPrincipal.getJndiName(), ldapPrincipal.getUserPassword(), saslMechanism, null );
+                
+                ldapSession.setCoreSession( userSession );
+                
+                // Mark the user as authenticated
+                ldapSession.setAuthenticated();
+                
+                // Call the cleanup method for the selected mechanism
+                MechanismHandler handler = (MechanismHandler)ldapSession.getSaslProperty( SaslConstants.SASL_MECH_HANDLER );
+
+                handler.cleanup( ldapSession );
+
+                // And send a Success response
+                sendBindSuccess( ldapSession, bindRequest, tokenBytes );
+            }
+            catch ( Exception e )
+            {
+                
+            }
+        }
+    }
+    
+    
+    /**
+     * Handle the SASL authentication. If the mechanism is known, we are
+     * facing three cases :
+     * <ul>
+     * <li>The user does not has a session yet</li>
+     * <li>The user already has a session</li>
+     * <li>The user has started a SASL negotiation</li>
+     * </lu><br/>
+     * 
+     * In the first case, we initiate a SaslBind session, which will be used all
+     * along the negotiation.<br/>
+     * In the second case, we first have to unbind the user, and initiate a new
+     * SaslBind session.<br/>
+     * In the third case, we have sub cases :
+     * <ul>
+     * <li>The mechanism is not provided : that means the user want to reset the
+     * current negotiation. We move back to an Anonymous state</li>
+     * <li>The mechanism is provided : the user is initializing a new negotiation
+     * with another mechanism. The current SaslBind session is reinitialized</li>
+     * <li></li>
+     * </ul><br/>
+     *
+     * @param session The associated Session
+     * @param message The BindRequest received
+     * @throws Exception If the authentication cannot be done
+     */
+    public void handleSaslAuth( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
+    {
+        String saslMechanism = bindRequest.getSaslMechanism();
+        DirectoryService ds = getLdapServer().getDirectoryService();
+        
+        // Case #2 : the user does have a session. We have to unbind him
+        if ( ldapSession.isAuthenticated() )
+        {
+            // We already have a bound session for this user. We have to
+            // close the previous session first.
+            ldapSession.getCoreSession().unbind();
+            
+            // Reset the status to Anonymous
+            ldapSession.setAnonymous();
+            
+            // Clean the sasl properties
+            ldapSession.clearSaslProperties();
+            
+            // Now we can continue as if the client was Anonymous from the beginning
+        }
+
+        // case #1 : The user does not have a session.
+        if ( ldapSession.isAnonymous() )
+        {
+            if ( !StringTools.isEmpty( saslMechanism ) )
+            {
+                // fist check that the mechanism exists
+                if ( !checkMechanism( ldapSession, saslMechanism ) )
+                {
+                    // get out !
+                    sendAuthMethNotSupported( ldapSession, bindRequest );
+
+                    return;
+                }
+
+                // Store the mechanism in the ldap session
+                ldapSession.putSaslProperty( SaslConstants.SASL_MECH, saslMechanism );
+                
+
+                // Get the handler for this mechanism
+                MechanismHandler mechanismHandler = handlers.get( saslMechanism );
+                
+                // Store the mechanism handler in the salsProperties
+                ldapSession.putSaslProperty( SaslConstants.SASL_MECH_HANDLER, mechanismHandler );
+                
+                // Initialize the mechanism specific data
+                mechanismHandler.init( ldapSession );
+
+                // Get the SaslServer instance which manage the C/R exchange
+                SaslServer ss = mechanismHandler.handleMechanism( ldapSession, bindRequest );
+                
+                // We have to generate a challenge
+                generateSaslChallenge( ldapSession, ss, bindRequest );
+                
+                // And get back
+                return;
+            }
+        }
+        else if ( ldapSession.isAuthPending() )
+        {
+            try
+            {
+                handleSaslAuthPending( ldapSession, bindRequest, ds );
+            }
+            catch ( SaslException se )
+            {
+                sendInvalidCredentials( ldapSession, bindRequest, se );
+            }
+            
+            return;
+        }
+    }
+
+
+    /**
+     * Create a list of all the configured realms.
+     * 
+     * @param ldapServer the LdapServer for which we want to get the realms
+     * @return a list of realms, separated by spaces
+     */
+    private String getActiveRealms( LdapServer ldapServer )
+    {
+        StringBuilder realms = new StringBuilder();
+        boolean isFirst = true;
+
+        for ( String realm:ldapServer.getSaslRealms() )
+        {
+            if ( isFirst )
+            {
+                isFirst = false;
+            }
+            else
+            {
+                realms.append( ' ' );
+            }
+            
+            realms.append( realm );
+        }
+
+        return realms.toString();
+    }
+
+
+    private Subject getSubject( LdapServer ldapServer ) throws Exception
+    {
+        String servicePrincipalName = ldapServer.getSaslPrincipal();
+
+        KerberosPrincipal servicePrincipal = new KerberosPrincipal( servicePrincipalName );
+        GetPrincipal getPrincipal = new GetPrincipal( servicePrincipal );
+
+        PrincipalStoreEntry entry = null;
+
+        try
+        {
+            entry = findPrincipal( ldapServer, getPrincipal );
+        }
+        catch ( ServiceConfigurationException sce )
+        {
+            String message = "Service principal " + servicePrincipalName + " not found at search base DN "
+                + ldapServer.getSearchBaseDn() + ".";
+            throw new ServiceConfigurationException( message, sce );
+        }
+
+        if ( entry == null )
+        {
+            String message = "Service principal " + servicePrincipalName + " not found at search base DN "
+                + ldapServer.getSearchBaseDn() + ".";
+            throw new ServiceConfigurationException( message );
+        }
+
+        Subject subject = new Subject();
+
+        for ( EncryptionType encryptionType:entry.getKeyMap().keySet() )
+        {
+            EncryptionKey key = entry.getKeyMap().get( encryptionType );
+
+            byte[] keyBytes = key.getKeyValue();
+            int type = key.getKeyType().getOrdinal();
+            int kvno = key.getKeyVersion();
+
+            KerberosKey serviceKey = new KerberosKey( servicePrincipal, keyBytes, type, kvno );
+
+            subject.getPrivateCredentials().add( serviceKey );
+        }
+
+        return subject;
+    }
+    
+
+    private PrincipalStoreEntry findPrincipal( LdapServer ldapServer, GetPrincipal getPrincipal ) throws Exception
+    {
+        CoreSession adminSession = ldapServer.getDirectoryService().getAdminSession();
+
+        return ( PrincipalStoreEntry ) getPrincipal.execute( adminSession, null );
+    }    
+    
+
+    /**
+     * Deal with a received BindRequest
+     * 
+     * @param session The current session
+     * @param bindRequest The received BindRequest
+     * @throws Exception If the authentication cannot be handled
+     */
+    @Override
+    public void handle( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
+    {
+        LOG.debug( "Received: {}", bindRequest );
+
+        // Guard clause:  LDAP version 3
+        if ( ! bindRequest.getVersion3() )
+        {
+            LOG.error( "Bind error : Only LDAP v3 is supported." );
+            LdapResult bindResult = bindRequest.getResultResponse().getLdapResult();
+            bindResult.setResultCode( ResultCodeEnum.PROTOCOL_ERROR );
+            bindResult.setErrorMessage( "Only LDAP v3 is supported." );
+            ldapSession.getIoSession().write( bindRequest.getResultResponse() );
+            return;
+        }
+
+        // Deal with the two kinds of authentication : Simple and SASL
+        if ( bindRequest.isSimple() )
+        {
+            handleSimpleAuth( ldapSession, bindRequest );
+        }
+        else
+        {
+            handleSaslAuth( ldapSession, bindRequest );
+        }
+    }
+}

Added: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/CompareHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/CompareHandler.java?rev=687105&view=auto
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/CompareHandler.java (added)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/CompareHandler.java Tue Aug 19 10:40:48 2008
@@ -0,0 +1,76 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.ldap.handlers;
+
+
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.message.CompareRequest;
+import org.apache.directory.shared.ldap.message.LdapResult;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A single reply handler for {@link CompareRequest}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664302 $
+ */
+public class CompareHandler extends ReferralAwareRequestHandler<CompareRequest>
+{
+    private static final Logger LOG = LoggerFactory.getLogger( CompareHandler.class );
+
+    
+    /**
+     * @see ReferralAwareRequestHandler#handleIgnoringReferrals(LdapSession, LdapDN, 
+     * org.apache.directory.server.core.entry.ClonedServerEntry, 
+     * org.apache.directory.shared.ldap.message.SingleReplyRequest)
+     */
+    @Override
+    public void handleIgnoringReferrals( LdapSession session, LdapDN reqTargetDn, 
+        ClonedServerEntry entry, CompareRequest req )
+    {
+        LOG.debug( "Handling compare request while ignoring referrals: {}", req );
+        LdapResult result = req.getResultResponse().getLdapResult();
+        
+        try
+        {
+            if ( session.getCoreSession().compare( req ) )
+            {
+                result.setResultCode( ResultCodeEnum.COMPARE_TRUE );
+            }
+            else
+            {
+                result.setResultCode( ResultCodeEnum.COMPARE_FALSE );
+            }
+
+            result.setMatchedDn( reqTargetDn );
+            session.getIoSession().write( req.getResultResponse() );
+        }
+        catch ( Exception e )
+        {
+            handleException( session, req, e );
+        }
+    }
+}
\ No newline at end of file

Added: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/DeleteHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/DeleteHandler.java?rev=687105&view=auto
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/DeleteHandler.java (added)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/DeleteHandler.java Tue Aug 19 10:40:48 2008
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.ldap.handlers;
+
+
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.message.DeleteRequest;
+import org.apache.directory.shared.ldap.message.LdapResult;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A single reply handler for {@link DeleteRequest}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664302 $
+ */
+public class DeleteHandler extends ReferralAwareRequestHandler<DeleteRequest>
+{
+    private static final Logger LOG = LoggerFactory.getLogger( DeleteHandler.class );
+
+
+    public void handleIgnoringReferrals( LdapSession session, LdapDN reqTargetDn, 
+        ClonedServerEntry entry, DeleteRequest req )
+    {
+        LOG.debug( "Handling request while ignoring referrals: {}", req );
+        LdapResult result = req.getResultResponse().getLdapResult();
+
+        try
+        {
+            session.getCoreSession().delete( req );
+            result.setResultCode( ResultCodeEnum.SUCCESS );
+            session.getIoSession().write( req.getResultResponse() );
+        }
+        catch ( Exception e )
+        {
+            handleException( session, req, e );
+        }
+    }
+}
\ No newline at end of file

Added: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java?rev=687105&view=auto
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java (added)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java Tue Aug 19 10:40:48 2008
@@ -0,0 +1,71 @@
+    /*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.ldap.handlers;
+
+
+import org.apache.directory.server.ldap.ExtendedOperationHandler;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.message.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.LdapResult;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.util.ExceptionUtils;
+
+
+/**
+* A single reply handler for {@link ExtendedRequest}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664302 $
+ */
+public class ExtendedHandler extends LdapRequestHandler<ExtendedRequest>
+{
+    public void handle( LdapSession session, ExtendedRequest req ) throws Exception
+    {
+        ExtendedOperationHandler handler = getLdapServer().getExtendedOperationHandler( req.getOid() );
+
+        if ( handler == null )
+        {
+            // As long as no extended operations are implemented, send appropriate
+            // error back to the client.
+            String msg = "Unrecognized extended operation EXTENSION_OID: " + req.getOid();
+            LdapResult result = req.getResultResponse().getLdapResult();
+            result.setResultCode( ResultCodeEnum.PROTOCOL_ERROR );
+            result.setErrorMessage( msg );
+            session.getIoSession().write( req.getResultResponse() );
+            return;
+        }
+        
+        try
+        {
+            handler.handleExtendedOperation( session, req );
+        }
+        catch ( Exception e )
+        {
+            LdapResult result = req.getResultResponse().getLdapResult();
+            result.setResultCode( ResultCodeEnum.OTHER );
+            result.setErrorMessage( "Extended operation handler for the specified EXTENSION_OID (" + req.getOid()
+                + ") has failed to process your request:\n" + ExceptionUtils.getStackTrace( e ) );
+            ExtendedResponse resp = ( ExtendedResponse ) req.getResultResponse();
+            resp.setResponse( new byte[0] );
+            session.getIoSession().write( req.getResultResponse() );
+        }
+    }
+}
\ No newline at end of file

Copied: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java (from r687026, directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/LdapRequestHandler.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java?p2=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java&p1=directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/LdapRequestHandler.java&r1=687026&r2=687105&rev=687105&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/LdapRequestHandler.java (original)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java Tue Aug 19 10:40:48 2008
@@ -17,13 +17,13 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.newldap.handlers;
+package org.apache.directory.server.ldap.handlers;
 
 
 import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.newldap.LdapServer;
-import org.apache.directory.server.newldap.LdapSession;
-import org.apache.directory.server.newldap.handlers.extended.StartTlsHandler;
+import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
 import org.apache.directory.shared.ldap.message.AbandonRequest;
 import org.apache.directory.shared.ldap.message.BindRequest;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;

Added: directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java?rev=687105&view=auto
==============================================================================
--- directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java (added)
+++ directory/apacheds/trunk/protocol-newldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java Tue Aug 19 10:40:48 2008
@@ -0,0 +1,123 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.ldap.handlers;
+
+ 
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.message.LdapResult;
+import org.apache.directory.shared.ldap.message.ModifyDnRequest;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A single reply handler for {@link ModifyDnRequest}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 664302 $
+ */
+public class ModifyDnHandler extends ReferralAwareRequestHandler<ModifyDnRequest>
+{
+    private static final Logger LOG = LoggerFactory.getLogger( ModifyDnHandler.class );
+
+    
+    /**
+     * Deal with a ModifyDN request received from a client.
+     *
+     * A ModifyDN operation has more than one semantic, depending on its parameters.
+     *
+     * In any case, the first argument is the DN entry to be changed. We then
+     * have the new relative DN for this entry.
+     *
+     * Two other arguments can be provided :
+     * - deleteOldRdn : if the old RDN attributes should be removed from the
+     * new entry or not (for instance, if the old RDN was cn=acme, and the new
+     * one is sn=acme, then we may have to remove the cn: acme from the attributes
+     * list)
+     * - newSuperior : this is a move operation. The entry is removed from its
+     * current location, and created in the new one.
+     */
+    public void handleIgnoringReferrals( LdapSession session, LdapDN reqTargetDn, 
+        ClonedServerEntry entry, ModifyDnRequest req )
+    {
+        LdapResult result = req.getResultResponse().getLdapResult();
+        LOG.debug( "Handling modify dn request while ignoring referrals: {}", req );
+
+        if ( req.getName().isEmpty() )
+        {
+            // it is not allowed to modify the name of the Root DSE
+            String msg = "Modify DN is not allowed on Root DSE.";
+            result.setResultCode( ResultCodeEnum.PROTOCOL_ERROR );
+            result.setErrorMessage( msg );
+            session.getIoSession().write( req.getResultResponse() );
+            return;
+        }
+        
+        try
+        {
+            LdapDN newRdn = new LdapDN( req.getNewRdn().toString() );
+            newRdn.normalize( session.getCoreSession().getDirectoryService()
+                .getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+            
+            LdapDN oldRdn = new LdapDN( req.getName().getRdn().toString() );
+            oldRdn.normalize( session.getCoreSession().getDirectoryService()
+                .getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+            
+            boolean rdnChanged = req.getNewRdn() != null && 
+                ! newRdn.getNormName().equals( oldRdn.getNormName() );
+            
+            if ( rdnChanged )
+            {
+                if ( req.getNewSuperior() != null )
+                {
+                    session.getCoreSession().moveAndRename( req );
+                }
+                else
+                {
+                    session.getCoreSession().rename( req );
+                }
+            }
+            else if ( req.getNewSuperior() != null )
+            {
+                req.setNewRdn( null );
+                session.getCoreSession().move( req );
+            }
+            else
+            {
+                result.setErrorMessage( "Attempt to move entry onto itself." );
+                result.setResultCode( ResultCodeEnum.ENTRY_ALREADY_EXISTS );
+                result.setMatchedDn( req.getName() );
+                session.getIoSession().write( req.getResultResponse() );
+                return;
+            }
+
+            result.setResultCode( ResultCodeEnum.SUCCESS );
+            session.getIoSession().write( req.getResultResponse() );
+        }
+        catch ( Exception e )
+        {
+            handleException( session, req, e );
+        }
+    }
+}
\ No newline at end of file