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 2011/11/09 15:52:23 UTC

svn commit: r1199778 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/interceptor/ core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ core-api/src/test/java/org/apache/directory/s...

Author: elecharny
Date: Wed Nov  9 14:52:22 2011
New Revision: 1199778

URL: http://svn.apache.org/viewvc?rev=1199778&view=rev
Log:
Moved the List operation out of the InterceptorChain

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/EntryOperationContext.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java
    directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java Wed Nov  9 14:52:22 2011
@@ -142,55 +142,72 @@ public abstract class BaseInterceptor im
         }
 
 
-        public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+        /**
+         * {@inheritDoc}
+         */
+        public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
         {
-            return nexus.compare( compareContext );
+            nexus.add( addContext );
         }
 
 
         /**
          * {@inheritDoc}
          */
-        public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext ) throws LdapException
+        public void bind( BindOperationContext bindContext ) throws LdapException
         {
-            return nexus.getRootDSE( getRootDseContext );
+            nexus.bind( bindContext );
         }
 
 
         /**
          * {@inheritDoc}
          */
-        public void delete( DeleteOperationContext deleteContext ) throws LdapException
+        public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
         {
-            nexus.delete( deleteContext );
+            return nexus.compare( compareContext );
         }
 
 
-        public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+        /**
+         * {@inheritDoc}
+         */
+        public void delete( DeleteOperationContext deleteContext ) throws LdapException
         {
-            nexus.add( addContext );
+            nexus.delete( deleteContext );
         }
 
 
-        public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
+        /**
+         * {@inheritDoc}
+         */
+        public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext ) throws LdapException
         {
-            nexus.modify( modifyContext );
+            return nexus.getRootDSE( getRootDseContext );
         }
 
 
-        public EntryFilteringCursor list( NextInterceptor next, ListOperationContext listContext ) throws LdapException
+        /**
+         * {@inheritDoc}
+         */
+        public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
         {
-            return nexus.list( listContext );
+            return nexus.hasEntry( hasEntryContext );
         }
 
 
