directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r678621 [1/2] - in /directory: apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/ apacheds/branches/bigbang/core/src/...
Date Tue, 22 Jul 2008 02:50:11 GMT
Author: akarasulu
Date: Mon Jul 21 19:50:10 2008
New Revision: 678621

URL: http://svn.apache.org/viewvc?rev=678621&view=rev
Log:
getting everything including the new ldap protocol module to compile

Added:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java
Removed:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/ScopeEnum.java
Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/NotificationCriteria.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java
    directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java
    directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/PersistentSearchListener.java
    directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/GracefulShutdownHandler.java
    directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/LaunchDiagnosticUiHandler.java
    directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
    directory/apacheds/branches/bigbang/protocol-newldap/src/test/java/org/apache/directory/server/newldap/SettingAlternativeHandlersTest.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlCodec.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
    directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java
    directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestSubstringTest.java
    directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java Mon Jul 21 19:50:10 2008
@@ -71,7 +71,7 @@
      * @return the new revision reached after having applied the forward LDIF
      * @throws Exception if there are problems logging the change
      */
-    long log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception;
+    ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception;
 
 
     /**

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Mon Jul 21 19:50:10 2008
@@ -110,7 +110,7 @@
         }
         
         LdifEntry reverse = LdifUtils.reverseAdd( opContext.getDn() );
-        changeLog.log( getPrincipal(), forward, reverse );
+        opContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
     }
 
 
@@ -140,7 +140,7 @@
         forward.setChangeType( ChangeType.Delete );
         forward.setDn( opContext.getDn().getUpName() );
         LdifEntry reverse = LdifUtils.reverseDel( opContext.getDn(), ServerEntryUtils.toAttributesImpl( serverEntry ) );
-        changeLog.log( getPrincipal(), forward, reverse );
+        opContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
     }
 
 
@@ -209,7 +209,7 @@
             ServerEntryUtils.toModificationItemImpl( opContext.getModItems() ), 
             ServerEntryUtils.toAttributesImpl( serverEntry ) );
         
-        changeLog.log( getPrincipal(), forward, reverse );
+        opContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
     }
 
 
@@ -243,7 +243,7 @@
         LdifEntry reverse = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl( serverEntry ), 
             null, renameContext.getDn(), new Rdn( renameContext.getNewRdn() ) );
         
-        changeLog.log( getPrincipal(), forward, reverse );
+        renameContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
     }
 
 
@@ -274,7 +274,7 @@
 
         LdifEntry reverse = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl( serverEntry ), 
             opCtx.getParent(), opCtx.getDn(), new Rdn( opCtx.getNewRdn() ) );
-        changeLog.log( getPrincipal(), forward, reverse );
+        opCtx.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
     }
 
 
@@ -293,6 +293,6 @@
         forward.setNewSuperior( opCtx.getParent().getUpName() );
 
         LdifEntry reverse = LdifUtils.reverseModifyDn( opCtx.getParent(), opCtx.getDn() );
-        changeLog.log( getPrincipal(), forward, reverse );
+        opCtx.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
     }
 }
\ No newline at end of file

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java Mon Jul 21 19:50:10 2008
@@ -63,7 +63,7 @@
      * @return the new revision reached after having applied the forward LDIF
      * @throws Exception if there are problems logging the change
      */
-    long log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception;
+    ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception;
 
     
     /**

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java Mon Jul 21 19:50:10 2008
@@ -57,7 +57,7 @@
     }
 
 
-    public long log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception
+    public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception
     {
         if ( ! enabled )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java Mon Jul 21 19:50:10 2008
@@ -415,13 +415,13 @@
     }
 
 
-    public long log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception
+    public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception
     {
         currentRevision++;
         ChangeLogEvent event = new ChangeLogEvent( currentRevision, DateUtils.getGeneralizedTime(), 
                 principal, forward, reverse );
         events.add( event );
-        return currentRevision;
+        return event;
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/NotificationCriteria.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/NotificationCriteria.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/NotificationCriteria.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/NotificationCriteria.java Mon Jul 21 19:50:10 2008
@@ -26,6 +26,7 @@
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.SearchRequest;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -50,6 +51,20 @@
     private int eventMask = EventType.ALL_EVENT_TYPES_MASK;
     
     
+    public NotificationCriteria()
+    {
+    }
+    
+    
+    public NotificationCriteria( SearchRequest req )
+    {
+        this.scope = req.getScope();
+        this.aliasDerefMode = req.getDerefAliases();
+        this.base = req.getBase();
+        this.filter = req.getFilter();
+    }
+    
+    
     /**
      * @param scope the scope to set
      */

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java Mon Jul 21 19:50:10 2008
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.changelog.ChangeLogEvent;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
@@ -36,7 +37,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class AddOperationContext extends AbstractOperationContext
+public class AddOperationContext extends AbstractChangeOperationContext
 {
     /**
      * Creates a new instance of AddOperationContext.

Added: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java?rev=678621&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java (added)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java Mon Jul 21 19:50:10 2008
@@ -0,0 +1,42 @@
+/*
+ *  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.core.interceptor.context;
+
+
+import org.apache.directory.server.core.changelog.ChangeLogEvent;
+
+
+/**
+ * Operations (write based) causing changes extend this interface. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ChangeOperationContext extends OperationContext
+{
+    /**
+     * Gets the ChangeLogEvent associated with this operation after the 
+     * operation has been executed.  Returns null if the ChangeLogService has 
+     * not been enabled. 
+     *
+     * @return the ChangeLogEvent associated with this operation, or null
+     */
+    ChangeLogEvent getChangeLogEvent();
+}

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java Mon Jul 21 19:50:10 2008
@@ -34,7 +34,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DeleteOperationContext extends AbstractOperationContext
+public class DeleteOperationContext extends AbstractChangeOperationContext
 {
     /**
      * An optimization added to prevent redundant lookups of the deleted 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Mon Jul 21 19:50:10 2008
@@ -48,7 +48,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ModifyOperationContext extends AbstractOperationContext
+public class ModifyOperationContext extends AbstractChangeOperationContext
 {
     /** The modification items */
     private List<Modification> modItems;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java Mon Jul 21 19:50:10 2008
@@ -33,7 +33,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class MoveOperationContext extends AbstractOperationContext
+public class MoveOperationContext extends AbstractChangeOperationContext
 {
     /** The parent DN */
     private LdapDN parent;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java Mon Jul 21 19:50:10 2008
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ModifyDnRequest;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -36,7 +37,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class RenameOperationContext extends AbstractOperationContext
+public class RenameOperationContext extends AbstractChangeOperationContext
 {
     /** The new DN */
     private Rdn newRdn;
@@ -44,6 +45,9 @@
     /** The flag to remove the old DN Attribute  */
     private boolean delOldDn;
 
+    /** The entry after being renamed and altered for rdn attributes */ 
+    private ClonedServerEntry alteredEntry;
+    
 
     /**
      * Creates a new instance of RenameOperationContext.
@@ -129,6 +133,18 @@
     {
         return MessageTypeEnum.MOD_DN_REQUEST.name();
     }
+    
+    
+    /**
+     * Returns the entry after it has been renamed and potentially changed for 
+     * Rdn alterations.
+     *
+     * @return the new renamed entry
+     */
+    public ClonedServerEntry getAlteredEntry()
+    {
+        return alteredEntry;
+    }
 
     
     /**

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java Mon Jul 21 19:50:10 2008
@@ -70,21 +70,7 @@
         this.aliasDerefMode = searchRequest.getDerefAliases();
         
         this.requestControls = searchRequest.getControls();
-        
-        // TODO - fix this and use one Scope enumerated type
-        switch( searchRequest.getScope() )
-        {
-            case BASE_OBJECT:
-                this.scope = SearchScope.OBJECT;
-                break;
-            case SINGLE_LEVEL:
-                this.scope = SearchScope.ONELEVEL;
-                break;
-            case WHOLE_SUBTREE:
-                this.scope = SearchScope.SUBTREE;
-                break;
-        }
-        
+        this.scope = searchRequest.getScope();
         this.sizeLimit = searchRequest.getSizeLimit();
         this.timeLimit = searchRequest.getTimeLimit();
         this.noAttributes = searchRequest.getTypesOnly();

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java Mon Jul 21 19:50:10 2008
@@ -36,7 +36,7 @@
 import org.apache.directory.shared.ldap.message.Response;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.ResultResponse;
-import org.apache.directory.shared.ldap.message.ScopeEnum;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.SearchRequest;
 import org.apache.directory.shared.ldap.message.SearchResponseDone;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -113,7 +113,7 @@
             controls.setTimeLimit( Math.min( req.getTimeLimit(), maxTime ) );
         }
 
-        controls.setSearchScope( req.getScope().getValue() );
+        controls.setSearchScope( req.getScope().getJndiScope() );
         controls.setReturningObjFlag( req.getTypesOnly() );
         controls.setReturningAttributes( ids );
         controls.setDerefLinkFlag( true );
@@ -138,7 +138,7 @@
     private static boolean isRootDSESearch( SearchRequest req )
     {
         boolean isBaseIsRoot = req.getBase().isEmpty();
-        boolean isBaseScope = req.getScope() == ScopeEnum.BASE_OBJECT;
+        boolean isBaseScope = req.getScope() == SearchScope.OBJECT;
         boolean isRootDSEFilter = false;
         
         if ( req.getFilter() instanceof PresenceNode )

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java Mon Jul 21 19:50:10 2008
@@ -20,19 +20,11 @@
 package org.apache.directory.server.newldap.handlers;
 
 
-import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.ReferralHandlingMode;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.event.NotificationCriteria;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
-import org.apache.directory.server.core.jndi.ServerLdapContext;
-import org.apache.directory.server.newldap.LdapServer;
 import org.apache.directory.server.newldap.LdapSession;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.codec.search.SearchResultDone;
-import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
@@ -46,8 +38,7 @@
 import org.apache.directory.shared.ldap.message.ReferralImpl;
 import org.apache.directory.shared.ldap.message.Response;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.ResultResponse;
-import org.apache.directory.shared.ldap.message.ScopeEnum;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.SearchRequest;
 import org.apache.directory.shared.ldap.message.SearchResponseDone;
 import org.apache.directory.shared.ldap.message.SearchResponseEntry;
@@ -55,26 +46,12 @@
 import org.apache.directory.shared.ldap.message.SearchResponseReference;
 import org.apache.directory.shared.ldap.message.SearchResponseReferenceImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.util.ArrayUtils;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
-import org.apache.mina.common.IoSession;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.ReferralException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.ldap.LdapContext;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
 
 
 /**
@@ -112,7 +89,12 @@
 
         // now we process entries for ever as they change
         PersistentSearchListener handler = new PersistentSearchListener( session, req );
-        getLdapServer().getDirectoryService().addNamingListener( req.getBase(), req.getFilter().toString(), handler );
+        
+        // TODO what about notification criteria ?????????????????? TODO add it 
+        NotificationCriteria criteria = new NotificationCriteria();
+        criteria.setAliasDerefMode( req.getDerefAliases() );
+        criteria.setBase( req.getBase() );
+        getLdapServer().getDirectoryService().getEventService().addListener( handler );
         return;
     }
     
@@ -362,7 +344,7 @@
     private static boolean isRootDSESearch( SearchRequest req )
     {
         boolean isBaseIsRoot = req.getBase().isEmpty();
-        boolean isBaseScope = req.getScope() == ScopeEnum.BASE_OBJECT;
+        boolean isBaseScope = req.getScope() == SearchScope.OBJECT;
         boolean isRootDSEFilter = false;
         
         if ( req.getFilter() instanceof PresenceNode )

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/PersistentSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/PersistentSearchListener.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/PersistentSearchListener.java (original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/PersistentSearchListener.java Mon Jul 21 19:50:10 2008
@@ -20,42 +20,36 @@
 package org.apache.directory.server.newldap.handlers;
 
 
-import javax.naming.InvalidNameException;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.event.NamespaceChangeListener;
-import javax.naming.event.NamingEvent;
-import javax.naming.event.NamingExceptionEvent;
-import javax.naming.event.ObjectChangeListener;
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
-import org.apache.directory.server.core.jndi.ServerLdapContext;
+import org.apache.directory.server.core.event.DirectoryListener;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.ChangeOperationContext;
+import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.newldap.LdapSession;
 import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
-import org.apache.directory.shared.ldap.exception.LdapException;
-import org.apache.directory.shared.ldap.exception.OperationAbandonedException;
 import org.apache.directory.shared.ldap.message.AbandonListener;
 import org.apache.directory.shared.ldap.message.AbandonableRequest;
 import org.apache.directory.shared.ldap.message.EntryChangeControl;
-import org.apache.directory.shared.ldap.message.LdapResult;
 import org.apache.directory.shared.ldap.message.PersistentSearchControl;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.SearchRequest;
 import org.apache.directory.shared.ldap.message.SearchResponseEntry;
 import org.apache.directory.shared.ldap.message.SearchResponseEntryImpl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.ExceptionUtils;
-import org.apache.mina.common.IoSession;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
 /**
- * A JNDI NamingListener implementation which sends back added, deleted, modified or 
+ * A DirectoryListener implementation which sends back added, deleted, modified or 
  * renamed entries to a client that created this listener.  This class is part of the
  * persistent search implementation which uses the event notification scheme built into
- * the server core.  This is exposed by the server side ApacheDS JNDI LDAP provider.
+ * the server core.  
  * 
  * This listener is disabled only when a session closes or when an abandon request 
  * cancels it.  Hence time and size limits in normal search operations do not apply
@@ -64,25 +58,19 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-class PersistentSearchListener implements ObjectChangeListener, NamespaceChangeListener, AbandonListener
+public class PersistentSearchListener implements DirectoryListener, AbandonListener
 {
     private static final Logger LOG = LoggerFactory.getLogger( PersistentSearchListener.class );
-    final ServerLdapContext ctx;
-    final IoSession session;
+    final LdapSession session;
     final SearchRequest req;
     final PersistentSearchControl control;
 
 
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-
-    PersistentSearchListener( ServerLdapContext ctx, IoSession session, SearchRequest req )
+    PersistentSearchListener( LdapSession session, SearchRequest req )
     {
         this.session = session;
         this.req = req;
         req.addAbandonListener( this );
-        this.ctx = ctx;
         this.control = ( PersistentSearchControl ) req.getControls().get( PersistentSearchControl.CONTROL_OID );
     }
 
@@ -90,7 +78,7 @@
     public void abandon() throws NamingException
     {
         // must abandon the operation 
-        ctx.removeNamingListener( this );
+        session.getCoreSession().getDirectoryService().getEventService().removeListener( this );
 
         /*
          * From RFC 2251 Section 4.11:
@@ -106,263 +94,109 @@
          */
     }
 
-
-    public void namingExceptionThrown( NamingExceptionEvent evt )
+    
+    public void requestAbandoned( AbandonableRequest req )
     {
-        // must abandon the operation and send response done with an
-        // error message if this occurs because something is wrong
-
         try
         {
-            ctx.removeNamingListener( this );
+            abandon();
         }
         catch ( NamingException e )
         {
-            LOG.error( "Attempt to remove listener from context failed", e );
-        }
-
-        /*
-         * From RFC 2251 Section 4.11:
-         * 
-         * In the event that a server receives an Abandon Request on a Search  
-         * operation in the midst of transmitting responses to the Search, that
-         * server MUST cease transmitting entry responses to the abandoned
-         * request immediately, and MUST NOT send the SearchResultDone. Of
-         * course, the server MUST ensure that only properly encoded LDAPMessage
-         * PDUs are transmitted. 
-         * 
-         * SO DON'T SEND BACK ANYTHING!!!!!
-         */
-        if ( evt.getException() instanceof OperationAbandonedException )
-        {
-            return;
-        }
-
-        String msg = "failed on persistent search operation";
-
-        if ( IS_DEBUG )
-        {
-            msg += ":\n" + req + ":\n" + ExceptionUtils.getStackTrace( evt.getException() );
-        }
-
-        ResultCodeEnum code;
-        
-        if ( evt.getException() instanceof LdapException )
-        {
-            code = ( ( LdapException ) evt.getException() ).getResultCode();
-        }
-        else
-        {
-            code = ResultCodeEnum.getBestEstimate( evt.getException(), req.getType() );
-        }
-
-        LdapResult result = req.getResultResponse().getLdapResult();
-        result.setResultCode( code );
-        result.setErrorMessage( msg );
-        
-        if ( ( evt.getException().getResolvedName() != null )
-            && ( ( code == ResultCodeEnum.NO_SUCH_OBJECT ) || ( code == ResultCodeEnum.ALIAS_PROBLEM )
-                || ( code == ResultCodeEnum.INVALID_DN_SYNTAX ) || ( code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ) ) )
-        {
-            result.setMatchedDn( (LdapDN)evt.getException().getResolvedName() );
+            LOG.error( "failed to properly abandon this persistent search", e );
         }
-        
-        session.write( req.getResultResponse() );
     }
-
-
-    public void objectChanged( NamingEvent evt )
+    
+    
+    private void setECResponseControl( SearchResponseEntry response, ChangeOperationContext opContext, ChangeType type )
     {
-        // send the entry back
-        sendEntry( evt );
+        if ( control.isReturnECs() )
+        {
+            EntryChangeControl ecControl = new EntryChangeControl();
+            ecControl.setChangeType( type );
+            
+            if ( opContext.getChangeLogEvent() != null )
+            {
+                ecControl.setChangeNumber( opContext.getChangeLogEvent().getRevision() );
+            }
+            
+            response.add( ecControl );
+        }
     }
 
 
-    public void objectAdded( NamingEvent evt )
+    public void entryAdded( AddOperationContext opContext )
     {
-        // send the entry back
-        sendEntry( evt );
+        if ( ! control.isNotificationEnabled( ChangeType.ADD ) )
+        {
+            return;
+        }
+    
+        SearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId() );
+        respEntry.setObjectName( opContext.getDn() );
+        respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( opContext.getEntry() ) );
+        setECResponseControl( respEntry, opContext, ChangeType.ADD );
     }
 
 