-        public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
-            throws LdapException
+        /**
+         * {@inheritDoc}
+         */
+        public EntryFilteringCursor list( NextInterceptor next, ListOperationContext listContext ) throws LdapException
         {
-            return nexus.search( searchContext );
+            return nexus.list( listContext );
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public Entry lookup( NextInterceptor next, LookupOperationContext lookupContext )
             throws LdapException
         {
@@ -198,24 +215,27 @@ public abstract class BaseInterceptor im
         }
 
 
-        public boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException
-        {
-            return nexus.hasEntry( hasEntryContext );
-        }
-
-
-        public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
+        /**
+         * {@inheritDoc}
+         */
+        public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
         {
-            nexus.rename( renameContext );
+            nexus.modify( modifyContext );
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
         {
             nexus.move( moveContext );
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
             throws LdapException
         {
@@ -223,9 +243,22 @@ public abstract class BaseInterceptor im
         }
 
 
-        public void bind( BindOperationContext bindContext ) throws LdapException
+        /**
+         * {@inheritDoc}
+         */
+        public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
         {
-            nexus.bind( bindContext );
+            nexus.rename( renameContext );
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
+            throws LdapException
+        {
+            return nexus.search( searchContext );
         }
 
 
@@ -401,12 +434,31 @@ public abstract class BaseInterceptor im
     }
 
     
-    public boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
     {
-        return next.hasEntry( hasEntryContext );
+    	// Return false in any case
+    	return false;
     }
 
 
+    /**
+     * Calls the next interceptor for the hasEntry operation.
+     * 
+     * @param hasEntryContext The context in which we are executing this operation
+     * @return a boolean indicating if the entry exists on the server
+     * @throws LdapException If something went wrong
+     */
+    protected final boolean next( EntryOperationContext hasEntryContext ) throws LdapException
+    {
+    	Interceptor interceptor = getNextInterceptor( hasEntryContext );
+
+        return interceptor.hasEntry( hasEntryContext );
+    }
+
+    
     public EntryFilteringCursor list( NextInterceptor next, ListOperationContext listContext ) throws LdapException
     {
         return next.list( listContext );

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java Wed Nov  9 14:52:22 2011
@@ -167,7 +167,7 @@ public interface Interceptor
     /**
      * Filters {@link Partition#hasEntry( EntryOperationContext )} call.
      */
-    boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException;
+    boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException;
 
 
     /**

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java Wed Nov  9 14:52:22 2011
@@ -91,18 +91,21 @@ public class InterceptorChain
         }
 
 
-        public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+        public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
         {
-            return nexus.compare( compareContext );
+            nexus.add( addContext );
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
-        public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext ) throws LdapException
+        public void bind( BindOperationContext bindContext ) throws LdapException
         {
-            return null;
+            // Do nothing
+        }
+        
+
+        public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+        {
+            return nexus.compare( compareContext );
         }
 
 
@@ -115,15 +118,18 @@ public class InterceptorChain
         }
 
 
-        public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+        /**
+         * {@inheritDoc}
+         */
+        public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext ) throws LdapException
         {
-            nexus.add( addContext );
+            return null;
         }
 
 
-        public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
+        public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
         {
-            nexus.modify( modifyContext );
+            return false;
         }
 
 
@@ -133,13 +139,6 @@ public class InterceptorChain
         }
 
 
-        public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
-            throws LdapException
-        {
-            return nexus.search( searchContext );
-        }
-
-
         public Entry lookup( NextInterceptor next, LookupOperationContext lookupContext )
             throws LdapException
         {
@@ -147,15 +146,9 @@ public class InterceptorChain
         }
 
 
-        public boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException
-        {
-            return nexus.hasEntry( hasEntryContext );
-        }
-
-
-        public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
+        public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
         {
-            nexus.rename( renameContext );
+            nexus.modify( modifyContext );
         }
 
 
@@ -172,9 +165,16 @@ public class InterceptorChain
         }
 
 
-        public void bind( BindOperationContext bindContext ) throws LdapException
+        public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
         {
-            // Do nothing
+            nexus.rename( renameContext );
+        }
+
+
+        public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
+            throws LdapException
+        {
+            return nexus.search( searchContext );
         }
 
 
@@ -721,28 +721,6 @@ public class InterceptorChain
     }
 
 
-    public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
-    {
-        Element entry = getStartingEntry();
-        Interceptor head = entry.interceptor;
-        NextInterceptor next = entry.nextInterceptor;
-
-        try
-        {
-            return head.hasEntry( next, hasEntryContext );
-        }
-        catch ( LdapException le )
-        {
-            throw le;
-        }
-        catch ( Throwable e )
-        {
-            throwInterceptorException( head, e );
-            throw new InternalError(); // Should be unreachable
-        }
-    }
-
-
     public void rename( RenameOperationContext renameContext ) throws LdapException
     {
         Element entry = getStartingEntry();
@@ -1026,31 +1004,6 @@ public class InterceptorChain
                 }
 
 
-                public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
-                {
-                    Element next = getNextEntry();
-                    Interceptor interceptor = next.interceptor;
-
-                    try
-                    {
-                        //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", hasEntryRequest" );
-                        boolean hasEntry = interceptor.hasEntry( next.nextInterceptor, hasEntryContext );
-                        //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", hasEntryRequest" );
-                        
-                        return hasEntry;
-                    }
-                    catch ( LdapException le )
-                    {
-                        throw le;
-                    }
-                    catch ( Throwable e )
-                    {
-                        throwInterceptorException( interceptor, e );
-                        throw new InternalError(); // Should be unreachable
-                    }
-                }
-
-
                 public void rename( RenameOperationContext renameContext ) throws LdapException
                 {
                     Element next = getNextEntry();

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java Wed Nov  9 14:52:22 2011
@@ -45,21 +45,15 @@ import org.apache.directory.shared.ldap.
 public interface NextInterceptor
 {
     /**
-     * Calls the next interceptor's {@link Interceptor#compare( NextInterceptor, CompareOperationContext )}.
-     */
-    boolean compare( CompareOperationContext compareContext ) throws LdapException;
-
-
-    /**
      * Calls the next interceptor's {@link Interceptor#add( NextInterceptor, AddOperationContext )}.
      */
     void add( AddOperationContext addContext ) throws LdapException;
 
-
     /**
-     * Calls the next interceptor's {@link Interceptor#modify( NextInterceptor, ModifyOperationContext )}.
+     * Calls the next interceptor's {@link Interceptor#compare( NextInterceptor, CompareOperationContext )}.
      */
-    void modify( ModifyOperationContext modifyContext ) throws LdapException;
+    boolean compare( CompareOperationContext compareContext ) throws LdapException;
+
 
     /**
      * Calls the next interceptor's {@link Interceptor#list( NextInterceptor, ListOperationContext )}.
@@ -68,37 +62,37 @@ public interface NextInterceptor
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#search( NextInterceptor, SearchOperationContext searchContext )}.
+     * Calls the next interceptor's {@link Interceptor#lookup( NextInterceptor, LookupOperationContext )}.
      */
-    EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException;
+    Entry lookup( LookupOperationContext lookupContext ) throws LdapException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#lookup( NextInterceptor, LookupOperationContext )}.
+     * Calls the next interceptor's {@link Interceptor#modify( NextInterceptor, ModifyOperationContext )}.
      */
-    Entry lookup( LookupOperationContext lookupContext ) throws LdapException;
+    void modify( ModifyOperationContext modifyContext ) throws LdapException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#hasEntry( NextInterceptor, EntryOperationContext )}.
+     * Calls the next interceptor's {@link Interceptor#move( NextInterceptor, MoveOperationContext )}.
      */
-    boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException;
+    void move( MoveOperationContext moveContext ) throws LdapException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#rename( NextInterceptor, RenameOperationContext )}.
+     * Calls the next interceptor's {@link Interceptor#moveAndRename( NextInterceptor, MoveAndRenameOperationContext )}.
      */
-    void rename( RenameOperationContext renameContext ) throws LdapException;
+    void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#move( NextInterceptor, MoveOperationContext )}.
+     * Calls the next interceptor's {@link Interceptor#rename( NextInterceptor, RenameOperationContext )}.
      */
-    void move( MoveOperationContext moveContext ) throws LdapException;
+    void rename( RenameOperationContext renameContext ) throws LdapException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#moveAndRename( NextInterceptor, MoveAndRenameOperationContext )}.
+     * Calls the next interceptor's {@link Interceptor#search( NextInterceptor, SearchOperationContext searchContext )}.
      */
-    void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException;
+    EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException;
 }

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java Wed Nov  9 14:52:22 2011
@@ -336,15 +336,9 @@ public abstract class AbstractOperationC
     }
     
     
-    public boolean hasEntry( Dn dn, Collection<String> byPassed ) throws LdapException
-    {
-        EntryOperationContext hasEntryContext = new EntryOperationContext( session, dn );
-        setup( hasEntryContext );
-        hasEntryContext.setByPassed( byPassed );
-        return session.getDirectoryService().getOperationManager().hasEntry( hasEntryContext );
-    }
-    
-    
+    /**
+     * {@inheritDoc}
+     */
     public void add( Entry entry, Collection<String> byPassed ) throws LdapException
     {
         AddOperationContext addContext = new AddOperationContext( session, entry );
@@ -354,6 +348,9 @@ public abstract class AbstractOperationC
     }
     
     
+    /**
+     * {@inheritDoc}
+     */
     public void delete( Dn dn ) throws LdapException
     {
         DeleteOperationContext deleteContext = new DeleteOperationContext( session, dn );
@@ -363,21 +360,16 @@ public abstract class AbstractOperationC
     }
     
     
-    public void modify( Dn dn, List<Modification> mods, Collection<String> byPassed ) throws LdapException
-    {
-        ModifyOperationContext modifyContext = new ModifyOperationContext( session, dn, mods );
-        setup( modifyContext );
-        modifyContext.setByPassed( byPassed );
-        session.getDirectoryService().getOperationManager().modify( modifyContext );
-    }
-    
-    
-    // TODO - need synchronization here and where we update links
-    public LookupOperationContext newLookupContext( Dn dn )
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasEntry( Dn dn, Collection<String> byPassed ) throws LdapException
     {
-        LookupOperationContext lookupContext = new LookupOperationContext( session, dn );
-        setup( lookupContext );
-        return lookupContext;
+        EntryOperationContext hasEntryContext = new EntryOperationContext( session, dn );
+        setup( hasEntryContext );
+        hasEntryContext.setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.HAS_ENTRY ) );
+        
+        return session.getDirectoryService().getOperationManager().hasEntry( hasEntryContext );
     }
 
 