-    public void objectRemoved( NamingEvent evt )
+    public void entryDeleted( DeleteOperationContext opContext )
     {
-        // send the entry back
-        sendEntry( evt );
+        if ( ! control.isNotificationEnabled( ChangeType.DELETE ) )
+        {
+            return;
+        }
+    
+        SearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId() );
+        respEntry.setObjectName( opContext.getDn() );
+        respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( opContext.getEntry() ) );
+        setECResponseControl( respEntry, opContext, ChangeType.DELETE );
     }
 
 
-    public void objectRenamed( NamingEvent evt )
+    public void entryModified( ModifyOperationContext opContext )
     {
-        // send the entry back
-        sendEntry( evt );
+        if ( ! control.isNotificationEnabled( ChangeType.MODIFY ) )
+        {
+            return;
+        }
+    
+        SearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId() );
+        respEntry.setObjectName( opContext.getDn() );
+        respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( opContext.getEntry() ) );
+        setECResponseControl( respEntry, opContext, ChangeType.MODIFY );
     }
 
 
-    private void sendEntry( NamingEvent evt )
+    public void entryMoved( MoveOperationContext opContext )
     {
-        /*
-         * @todo eventually you'll want to add the changeNumber once we move 
-         * the CSN functionality into the server.
-         */
-        SearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId() );
-        EntryChangeControl ecControl = null;
-
-        if ( control.isReturnECs() )
-        {
-            ecControl = new EntryChangeControl();
-            respEntry.add( ecControl );
-        }
-        
-        LdapDN newBinding = null;
-        LdapDN oldBinding = null;
-        
-        if ( evt.getNewBinding() != null )
-        {
-            try
-            {
-                newBinding = new LdapDN( evt.getNewBinding().getName() );
-            }
-            catch ( InvalidNameException ine )
-            {
-                newBinding = LdapDN.EMPTY_LDAPDN;
-            }
-        }
-
-        if ( evt.getOldBinding() != null )
+        if ( ! control.isNotificationEnabled( ChangeType.MODDN ) )
         {
-            try
-            {
-                oldBinding = new LdapDN( evt.getOldBinding().getName() );
-            }
-            catch ( InvalidNameException ine )
-            {
-                oldBinding = LdapDN.EMPTY_LDAPDN;
-            }
+            return;
         }
+    
+        SearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId() );
+        respEntry.setObjectName( opContext.getDn() );
+        respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( opContext.getEntry() ) );
+        setECResponseControl( respEntry, opContext, ChangeType.MODDN );
+    }
 
-        Object attr;
-        
-        switch ( evt.getType() )
-        {
-            case ( NamingEvent.OBJECT_ADDED  ):
-                if ( !control.isNotificationEnabled( ChangeType.ADD ) )
-                {
-                    return;
-                }
-            
-                respEntry.setObjectName( newBinding );
-                attr = evt.getChangeInfo();
-                
-                if ( attr instanceof ServerEntry )
-                {
-                    respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) );
-                }
-                else
-                {
-                    respEntry.setAttributes( ( Attributes ) attr );
-                }
-                
-                if ( ecControl != null )
-                {
-                    ecControl.setChangeType( ChangeType.ADD );
-                }
-                
-                break;
-                
-            case ( NamingEvent.OBJECT_CHANGED  ):
-                if ( !control.isNotificationEnabled( ChangeType.MODIFY ) )
-                {
-                    return;
-                }
-            
-                respEntry.setObjectName( oldBinding );
-                attr = evt.getOldBinding().getObject();
-                
-                if ( attr instanceof ServerEntry )
-                {
-                    respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) );
-                }
-                else
-                {
-                    respEntry.setAttributes( ( Attributes ) attr );
-                }
-
-                if ( ecControl != null )
-                {
-                    ecControl.setChangeType( ChangeType.MODIFY );
-                }
-                
-                break;
-                
-            case ( NamingEvent.OBJECT_REMOVED  ):
-                if ( !control.isNotificationEnabled( ChangeType.DELETE ) )
-                {
-                    return;
-                }
-            
-                respEntry.setObjectName( oldBinding );
-                attr = evt.getOldBinding().getObject();
-                
-                if ( attr instanceof ServerEntry )
-                {
-                    respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) );
-                }
-                else
-                {
-                    respEntry.setAttributes( ( Attributes ) attr );
-                }
-
-                if ( ecControl != null )
-                {
-                    ecControl.setChangeType( ChangeType.DELETE );
-                }
-                
-                break;
-                
-            case ( NamingEvent.OBJECT_RENAMED  ):
-                if ( !control.isNotificationEnabled( ChangeType.MODDN ) )
-                {
-                    return;
-                }
-            
-                respEntry.setObjectName( newBinding );
-                attr = evt.getNewBinding().getObject();
-                
-                if ( attr instanceof ServerEntry )
-                {
-                    respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) );
-                }
-                else
-                {
-                    respEntry.setAttributes( ( Attributes ) attr );
-                }
-
-                if ( ecControl != null )
-                {
-                    ecControl.setChangeType( ChangeType.MODDN );
-                    ecControl.setPreviousDn( oldBinding );
-                }
-                
-                break;
 
-            default:
-                return;
-        }
-
-        session.write( respEntry );
+    public void entryMovedAndRenamed( MoveAndRenameOperationContext opContext )
+    {
+        entryRenamed( opContext );
     }
 
 
-    public void requestAbandoned( AbandonableRequest req )
+    public void entryRenamed( RenameOperationContext opContext )
     {
-        try
+        if ( ! control.isNotificationEnabled( ChangeType.MODDN ) )
         {
-            abandon();
-        }
-        catch ( NamingException e )
-        {
-            LOG.error( "failed to properly abandon this persistent search", e );
+            return;
         }
+    
+        SearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId() );
+        respEntry.setObjectName( opContext.getAlteredEntry().getDn() );
+        respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( opContext.getAlteredEntry() ) );
+        setECResponseControl( respEntry, opContext, ChangeType.MODDN );
     }
 }
\ No newline at end of file

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/GracefulShutdownHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/GracefulShutdownHandler.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/GracefulShutdownHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/GracefulShutdownHandler.java Mon Jul 21 19:50:10 2008
@@ -27,12 +27,9 @@
 import java.util.List;
 import java.util.Set;
 
-import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.newldap.ExtendedOperationHandler;
 import org.apache.directory.server.newldap.LdapServer;