@@ -408,7 +400,23 @@ public abstract class AbstractOperationC
         return session.getDirectoryService().getOperationManager().lookup( lookupContext );
     }
     
-
+    
+    public void modify( Dn dn, List<Modification> mods, Collection<String> byPassed ) throws LdapException
+    {
+        ModifyOperationContext modifyContext = new ModifyOperationContext( session, dn, mods );
+        setup( modifyContext );
+        modifyContext.setByPassed( byPassed );
+        session.getDirectoryService().getOperationManager().modify( modifyContext );
+    }
+    
+    
+    // TODO - need synchronization here and where we update links
+    public LookupOperationContext newLookupContext( Dn dn )
+    {
+        LookupOperationContext lookupContext = new LookupOperationContext( session, dn );
+        setup( lookupContext );
+        return lookupContext;
+    }
     public LdapPrincipal getEffectivePrincipal()
     {
         if ( authorizedPrincipal != null )

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/EntryOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/EntryOperationContext.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/EntryOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/EntryOperationContext.java Wed Nov  9 14:52:22 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 
 import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.OperationEnum;
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
 
@@ -39,6 +40,7 @@ public class EntryOperationContext exten
     public EntryOperationContext( CoreSession session )
     {
         super( session );
+        setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.HAS_ENTRY ) );
     }
     
     /**
@@ -49,6 +51,7 @@ public class EntryOperationContext exten
     public EntryOperationContext( CoreSession session, Dn entryDn )
     {
         super( session, entryDn );
+        setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.HAS_ENTRY ) );
     }
     
 

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java Wed Nov  9 14:52:22 2011
@@ -866,6 +866,7 @@ public class MockCoreSession implements 
     {
         EntryOperationContext hasEntryContext = new EntryOperationContext( this, dn );
         OperationManager operationManager = directoryService.getOperationManager();
+        
         return operationManager.hasEntry( hasEntryContext );
     }
 

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java Wed Nov  9 14:52:22 2011
@@ -82,14 +82,26 @@ public class MockInterceptor extends Bas
     /**
      * {@inheritDoc}
      */