-import org.apache.directory.server.newldap.SessionRegistry;
+import org.apache.directory.server.newldap.LdapSession;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.extended.GracefulDisconnect;
@@ -45,9 +42,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
-import javax.naming.ldap.LdapContext;
-
 
 /**
  * @org.apache.xbean.XBean
@@ -74,43 +68,20 @@
     }
 
 
-    public void handleExtendedOperation( IoSession requestor, SessionRegistry registry, ExtendedRequest req )
-        throws NamingException
+    public void handleExtendedOperation( LdapSession requestor, ExtendedRequest req ) throws Exception
     {
-        DirectoryService service;
-        ServerLdapContext slc;
-        LdapContext ctx = registry.getLdapContext( requestor, null, false );
-        ctx = ( LdapContext ) ctx.lookup( "" );
-
-        // setup some of the variables we need and make sure they are of the 
-        // right types otherwise send back an operations error in response
-        if ( ctx instanceof ServerLdapContext )
-        {
-            slc = ( ServerLdapContext ) ctx;
-            service = slc.getService();
-        }
-        else
-        {
-            LOG.error( "Encountered session context which was not a ServerLdapContext" );
-            GracefulShutdownResponse msg = new GracefulShutdownResponse( req.getMessageId(),
-                ResultCodeEnum.OPERATIONS_ERROR );
-            msg.getLdapResult().setErrorMessage( "The session context was not a ServerLdapContext" );
-            requestor.write( msg );
-            return;
-        }
-
         // make sue only the administrator can issue this shutdown request if 
         // not we respond to the requestor with with insufficientAccessRights(50)
-        if ( !slc.getSession().getEffectivePrincipal().getName().equalsIgnoreCase( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED ) )
+        if ( ! requestor.getCoreSession().isAnAdministrator() )
         {
             if ( LOG.isInfoEnabled() )
             {
                 LOG.info( "Rejected with insufficientAccessRights to attempt for server shutdown by "
-                    + slc.getSession().getEffectivePrincipal().getName() );
+                    + requestor.getCoreSession().getEffectivePrincipal().getName() );
             }
 
-            requestor
-                .write( new GracefulShutdownResponse( req.getMessageId(), ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
+            requestor.getIoSession().write( new GracefulShutdownResponse( 
+                req.getMessageId(), ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
             return;
         }
 
@@ -118,16 +89,16 @@
         // handle the body of this operation below here
         // -------------------------------------------------------------------
 
-        IoAcceptor acceptor = ( IoAcceptor ) requestor.getService();
+        IoAcceptor acceptor = ( IoAcceptor ) requestor.getIoSession().getService();
         List<IoSession> sessions = new ArrayList<IoSession>(
-                acceptor.getManagedSessions( requestor.getServiceAddress() ) );
+                acceptor.getManagedSessions( requestor.getIoSession().getServiceAddress() ) );
         GracefulShutdownRequest gsreq = ( GracefulShutdownRequest ) req;
 
         // build the graceful disconnect message with replicationContexts
         GracefulDisconnect notice = getGracefulDisconnect( gsreq.getTimeOffline(), gsreq.getDelay() );
 
         // send (synch) the GracefulDisconnect to each client before unbinding
-        sendGracefulDisconnect( sessions, notice, requestor );
+        sendGracefulDisconnect( sessions, notice, requestor.getIoSession() );
 
         // wait for the specified delay before we unbind the service 
         waitForDelay( gsreq.getDelay() );
@@ -142,13 +113,13 @@
         //                       .setDisconnectClientsOnUnbind( false );
         // -------------------------------------------------------------------
         // This might not work, either.
-        acceptor.unbind( requestor.getServiceAddress() );
+        acceptor.unbind( requestor.getIoSession().getServiceAddress() );
 
         // -------------------------------------------------------------------
         // synchronously send a NoD to clients that are not aware of this resp
         // after sending the NoD the client is disconnected if still connected
         // -------------------------------------------------------------------
-        sendNoticeOfDisconnect( sessions, requestor );
+        sendNoticeOfDisconnect( sessions, requestor.getIoSession() );
 
         // -------------------------------------------------------------------
         // respond back to the client that requested the graceful shutdown w/
@@ -157,13 +128,7 @@
         // preventing new connections; after recieving this response the 
         // requestor should disconnect and stop using the connection
         // -------------------------------------------------------------------
-        sendShutdownResponse( requestor, req.getMessageId() );
-
-        if ( service.isExitVmOnShutdown() )
-        {
-            System.exit( 0 );
-        }
-
+        sendShutdownResponse( requestor.getIoSession(), req.getMessageId() );
     }
 
 
@@ -342,7 +307,7 @@
     }
 
 
-    public void setLdapProvider( LdapServer provider )
+    public void setLdapServer( LdapServer ldapServer )
     {
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/LaunchDiagnosticUiHandler.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/LaunchDiagnosticUiHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/LaunchDiagnosticUiHandler.java Mon Jul 21 19:50:10 2008
@@ -28,7 +28,6 @@
 import java.util.Iterator;
 import java.util.Set;
 
-import javax.naming.ldap.LdapContext;
 import javax.swing.JFrame;
 
 import org.apache.directory.server.constants.ServerDNConstants;
@@ -36,13 +35,13 @@
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
-import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
 import org.apache.directory.server.core.partition.impl.btree.gui.PartitionFrame;
 import org.apache.directory.server.newldap.ExtendedOperationHandler;
 import org.apache.directory.server.newldap.LdapServer;
+import org.apache.directory.server.newldap.LdapSession;
 import org.apache.directory.server.newldap.gui.SessionsFrame;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
@@ -50,7 +49,6 @@
 import org.apache.directory.shared.ldap.message.extended.LaunchDiagnosticUiRequest;
 import org.apache.directory.shared.ldap.message.extended.LaunchDiagnosticUiResponse;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.mina.common.IoSession;
 
 
 /**
@@ -69,7 +67,7 @@
         EXTENSION_OIDS = Collections.unmodifiableSet( set );
     }
 
-    private LdapServer ldapProvider;
+    private LdapServer ldapServer;
 
 
     public String getOid()
@@ -78,67 +76,56 @@
     }
 
 
-    public void handleExtendedOperation( IoSession requestor, SessionRegistry registry, ExtendedRequest req )
+    public void handleExtendedOperation( LdapSession requestor, ExtendedRequest req )
         throws Exception
     {
-        LdapContext ctx = registry.getLdapContext( requestor, null, false );
-        ctx = ( LdapContext ) ctx.lookup( "" );
-
-        if ( ctx instanceof ServerLdapContext )
+        DirectoryService service = requestor.getCoreSession().getDirectoryService();
+        
+        if ( ! requestor.getCoreSession().isAnAdministrator() )
         {
-            ServerLdapContext slc = ( ServerLdapContext ) ctx;
-            DirectoryService service = slc.getService();
-
-            if ( !slc.getSession().getEffectivePrincipal().getName()
-                    .equalsIgnoreCase( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED ) )
-            {
-                requestor.write( new LaunchDiagnosticUiResponse( req.getMessageId(),
-                    ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
-                return;
-            }
+            requestor.getIoSession().write( new LaunchDiagnosticUiResponse( req.getMessageId(),
+                ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
+            return;
+        }
 
-            requestor.write( new LaunchDiagnosticUiResponse( req.getMessageId() ) );
+        requestor.getIoSession().write( new LaunchDiagnosticUiResponse( req.getMessageId() ) );
 
-            PartitionNexus nexus = service.getPartitionNexus();
-            LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
-            adminDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
-            LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.STRONG );
-            CoreSession session = service.getSession( principal );
-            Iterator<String> list = nexus.listSuffixes( new ListSuffixOperationContext( session ) );
-            int launchedWindowCount = 0;
+        PartitionNexus nexus = service.getPartitionNexus();
+        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+        adminDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+        LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.STRONG );
+        CoreSession session = service.getSession( principal );
+        Iterator<String> list = nexus.listSuffixes( new ListSuffixOperationContext( session ) );
+        int launchedWindowCount = 0;
+            
+        while ( list.hasNext() )
+        {
+            LdapDN dn = new LdapDN( list.next() );
+            Partition partition = nexus.getPartition( dn );
             
-            while ( list.hasNext() )
+            if ( partition instanceof BTreePartition )
             {
-                LdapDN dn = new LdapDN( list.next() );
-                Partition partition = nexus.getPartition( dn );
-                
-                if ( partition instanceof BTreePartition )
-                {
-                    BTreePartition btPartition = ( BTreePartition ) partition;
-                    PartitionFrame frame = new PartitionFrame( btPartition, service.getRegistries() );
-                    Point pos = getCenteredPosition( frame );
-                    pos.y = launchedWindowCount * 20 + pos.y;
-                    double multiplier = getAspectRatio() * 20.0;
-                    pos.x = ( int ) ( launchedWindowCount * multiplier ) + pos.x;
-                    frame.setLocation( pos );
-                    frame.setVisible( true );
-                    launchedWindowCount++;
-                }
+                BTreePartition btPartition = ( BTreePartition ) partition;
+                PartitionFrame frame = new PartitionFrame( btPartition, service.getRegistries() );
+                Point pos = getCenteredPosition( frame );
+                pos.y = launchedWindowCount * 20 + pos.y;
+                double multiplier = getAspectRatio() * 20.0;
+                pos.x = ( int ) ( launchedWindowCount * multiplier ) + pos.x;
+                frame.setLocation( pos );
+                frame.setVisible( true );
+                launchedWindowCount++;
             }
-
-            SessionsFrame sessions = new SessionsFrame( ldapProvider.getRegistry() );
-            sessions.setRequestor( requestor );
-            sessions.setLdapProvider( ldapProvider.getHandler() );
-            Point pos = getCenteredPosition( sessions );
-            pos.y = launchedWindowCount * 20 + pos.y;
-            double multiplier = getAspectRatio() * 20.0;
-            pos.x = ( int ) ( launchedWindowCount * multiplier ) + pos.x;
-            sessions.setLocation( pos );
-            sessions.setVisible( true );
-            return;
         }
 
-        requestor.write( new LaunchDiagnosticUiResponse( req.getMessageId(), ResultCodeEnum.OPERATIONS_ERROR ) );
+        SessionsFrame sessions = new SessionsFrame( ldapServer );
+        sessions.setRequestor( requestor.getIoSession() );
+        sessions.setLdapProvider( ldapServer.getHandler() );
+        Point pos = getCenteredPosition( sessions );
+        pos.y = launchedWindowCount * 20 + pos.y;
+        double multiplier = getAspectRatio() * 20.0;
+        pos.x = ( int ) ( launchedWindowCount * multiplier ) + pos.x;
+        sessions.setLocation( pos );
+        sessions.setVisible( true );
     }
 
 
@@ -167,8 +154,8 @@
     }
 
 
-    public void setLdapProvider( LdapServer provider )
+    public void setLdapServer( LdapServer ldapServer )
     {
-        this.ldapProvider = provider;
+        this.ldapServer = ldapServer;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/StoredProcedureExtendedOperationHandler.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/StoredProcedureExtendedOperationHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/extended/StoredProcedureExtendedOperationHandler.java Mon Jul 21 19:50:10 2008
@@ -31,11 +31,9 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.naming.ldap.Control;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.commons.lang.SerializationUtils;
-import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.sp.StoredProcEngine;
@@ -44,7 +42,7 @@
 import org.apache.directory.server.core.sp.java.JavaStoredProcEngineConfig;
 import org.apache.directory.server.newldap.ExtendedOperationHandler;
 import org.apache.directory.server.newldap.LdapServer;
-import org.apache.directory.server.newldap.SessionRegistry;
+import org.apache.directory.server.newldap.LdapSession;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.ldap.codec.extended.operations.StoredProcedure;
@@ -55,9 +53,9 @@
 import org.apache.directory.shared.ldap.message.ExtendedResponse;
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureRequest;
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureResponse;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.sp.LdapContextParameter;
 import org.apache.directory.shared.ldap.util.StringTools;
-import org.apache.mina.common.IoSession;
 
 
 /**
@@ -71,6 +69,7 @@
     private StoredProcExecutionManager manager;
     private static final Object[] EMPTY_CLASS_ARRAY = new Object[0];
     
+    
     public StoredProcedureExtendedOperationHandler()
     {
         super();
@@ -83,30 +82,19 @@
         this.manager = new StoredProcExecutionManager( spContainer, spEngineConfigs );
     }
 
-    public void handleExtendedOperation( IoSession session, SessionRegistry registry, ExtendedRequest req ) throws Exception
+
+    public void handleExtendedOperation( LdapSession session, ExtendedRequest req ) throws Exception
     {
-        Control[] connCtls = req.getControls().values().toArray( new Control[ req.getControls().size() ] );
-        LdapContext ldapContext = registry.getLdapContext( session, connCtls, false);
-        ServerLdapContext ctx;
-        
-        if ( ldapContext instanceof ServerLdapContext )
-        {
-            ctx = ( ServerLdapContext ) ldapContext;
-        }
-        else
-        {
-            ctx = ( ServerLdapContext ) ldapContext.lookup( "" );
-        }
-        
         StoredProcedure spBean = decodeBean( req.getPayload() );
         
         String procedure = StringTools.utf8ToString( spBean.getProcedure() );
-        CoreSession coreSession = ctx.getSession();
-        ClonedServerEntry spUnit = manager.findStoredProcUnit( coreSession, procedure );
+        ClonedServerEntry spUnit = manager.findStoredProcUnit( session.getCoreSession(), procedure );
         StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
         
         List<Object> valueList = new ArrayList<Object>( spBean.getParameters().size() );
         Iterator<StoredProcedureParameter> it = spBean.getParameters().iterator();
+        LdapContext ctx = new ServerLdapContext( session.getCoreSession().getDirectoryService(),
+            session.getCoreSession().getEffectivePrincipal(), new LdapDN() );
         
         while ( it.hasNext() )
         {
@@ -125,11 +113,11 @@
         
         Object[] values = valueList.toArray( EMPTY_CLASS_ARRAY );
         
-        Object response = engine.invokeProcedure( coreSession, procedure, values );
+        Object response = engine.invokeProcedure( session.getCoreSession(), procedure, values );
         
         byte[] serializedResponse = SerializationUtils.serialize( ( Serializable ) response );
         ( ( ExtendedResponse )( req.getResultResponse() ) ).setResponse( serializedResponse );
-        session.write( req.getResultResponse() );
+        session.getIoSession().write( req.getResultResponse() );
         
     }
     
@@ -176,8 +164,8 @@
         return EXTENSION_OIDS;
     }
 
-    
-    public void setLdapProvider( LdapServer provider)
+
+    public void setLdapServer( LdapServer ldapServer )
     {
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/test/java/org/apache/directory/server/newldap/SettingAlternativeHandlersTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/test/java/org/apache/directory/server/newldap/SettingAlternativeHandlersTest.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/test/java/org/apache/directory/server/newldap/SettingAlternativeHandlersTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/test/java/org/apache/directory/server/newldap/SettingAlternativeHandlersTest.java Mon Jul 21 19:50:10 2008
@@ -23,15 +23,15 @@
 import junit.framework.TestCase;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.newldap.LdapServer;
-import org.apache.directory.server.newldap.handlers.AbandonHandler;
-import org.apache.directory.server.newldap.handlers.AddHandler;
-import org.apache.directory.server.newldap.handlers.BindHandler;
-import org.apache.directory.server.newldap.handlers.CompareHandler;
-import org.apache.directory.server.newldap.handlers.DeleteHandler;
-import org.apache.directory.server.newldap.handlers.ModifyDnHandler;
-import org.apache.directory.server.newldap.handlers.ModifyHandler;
-import org.apache.directory.server.newldap.handlers.SearchHandler;
-import org.apache.directory.server.newldap.handlers.UnbindHandler;
+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.NewModifyHandler;
+import org.apache.directory.server.newldap.handlers.NewSearchHandler;
+import org.apache.directory.server.newldap.handlers.NewUnbindHandler;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.AbandonRequest;
@@ -111,7 +111,7 @@
     }
 
     
-    public static class BogusAbandonHandler extends AbandonHandler
+    public static class BogusAbandonHandler extends NewAbandonHandler
     {
         public void abandonMessageReceived( IoSession session, AbandonRequest request )
         {
@@ -120,7 +120,7 @@
     }
 
     
-    public static class BogusUnbindHandler extends UnbindHandler
+    public static class BogusUnbindHandler extends NewUnbindHandler
     {
         public void unbindMessageReceived( IoSession session, UnbindRequest request )
         {
@@ -128,7 +128,7 @@
         }
     }
 
-    public static class BogusAddHandler extends AddHandler
+    public static class BogusAddHandler extends NewAddHandler
     {
         public void addMessageReceived( IoSession session, AddRequest request )
         {
@@ -136,7 +136,7 @@
         }
     }
 
-    public static class BogusBindHandler extends BindHandler
+    public static class BogusBindHandler extends NewBindHandler
     {
         public void setDirectoryService( DirectoryService directoryService )
         {
@@ -149,7 +149,7 @@
         }
     }
 
-    public static class BogusCompareHandler extends CompareHandler
+    public static class BogusCompareHandler extends NewCompareHandler
     {
         public void compareMessageReceived( IoSession session, CompareRequest request )
         {
@@ -157,7 +157,7 @@
         }
     }
 
-    public static class BogusDeleteHandler extends  DeleteHandler
+    public static class BogusDeleteHandler extends  NewDeleteHandler
     {
         public void deleteMessageReceived( IoSession session, DeleteRequest request )
         {
@@ -165,7 +165,7 @@
         }
     }
 
-    public static class BogusModifyDnHandler extends  ModifyDnHandler
+    public static class BogusModifyDnHandler extends  NewModifyDnHandler
     {
         public void modifyDnMessageReceived( IoSession session, ModifyDnRequest request )
         {
@@ -173,7 +173,7 @@
         }
     }
 
-    public static class BogusModifyHandler extends ModifyHandler
+    public static class BogusModifyHandler extends NewModifyHandler
     {
         public void modifyMessageReceived( IoSession session, ModifyRequest request )
         {
@@ -181,7 +181,7 @@
         }
     }
 
-    public static class BogusSearchHandler extends SearchHandler
+    public static class BogusSearchHandler extends NewSearchHandler
     {
         public void searchMessageReceived( IoSession session, SearchRequest request )
         {

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java Mon Jul 21 19:50:10 2008
@@ -93,6 +93,7 @@
 import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
 import org.apache.directory.shared.ldap.codec.unbind.UnBindRequest;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AddResponseImpl;
 import org.apache.directory.shared.ldap.message.BindResponseImpl;
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
@@ -100,7 +101,6 @@
 import org.apache.directory.shared.ldap.message.ModifyDnResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.ScopeEnum;
 import org.apache.directory.shared.ldap.message.SearchResponseDoneImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
@@ -3580,7 +3580,7 @@
                         throw new DecoderException( "The scope is not in [0..2] : " + value.toString() );
                     }
 
-                    searchRequest.setScope( ScopeEnum.getScope( scope ) );
+                    searchRequest.setScope( SearchScope.getSearchScope( scope ) );
 
                     if ( IS_DEBUG )
                     {

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java Mon Jul 21 19:50:10 2008
@@ -38,9 +38,9 @@
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ScopeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -60,7 +60,7 @@
     private LdapDN baseObject;
 
     /** The scope. It could be baseObject, singleLevel or wholeSubtree. */
-    private ScopeEnum scope;
+    private SearchScope scope;
 
     /**
      * The deref alias could be neverDerefAliases, derefInSearching,
@@ -223,7 +223,7 @@
      * 
      * @return Returns the scope.
      */
-    public ScopeEnum getScope()
+    public SearchScope getScope()
     {
         return scope;
     }
@@ -234,7 +234,7 @@
      * 
      * @param scope The scope to set.
      */
-    public void setScope( ScopeEnum scope )
+    public void setScope( SearchScope scope )
     {
         this.scope = scope;
     }
@@ -564,7 +564,7 @@
             Value.encode( buffer, LdapDN.getBytes( baseObject ) );
 
             // The scope
-            Value.encodeEnumerated( buffer, scope.getValue() );
+            Value.encodeEnumerated( buffer, scope.getJndiScope() );
 
             // The derefAliases
             Value.encodeEnumerated( buffer, derefAliases );
@@ -674,15 +674,15 @@
 
         switch ( scope )
         {
-            case BASE_OBJECT:
+            case OBJECT:
                 sb.append( "base object" );
                 break;
 
-            case SINGLE_LEVEL:
+            case ONELEVEL:
                 sb.append( "single level" );
                 break;
 
-            case WHOLE_SUBTREE:
+            case SUBTREE:
                 sb.append( "whole subtree" );
                 break;
         }

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlCodec.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlCodec.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlCodec.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlCodec.java Mon Jul 21 19:50:10 2008
@@ -85,7 +85,7 @@
 
     private ChangeType changeType = ChangeType.ADD;
 