-    public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext )
-        throws LdapException
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
     {
         interceptors.add( this );
-        return next( getRootDseContext );
+        next.add( addContext );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void bind( BindOperationContext bindContext ) throws LdapException
+    {
+        interceptors.add( this );
+        next( bindContext );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
     {
         interceptors.add( this );
@@ -107,20 +119,30 @@ public class MockInterceptor extends Bas
     }
 
 
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext )
+        throws LdapException
     {
         interceptors.add( this );
-        next.add( addContext );
+        return next( getRootDseContext );
     }
 
 
-    public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
     {
         interceptors.add( this );
-        next.modify( modifyContext );
+        return next( hasEntryContext );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public EntryFilteringCursor list( NextInterceptor next, ListOperationContext listContext ) throws LdapException
     {
         interceptors.add( this );
@@ -128,13 +150,9 @@ public class MockInterceptor extends Bas
     }
 
 
-    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException
-    {
-        interceptors.add( this );
-        return next.search( searchContext );
-    }
-
-
+    /**
+     * {@inheritDoc}
+     */
     public Entry lookup( NextInterceptor next, LookupOperationContext lookupContext ) throws LdapException
     {
         interceptors.add( this );
@@ -142,38 +160,53 @@ public class MockInterceptor extends Bas
     }
 
 
-    public boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
     {
         interceptors.add( this );
-        return next.hasEntry( hasEntryContext );
+        next.modify( modifyContext );
     }
 
 
-    public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
     {
         interceptors.add( this );
-        next.rename( renameContext );
+        next.move( moveContext );
     }
 
 
-    public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
     {
         interceptors.add( this );
-        next.move( moveContext );
+        next.moveAndRename( moveAndRenameContext );
     }
 
 
-    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
     {
         interceptors.add( this );
-        next.moveAndRename( moveAndRenameContext );
+        next.rename( renameContext );
     }
 
 
-    public void bind( BindOperationContext bindContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException
     {
         interceptors.add( this );
-        next( bindContext );
+        return next.search( searchContext );
     }
 
 

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/hasEntry/hasEntryPerfIT.java Wed Nov  9 14:52:22 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 import static org.junit.Assert.assertTrue;
 
+import org.apache.directory.server.core.api.OperationEnum;
 import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
@@ -45,6 +46,7 @@ public class hasEntryPerfIT extends Abst
     {
         Dn adminDn = new Dn( "uid=admin, ou=system" );
         EntryOperationContext hasEntryContext = new EntryOperationContext( getService().getAdminSession(), adminDn );
+        hasEntryContext.setInterceptors( getService().getInterceptors( OperationEnum.HAS_ENTRY ) );
         boolean hasEntry = getService().getOperationManager().hasEntry( hasEntryContext );
 
         assertTrue( hasEntry );

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Wed Nov  9 14:52:22 2011
@@ -223,7 +223,9 @@ public abstract class ServerContext impl
         session = bindContext.getSession();
         OperationManager operationManager = service.getOperationManager();
 
-        if ( ! operationManager.hasEntry( new EntryOperationContext( session, dn ) ) )
+        EntryOperationContext hasEntryContext = new EntryOperationContext( session, dn );
+        
+        if ( ! operationManager.hasEntry( hasEntryContext ) )
         {
             throw new NameNotFoundException( I18n.err( I18n.ERR_490, dn ) );
         }
@@ -256,7 +258,9 @@ public abstract class ServerContext impl
         session = new DefaultCoreSession( principal, service );
         OperationManager operationManager = service.getOperationManager();
 
-        if ( ! operationManager.hasEntry( new EntryOperationContext( session, dn ) ) )
+        EntryOperationContext hasEntryContext = new EntryOperationContext( session, dn );
+        
+        if ( ! operationManager.hasEntry( hasEntryContext ) )
         {
             throw new NameNotFoundException( I18n.err( I18n.ERR_490, dn ) );
         }
@@ -278,7 +282,9 @@ public abstract class ServerContext impl
         this.session = session;
         OperationManager operationManager = service.getOperationManager();
 
-        if ( ! operationManager.hasEntry( new EntryOperationContext( session, dn ) ) )
+        EntryOperationContext hasEntryContext = new EntryOperationContext( session, dn );
+        
+        if ( ! operationManager.hasEntry( hasEntryContext ) )
         {
             throw new NameNotFoundException( I18n.err( I18n.ERR_490, dn ) );
         }
@@ -1313,7 +1319,9 @@ public abstract class ServerContext impl
 
         try
         {
-            if ( operationManager.hasEntry( new EntryOperationContext( session, target ) ) )
+            EntryOperationContext hasEntryContext = new EntryOperationContext( session, target );
+            
+            if ( operationManager.hasEntry( hasEntryContext ) )
             {
                 doDeleteOperation( target );
             }

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Wed Nov  9 14:52:22 2011
@@ -49,6 +49,7 @@ import javax.naming.spi.DirectoryManager
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.OperationEnum;
 import org.apache.directory.server.core.api.entry.ServerEntryUtils;
 import org.apache.directory.server.core.api.event.DirectoryListener;
 import org.apache.directory.server.core.api.event.NotificationCriteria;
@@ -526,7 +527,9 @@ public abstract class ServerDirContext e
 
         try
         {
-            if ( getDirectoryService().getOperationManager().hasEntry( new EntryOperationContext( getSession(), target ) ) )
+            EntryOperationContext hasEntryContext = new EntryOperationContext( getSession(), target );
+            
+            if ( getDirectoryService().getOperationManager().hasEntry( hasEntryContext ) )
             {
                 doDeleteOperation( target );
             }

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java Wed Nov  9 14:52:22 2011
@@ -930,6 +930,7 @@ public class DefaultCoreSession implemen
     {
         EntryOperationContext hasEntryContext = new EntryOperationContext( this, dn );
         OperationManager operationManager = directoryService.getOperationManager();
+        
         return operationManager.hasEntry( hasEntryContext );
     }
 

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java Wed Nov  9 14:52:22 2011
@@ -796,7 +796,8 @@ public class DefaultPartitionNexus exten
                 for ( Partition partition : partitions.values() )
                 {
                     Dn contextDn = partition.getSuffixDn();
-                    EntryOperationContext hasEntryContext = new EntryOperationContext( null, contextDn );
+                    EntryOperationContext hasEntryContext = new EntryOperationContext( searchContext.getSession(), contextDn );
+                    
                     // search only if the context entry exists
                     if( partition.hasEntry( hasEntryContext ) )
                     {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Wed Nov  9 14:52:22 2011
@@ -542,7 +542,9 @@ public class DefaultOperationManager imp
 
         try
         {
-            return directoryService.getInterceptorChain().hasEntry( hasEntryContext );
+            Interceptor head = directoryService.getInterceptor( hasEntryContext.getNextInterceptor() );
+
+            return head.hasEntry( hasEntryContext );
         }
         finally
         {

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Wed Nov  9 14:52:22 2011
@@ -405,7 +405,10 @@ public class AuthenticationInterceptor e
     }
 
 
-    public boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
     {
         if ( IS_DEBUG )
         {
@@ -415,7 +418,7 @@ public class AuthenticationInterceptor e
         checkAuthenticated( hasEntryContext );
         checkPwdReset( hasEntryContext );
         
-        return next.hasEntry( hasEntryContext );
+        return next( hasEntryContext );
     }
 
 

Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Wed Nov  9 14:52:22 2011
@@ -815,16 +815,19 @@ public class AciAuthorizationInterceptor
     }
 
 
-    public boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
     {
         Dn dn = hasEntryContext.getDn();
 
         if ( !directoryService.isAccessControlEnabled() )
         {
-            return ( dn.isRootDSE() || next.hasEntry( hasEntryContext ) );
+            return ( dn.isRootDSE() || next( hasEntryContext ) );
         }
 
-        boolean answer = next.hasEntry( hasEntryContext );
+        boolean answer = next( hasEntryContext );
 
         // no checks on the RootDSE
         if ( dn.isRootDSE() )
@@ -866,7 +869,7 @@ public class AciAuthorizationInterceptor
 
         engine.checkPermission( aciContext );
 
-        return next.hasEntry( hasEntryContext );
+        return next( hasEntryContext );
     }
 
 

Modified: directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed Nov  9 14:52:22 2011
@@ -311,7 +311,7 @@ public class ExceptionInterceptor extend
         // check to see if target entry exists
         Dn newDn = renameContext.getNewDn();
 
-        if ( nextInterceptor.hasEntry( new EntryOperationContext( renameContext.getSession(), newDn ) ) )
+        if ( nexus.hasEntry( new EntryOperationContext( renameContext.getSession(), newDn ) ) )
         {
             LdapEntryAlreadyExistsException e;
             e = new LdapEntryAlreadyExistsException( I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, newDn.getName() ) );

Modified: directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java Wed Nov  9 14:52:22 2011
@@ -305,10 +305,10 @@ public class TimerInterceptor extends Ba
     /**
      * {@inheritDoc}
      */
-    public boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException
+    public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
     {
         long t0 = System.nanoTime();
-        boolean hasEntry = next.hasEntry( hasEntryContext );
+        boolean hasEntry = next( hasEntryContext );
         long delta = System.nanoTime() - t0;
         
         if ( IS_DEBUG_STATS )

Modified: directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1199778&r1=1199777&r2=1199778&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Wed Nov  9 14:52:22 2011
@@ -286,10 +286,11 @@ public class NormalizationInterceptor ex
     /**
      * {@inheritDoc}
      */
-    public boolean hasEntry( NextInterceptor nextInterceptor, EntryOperationContext hasEntryContext ) throws LdapException
+    public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
     {
         hasEntryContext.getDn().apply( schemaManager );
-        return nextInterceptor.hasEntry( hasEntryContext );
+        
+        return next( hasEntryContext );
     }