-    private int changeNumber = UNDEFINED_CHANGE_NUMBER;
+    private long changeNumber = UNDEFINED_CHANGE_NUMBER;
 
     /** The previous DN */
     private LdapDN previousDn = null;
@@ -129,7 +129,9 @@
 
         if ( changeNumber != UNDEFINED_CHANGE_NUMBER )
         {
-            changeNumberLength = 1 + 1 + Value.getNbBytes( changeNumber );
+            // TODO Emmanuel can you please check how we can use long here instead
+            // TODO get rid of cast to int 
+            changeNumberLength = 1 + 1 + Value.getNbBytes( ( int ) changeNumber );
         }
 
         eccSeqLength = changeTypesLength + previousDnLength + changeNumberLength;
@@ -162,7 +164,9 @@
         }
         if ( changeNumber != UNDEFINED_CHANGE_NUMBER )
         {
-            Value.encode( bb, changeNumber );
+            // TODO Emmanuel can you please check how we can use long here instead
+            // TODO get rid of cast to int 
+            Value.encode( bb, ( int ) changeNumber );
         }
         return bb;
     }
@@ -216,13 +220,13 @@
     }
 
 
-    public int getChangeNumber()
+    public long getChangeNumber()
     {
         return changeNumber;
     }
 
 
-    public void setChangeNumber( int changeNumber )
+    public void setChangeNumber( long changeNumber )
     {
         this.changeNumber = changeNumber;
     }

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java Mon Jul 21 19:50:10 2008
@@ -82,11 +82,11 @@
 
     public static final String CONTROL_OID = "2.16.840.1.113730.3.4.7";
 
-    public static final int UNDEFINED_CHANGE_NUMBER = org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControlCodec.UNDEFINED_CHANGE_NUMBER;
+    public static final long UNDEFINED_CHANGE_NUMBER = org.apache.directory.shared.ldap.codec.search.controls.EntryChangeControlCodec.UNDEFINED_CHANGE_NUMBER;
 
     private ChangeType changeType = ChangeType.ADD;
 
-    private int changeNumber = UNDEFINED_CHANGE_NUMBER;
+    private long changeNumber = UNDEFINED_CHANGE_NUMBER;
 
     private LdapDN previousDn = null;
 
@@ -122,13 +122,13 @@
     }
 
 
-    public int getChangeNumber()
+    public long getChangeNumber()
     {
         return changeNumber;
     }
 
 
-    public void setChangeNumber( int changeNumber )
+    public void setChangeNumber( long changeNumber )
     {
         this.changeNumber = changeNumber;
     }

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java Mon Jul 21 19:50:10 2008
@@ -23,6 +23,7 @@
 import java.util.Collection;
 
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -77,7 +78,7 @@
      * 
      * @return the scope enumeration parameter.
      */
-    ScopeEnum getScope();
+    SearchScope getScope();
 
 
     /**
@@ -85,7 +86,7 @@
      * 
      * @param scope the scope enumeration parameter.
      */
-    void setScope( ScopeEnum scope );
+    void setScope( SearchScope scope );
 
 
     /**

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java Mon Jul 21 19:50:10 2008
@@ -29,6 +29,7 @@
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.filter.BranchNormalizedVisitor;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -49,7 +50,7 @@
     private ExprNode filter;
 
     /** Search scope enumeration value */
-    private ScopeEnum scope;
+    private SearchScope scope;
 
     /** Types only return flag */
     private boolean typesOnly;
@@ -206,7 +207,7 @@
      * 
      * @return the scope enumeration parameter.
      */
-    public ScopeEnum getScope()
+    public SearchScope getScope()
     {
         return scope;
     }
@@ -218,7 +219,7 @@
      * @param scope
      *            the scope enumeration parameter.
      */
-    public void setScope( ScopeEnum scope )
+    public void setScope( SearchScope scope )
     {
         this.scope = scope;
     }
@@ -471,15 +472,15 @@
         
         switch ( scope )
         {
-            case BASE_OBJECT:
+            case OBJECT:
                 sb.append( "base object" );
                 break;
 
-            case SINGLE_LEVEL:
+            case ONELEVEL:
                 sb.append( "single level" );
                 break;
 
-            case WHOLE_SUBTREE:
+            case SUBTREE:
                 sb.append( "whole subtree" );
                 break;
         }

Modified: directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java?rev=678621&r1=678620&r2=678621&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java (original)
+++ directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java Mon Jul 21 19:50:10 2008
@@ -36,7 +36,7 @@
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
 import org.apache.directory.shared.ldap.codec.search.SearchRequest;
-import org.apache.directory.shared.ldap.message.ScopeEnum;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -134,7 +134,7 @@
 
         assertEquals( 1, message.getMessageId() );
         assertEquals( "dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( ScopeEnum.BASE_OBJECT, sr.getScope() );
+        assertEquals( SearchScope.OBJECT, sr.getScope() );
         assertEquals( LdapConstants.DEREF_FINDING_BASE_OBJ, sr.getDerefAliases() );
         assertEquals( 2, sr.getSizeLimit() );
         assertEquals( 3, sr.getTimeLimit() );
@@ -366,7 +366,7 @@
 
         assertEquals( 4, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
+        assertEquals( SearchScope.ONELEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );
@@ -648,7 +648,7 @@
 
         assertEquals( 4, message.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", sr.getBaseObject().toString() );
-        assertEquals( ScopeEnum.SINGLE_LEVEL, sr.getScope() );
+        assertEquals( SearchScope.ONELEVEL, sr.getScope() );
         assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         assertEquals( 0, sr.getSizeLimit() );
         assertEquals( 0, sr.getTimeLimit() );



Mime
View raw message