directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1200792 [1/2] - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/ core-api/src/main/java/org/apache/directory/server/core/api/interceptor/ core-api/src/main/java/org/apache/directory/server/core/api...
Date Fri, 11 Nov 2011 09:57:31 GMT
Author: elecharny
Date: Fri Nov 11 09:57:30 2011
New Revision: 1200792

URL: http://svn.apache.org/viewvc?rev=1200792&view=rev
Log:
o Moved the Search operation out of the InterceptorChain
o Completely get rid of the InterceptorChain and all the associated data structures

Removed:
    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/src/test/java/org/apache/directory/server/core/interceptor/
Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
    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/context/SearchOperationContext.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.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/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.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
    directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java Fri Nov 11 09:57:30 2011
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.core.api;
 
@@ -32,7 +32,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.entry.ServerEntryFactory;
 import org.apache.directory.server.core.api.event.EventService;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.InterceptorChain;
 import org.apache.directory.server.core.api.journal.Journal;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.PartitionNexus;
@@ -97,11 +96,8 @@ public interface DirectoryService extend
     PartitionNexus getPartitionNexus();
 
 
-    InterceptorChain getInterceptorChain();
-
-
     void addPartition( Partition partition ) throws Exception;
-    
+
 
     void removePartition( Partition partition ) throws Exception;
 
@@ -109,20 +105,20 @@ public interface DirectoryService extend
      * @return The Directory Service SchemaManager
      */
     SchemaManager getSchemaManager();
-    
-    
+
+
     /**
      * @return The LDAP codec service.
      */
     LdapApiService getLdapCodecService();
-    
+
 
     /**
      * @return The referral manager
      */
     ReferralManager getReferralManager();
 
-    
+
     /**
      * Set the referralManager
      * 
@@ -130,7 +126,7 @@ public interface DirectoryService extend
      */
     void setReferralManager( ReferralManager referralManager );
 
-    
+
     /**
      * @return The schema partition
      */
@@ -145,8 +141,8 @@ public interface DirectoryService extend
 
 
     EventService getEventService();
-    
-    
+
+
     /**
      */
     void setEventService( EventService eventService );
@@ -181,15 +177,15 @@ public interface DirectoryService extend
      */
     boolean isStarted();
 
-    
+
     /**
      * @return The Admin session
      */
     CoreSession getAdminSession();
-    
-    
-    /** 
-     * @return Returns the hash mapping the Dn of a subentry to its SubtreeSpecification/types 
+
+
+    /**
+     * @return Returns the hash mapping the Dn of a subentry to its SubtreeSpecification/types
      **/
     SubentryCache getSubentryCache();
 
@@ -197,42 +193,42 @@ public interface DirectoryService extend
      * @return Returns the subentry evaluator
      */
     SubtreeEvaluator getEvaluator();
-    
+
     /**
      * Gets a logical session to perform operations on this DirectoryService
-     * as the anonymous user.  This bypasses authentication without 
+     * as the anonymous user.  This bypasses authentication without
      * propagating a bind operation into the core.
      *
      * @return a logical session as the anonymous user
      */
     CoreSession getSession() throws Exception;
 
-    
+
     /**
      * Gets a logical session to perform operations on this DirectoryService
-     * as a specific user.  This bypasses authentication without propagating 
+     * as a specific user.  This bypasses authentication without propagating
      * a bind operation into the core.
      *
      * @return a logical session as a specific user
      */
     CoreSession getSession( LdapPrincipal principal ) throws Exception;
 
-    
+
     /**
      * Gets a logical session to perform operations on this DirectoryService
-     * as a specific user with a separate authorization principal.  This 
-     * bypasses authentication without propagating a bind operation into the 
+     * as a specific user with a separate authorization principal.  This
+     * bypasses authentication without propagating a bind operation into the
      * core.
      *
      * @return a logical session as a specific user
      */
     CoreSession getSession( Dn principalDn, byte[] credentials ) throws LdapException;
 
-    
+
     /**
      * Gets a logical session to perform operations on this DirectoryService
-     * as a specific user with a separate authorization principal.  This 
-     * bypasses authentication without propagating a bind operation into the 
+     * as a specific user with a separate authorization principal.  This
+     * bypasses authentication without propagating a bind operation into the
      * core.
      *
      * @return a logical session as a specific user
@@ -240,7 +236,7 @@ public interface DirectoryService extend
     CoreSession getSession( Dn principalDn, byte[] credentials, String saslMechanism, String saslAuthId )
         throws Exception;
 
-    
+
     /**
      */
     void setInstanceId( String instanceId );
@@ -341,29 +337,29 @@ public interface DirectoryService extend
      * @param interceptors the interceptors to be used in the server.
      */
     void setInterceptors( List<Interceptor> interceptors );
-    
-    
+
+
     /**
      * Add an interceptor in the first position in the interceptor list.
      * @param interceptor The added interceptor
      */
     void addFirst( Interceptor interceptor ) throws LdapException;
-    
-    
+
+
     /**
      * Add an interceptor in the last position in the interceptor list.
      * @param interceptor The added interceptor
      */
     void addLast( Interceptor interceptor ) throws LdapException;
-    
+
     /**
      * Add an interceptor after a given interceptor in the interceptor list.
      * @param interceptorName The interceptor name to find
      * @param interceptor The added interceptor
      */
     void addAfter( String interceptorName, Interceptor interceptor );
-    
-    
+
+
     /**
      * Remove an interceptor from the list of interceptors
      * @param interceptorName The interceptor to remove
@@ -378,7 +374,7 @@ public interface DirectoryService extend
      */
     void setJournal( Journal journal );
 
-    
+
     /**
      * Returns test directory entries({@link org.apache.directory.shared.ldap.model.ldif.LdifEntry}) to be loaded while
      * bootstrapping.
@@ -404,7 +400,7 @@ public interface DirectoryService extend
      */
     InstanceLayout getInstanceLayout();
 
-    
+
     /**
      * Sets the InstanceLayout used by the DirectoryService to store the files
      * @param instanceLayout The InstanceLayout to set
@@ -477,7 +473,7 @@ public interface DirectoryService extend
      * @param changeLog the change log service to set
      */
     void setChangeLog( ChangeLog changeLog );
-    
+
 
     /**
      * Create a new Entry.
@@ -486,8 +482,8 @@ public interface DirectoryService extend
      * @param dn the Dn for this new entry
      */
     Entry newEntry( String ldif, String dn );
-    
-    
+
+
     /**
      * Gets the operation manager.
      */
@@ -501,21 +497,21 @@ public interface DirectoryService extend
 
 
     /**
-     * Set the maximum allowed size for an incoming PDU 
+     * Set the maximum allowed size for an incoming PDU
      * @param maxPDUSize A positive number of bytes for the PDU. A negative or
      * null value will be transformed to {@link Integer#MAX_VALUE}
      */
     void setMaxPDUSize( int maxPDUSize );
-    
-    
+
+
     /**
      * Get an Interceptor instance from its name
-     * @param interceptorName The interceptor's name for which we want the instance 
+     * @param interceptorName The interceptor's name for which we want the instance
      * @return the interceptor for the given name
      */
     Interceptor getInterceptor( String interceptorName );
-    
-    
+
+
     /**
      * Get a new CSN
      * @return The CSN generated for this directory service
@@ -541,7 +537,7 @@ public interface DirectoryService extend
      * @param schemaManager The SchemaManager to associate
      */
     void setSchemaManager( SchemaManager schemaManager );
-    
+
 
     /**
      * the highest committed CSN value
@@ -550,31 +546,31 @@ public interface DirectoryService extend
      */
     void setContextCsn( String lastCommittedCsnVal );
 
-    
+
     /**
      * @return the current highest committed CSN value
      */
     String getContextCsn();
-    
-    
+
+
     /**
      * the time interval at which the DirectoryService's data is flushed to disk
      * 
      * @param syncPeriodMillis the syncPeriodMillis to set
      */
     void setSyncPeriodMillis( long syncPeriodMillis );
-    
-    
+
+
     /**
      * @return the syncPeriodMillis
      */
     long getSyncPeriodMillis();
-    
+
     /**
      * @return the cache service
      */
     CacheService getCacheService();
-    
+
 
     /**
      * @return The AccessControl AdministrativePoint cache
@@ -598,8 +594,8 @@ public interface DirectoryService extend
      * @return The TriggerExecution AdministrativePoint cache
      */
     DnNode<TriggerExecutionAdministrativePoint> getTriggerExecutionAPCache();
-    
-    
+
+
     /**
      * @return true if the password policy is enabled, false otherwise
      */

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=1200792&r1=1200791&r2=1200792&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 Fri Nov 11 09:57:30 2011
@@ -253,7 +253,7 @@ public abstract class BaseInterceptor im
         /**
          * {@inheritDoc}
          */
-        public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException
+        public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
         {
             return nexus.search( searchContext );
         }
@@ -653,9 +653,27 @@ public abstract class BaseInterceptor im
     }
 
 
-    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
-        return next.search( searchContext );
+        return null;
+    }
+
+
+    /**
+     * Calls the next interceptor for the search operation.
+     * 
+     * @param searchContext The context in which we are executing this operation
+     * @return the cursor containing the found entries
+     * @throws LdapException If something went wrong
+     */
+    protected final EntryFilteringCursor next( SearchOperationContext searchContext ) throws LdapException
+    {
+        Interceptor interceptor = getNextInterceptor( searchContext );
+
+        return interceptor.search( searchContext );
     }
 
 

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=1200792&r1=1200791&r2=1200792&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 Fri Nov 11 09:57:30 2011
@@ -208,7 +208,7 @@ public interface Interceptor
     /**
      * Filters {@link Partition#search( SearchOperationContext )} call.
      */
-    EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) 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/SearchOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java Fri Nov 11 09:57:30 2011
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.core.api.interceptor.context;
 
@@ -28,6 +28,7 @@ import java.util.Set;
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.OperationEnum;
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -57,41 +58,43 @@ public class SearchOperationContext exte
     public SearchOperationContext( CoreSession session )
     {
         super( session );
+        setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.SEARCH ) );
     }
 
 
     /**
      * Creates a new instance of SearchOperationContext.
-     * @throws Exception 
+     * @throws Exception
      */
     public SearchOperationContext( CoreSession session, SearchRequest searchRequest ) throws LdapException
     {
         super( session );
-        
+        setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.SEARCH ) );
+
         this.dn = searchRequest.getBase();
         this.filter = searchRequest.getFilter();
         this.abandoned = searchRequest.isAbandoned();
         this.aliasDerefMode = searchRequest.getDerefAliases();
-        
+
         this.requestControls = searchRequest.getControls();
         this.scope = searchRequest.getScope();
         this.sizeLimit = searchRequest.getSizeLimit();
         this.timeLimit = searchRequest.getTimeLimit();
         this.typesOnly = searchRequest.getTypesOnly();
-        
+
         List<String> ats = searchRequest.getAttributes();
-        
+
         // section 4.5.1.8 of RFC 4511
         //1. An empty list with no attributes requests the return of all user attributes.
         if ( ats.isEmpty() )
         {
             ats = new ArrayList<String>();
             ats.add( SchemaConstants.ALL_USER_ATTRIBUTES );
-            ats = Collections.unmodifiableList( ats ); 
+            ats = Collections.unmodifiableList( ats );
         }
-        
+
         setReturningAttributes( ats );
-        
+
         throwReferral = !requestControls.containsKey( ManageDsaIT.OID );
     }
 
@@ -111,6 +114,7 @@ public class SearchOperationContext exte
         timeLimit = searchControls.getTimeLimit();
         sizeLimit = searchControls.getCountLimit();
         typesOnly = searchControls.getReturningObjFlag();
+        setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.SEARCH ) );
 
         if ( searchControls.getReturningAttributes() != null )
         {
@@ -139,11 +143,12 @@ public class SearchOperationContext exte
         super( session, dn, returningAttributes );
         super.setScope( scope );
         this.filter = filter;
+        setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.SEARCH ) );
     }
 
 
     /**
-     * Checks whether or not the ManageDsaITControl is present.  If not 
+     * Checks whether or not the ManageDsaITControl is present.  If not
      * present then the filter is modified to force the return of all referral
      * entries regardless of whether or not the filter matches the referral
      * entry.
@@ -152,8 +157,8 @@ public class SearchOperationContext exte
     {
         return super.hasRequestControl( ManageDsaIT.OID );
     }
-    
-    
+
+
     /**
      * @return The filter
      */
@@ -180,7 +185,7 @@ public class SearchOperationContext exte
     public String toString()
     {
         return "SearchContext for Dn '" + getDn().getName() + "', filter :'"
-        + filter + "'"; 
+            + filter + "'";
     }
 
 

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java Fri Nov 11 09:57:30 2011
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.core.api;
 
@@ -35,7 +35,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.changelog.ChangeLog;
 import org.apache.directory.server.core.api.event.EventService;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.InterceptorChain;
 import org.apache.directory.server.core.api.journal.Journal;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.PartitionNexus;
@@ -60,22 +59,22 @@ import org.apache.directory.shared.ldap.
 public class MockDirectoryService implements DirectoryService
 {
     int count;
-    
+
     /** The schemaManager */
     SchemaManager schemaManager;
 
-    
+
     public MockDirectoryService()
     {
         this( 0 );
     }
-    
-    
+
+
     public MockDirectoryService( int count )
     {
         this.count = count;
     }
-    
+
     public Hashtable<String, Object> getEnvironment()
     {
         return null;
@@ -105,12 +104,6 @@ public class MockDirectoryService implem
     }
 
 
-    public InterceptorChain getInterceptorChain()
-    {
-        return null;
-    }
-
-
     public void addPartition( Partition partition ) throws LdapException
     {
     }
@@ -338,12 +331,12 @@ public class MockDirectoryService implem
     {
 
     }
-    
+
     public void setChangeLog( ChangeLog changeLog )
     {
-        
+
     }
-    
+
     public ChangeLog getChangeLog()
     {
         return null;
@@ -360,7 +353,7 @@ public class MockDirectoryService implem
     {
         return null;
     }
-    
+
     public Entry newEntry( String ldif, String dn )
     {
         return null;
@@ -390,12 +383,12 @@ public class MockDirectoryService implem
         return null;
     }
 
-    
+
     public CoreSession getSession( Dn principalDn, byte[] credentials, String saslMechanism, String saslAuthId )
         throws LdapException
-    {
+        {
         return null;
-    }
+        }
 
     public CoreSession getAdminSession()
     {
@@ -410,19 +403,19 @@ public class MockDirectoryService implem
     public void setEventService( EventService eventService )
     {
     }
-    
-    
+
+
     public boolean isPasswordHidden()
     {
         return false;
     }
-         
-    
+
+
     public void setPasswordHidden( boolean passwordHidden )
     {
     }
 
-    
+
     public int getMaxPDUSize()
     {
         return Integer.MAX_VALUE;
@@ -434,25 +427,25 @@ public class MockDirectoryService implem
         // Do nothing
     }
 
-    
+
     public Interceptor getInterceptor( String interceptorName )
     {
         return null;
     }
-    
-    
+
+
     public Csn getCSN()
     {
         return null;
     }
-    
-    
+
+
     public int getReplicaId()
     {
         return 0;
     }
-    
-    
+
+
     public void setReplicaId( int replicaId )
     {
     }
@@ -573,38 +566,38 @@ public class MockDirectoryService implem
     }
 
 
-	@Override
-	public List<String> getInterceptors( OperationEnum operation ) 
-	{
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-
-	@Override
-	public void addFirst( Interceptor interceptor )  throws LdapException 
-	{
-		// TODO Auto-generated method stub
-	}
-
-
-	@Override
-	public void addLast( Interceptor interceptor ) throws LdapException 
-	{
-		// TODO Auto-generated method stub
-	}
-
-
-	@Override
-	public void addAfter( String interceptorName, Interceptor interceptor ) 
-	{
-		// TODO Auto-generated method stub
-	}
-
-
-	@Override
-	public void remove( String interceptorName ) 
-	{
-		// TODO Auto-generated method stub
-	}
+    @Override
+    public List<String> getInterceptors( OperationEnum operation )
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    @Override
+    public void addFirst( Interceptor interceptor )  throws LdapException
+    {
+        // TODO Auto-generated method stub
+    }
+
+
+    @Override
+    public void addLast( Interceptor interceptor ) throws LdapException
+    {
+        // TODO Auto-generated method stub
+    }
+
+
+    @Override
+    public void addAfter( String interceptorName, Interceptor interceptor )
+    {
+        // TODO Auto-generated method stub
+    }
+
+
+    @Override
+    public void remove( String interceptorName )
+    {
+        // TODO Auto-generated method stub
+    }
 }

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=1200792&r1=1200791&r2=1200792&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 Fri Nov 11 09:57:30 2011
@@ -24,7 +24,6 @@ import java.util.List;
 
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
@@ -202,11 +201,11 @@ public class MockInterceptor extends Bas
     /**
      * {@inheritDoc}
      */
-    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
         interceptors.add( this );
 
-        return next.search( searchContext );
+        return next( searchContext );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Fri Nov 11 09:57:30 2011
@@ -66,7 +66,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.event.EventService;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.InterceptorChain;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
@@ -144,7 +143,7 @@ public class DefaultDirectoryService imp
 
     /** A reference on the SchemaManager */
     private SchemaManager schemaManager;
-    
+
     /** The LDAP Codec Service */
     private LdapApiService ldapCodecService = LdapApiServiceFactory.getSingleton();
 
@@ -154,9 +153,6 @@ public class DefaultDirectoryService imp
     /** whether or not server is started for the first time */
     private boolean firstStart;
 
-    /** The interceptor (or interceptor chain) for this service */
-    private InterceptorChain interceptorChain;
-
     /** whether or not this instance has been shutdown */
     private boolean started;
 
@@ -192,7 +188,7 @@ public class DefaultDirectoryService imp
 
     /** remove me after implementation is completed */
     private static final String PARTIAL_IMPL_WARNING =
-            "WARNING: the changelog is only partially operational and will revert\n" +
+        "WARNING: the changelog is only partially operational and will revert\n" +
             "state without consideration of who made the original change.  All reverting " +
             "changes are made by the admin user.\n Furthermore the used controls are not at " +
             "all taken into account";
@@ -245,14 +241,14 @@ public class DefaultDirectoryService imp
     /** The list of declared interceptors */
     private List<Interceptor> interceptors;
     private Map<String, Interceptor> interceptorNames;
-    
+
     /** A lock to protect the interceptors List */
     private ReadWriteLock interceptorsLock = new ReentrantReadWriteLock();
-    
+
     /** The read and write locks */
     private Lock readLock  = interceptorsLock.readLock();
     private Lock writeLock  = interceptorsLock.writeLock();
-    
+
     /** A map associating a list of interceptor to each operation */
     private Map<OperationEnum, List<String>> operationInterceptors;
 
@@ -296,7 +292,7 @@ public class DefaultDirectoryService imp
 
     /** The Dn factory */
     private DnFactory dnFactory;
-    
+
     /** The Subentry cache */
     SubentryCache subentryCache = new SubentryCache();
 
@@ -479,14 +475,14 @@ public class DefaultDirectoryService imp
     public List<Interceptor> getInterceptors()
     {
         List<Interceptor> cloned = new ArrayList<Interceptor>();
-    	
+
         try
         {
             readLock.lock();
-            
-        	cloned.addAll( interceptors );
-        
-        	return cloned;
+
+            cloned.addAll( interceptors );
+
+            return cloned;
         }
         finally
         {
@@ -503,13 +499,13 @@ public class DefaultDirectoryService imp
     public List<String> getInterceptors( OperationEnum operation )
     {
         List<String> cloned = new ArrayList<String>();
-        
+
         try
         {
-	        readLock.lock();
-	        cloned.addAll( operationInterceptors.get( operation ) );
-	        
-	        return cloned;
+            readLock.lock();
+            cloned.addAll( operationInterceptors.get( operation ) );
+
+            return cloned;
         }
         finally
         {
@@ -517,36 +513,36 @@ public class DefaultDirectoryService imp
         }
 
     }
-    
-    
+
+
     /**
      * Compute the list of  to call for each operation
      */
     private void initOperationsList()
     {
-    	try
-    	{
-	        writeLock.lock();
-	    	operationInterceptors = new ConcurrentHashMap<OperationEnum, List<String>>();
-	    	
-	    	for ( OperationEnum operation : OperationEnum.getOperations() )
-	    	{
-		    	List<String> operationList = new ArrayList<String>();
-		    	
-		        for ( Interceptor interceptor : interceptors )
-		        {
-		            gatherInterceptors( interceptor, interceptor.getClass(), operation, operationList );
-		        }
-		        operationInterceptors.put( operation, operationList );
-	    	}
-    	}
-    	finally
-    	{
-    		writeLock.unlock();
-    	}
+        try
+        {
+            writeLock.lock();
+            operationInterceptors = new ConcurrentHashMap<OperationEnum, List<String>>();
+
+            for ( OperationEnum operation : OperationEnum.getOperations() )
+            {
+                List<String> operationList = new ArrayList<String>();
+
+                for ( Interceptor interceptor : interceptors )
+                {
+                    gatherInterceptors( interceptor, interceptor.getClass(), operation, operationList );
+                }
+                operationInterceptors.put( operation, operationList );
+            }
+        }
+        finally
+        {
+            writeLock.unlock();
+        }
     }
-    
-    
+
+
     /**
      * Recursively checks if the given interceptor can be added to the list of interceptors for a given
      * operation and adds to the list of interceptors if it implements the respective operation
@@ -562,20 +558,20 @@ public class DefaultDirectoryService imp
         {
             return;
         }
-        
+
         Method[] methods = interceptorClz.getDeclaredMethods();
-        
+
         for ( Method method : methods )
         {
             Class<?>[] param = method.getParameterTypes();
             boolean hasCorrestSig = false;
-            
+
             // check for the correct signature
             if( ( param == null ) || ( param.length > 1 ) || ( param.length == 0 ))
             {
                 continue;
             }
-            
+
             if ( OperationContext.class.isAssignableFrom( param[0] ) )
             {
                 hasCorrestSig = true;
@@ -591,101 +587,101 @@ public class DefaultDirectoryService imp
                 break;
             }
         }
-        
+
         gatherInterceptors( interceptor, interceptorClz.getSuperclass(), operation, selectedInterceptorList );
     }
-    
-    
+
+
     /**
      * Add an interceptor to the list of interceptors to call for each operation
-     * @throws LdapException 
+     * @throws LdapException
      */
     private void addInterceptor( Interceptor interceptor, int position ) throws LdapException
     {
-    	// First, init the interceptor
-    	interceptor.init( this );
-    	
-    	try
-    	{
-	        writeLock.lock();
-	    	
-	    	for ( OperationEnum operation : OperationEnum.getOperations() )
-	    	{
-		    	List<String> operationList = operationInterceptors.get( operation );
-		    		    	
-		    	Method[] methods = interceptor.getClass().getDeclaredMethods();
-		    	
-		    	for ( Method method : methods )
-		    	{
-		    		if ( method.getName().equals( operation.getMethodName() ) )
-		    		{
-		    	    	if ( position == -1 )
-		    	    	{
-		    	    		operationList.add( interceptor.getName() );
-		    	    	}
-		    	    	else
-		    	    	{
-		    	    		operationList.add( position, interceptor.getName() );
-		    	    	}
-		    	    	
-		    			break;
-		    		}
-		    	}
-	    	}
-	    	
-	    	interceptorNames.put( interceptor.getName(), interceptor );
-	    	
-	    	if ( position == -1 )
-	    	{
-	    		interceptors.add( interceptor );
-	    	}
-	    	else
-	    	{
-	    		interceptors.add( position, interceptor );
-	    	}
-    	}
-    	finally
-    	{
-    		writeLock.unlock();
-    	}
+        // First, init the interceptor
+        interceptor.init( this );
+
+        try
+        {
+            writeLock.lock();
+
+            for ( OperationEnum operation : OperationEnum.getOperations() )
+            {
+                List<String> operationList = operationInterceptors.get( operation );
+
+                Method[] methods = interceptor.getClass().getDeclaredMethods();
+
+                for ( Method method : methods )
+                {
+                    if ( method.getName().equals( operation.getMethodName() ) )
+                    {
+                        if ( position == -1 )
+                        {
+                            operationList.add( interceptor.getName() );
+                        }
+                        else
+                        {
+                            operationList.add( position, interceptor.getName() );
+                        }
+
+                        break;
+                    }
+                }
+            }
+
+            interceptorNames.put( interceptor.getName(), interceptor );
+
+            if ( position == -1 )
+            {
+                interceptors.add( interceptor );
+            }
+            else
+            {
+                interceptors.add( position, interceptor );
+            }
+        }
+        finally
+        {
+            writeLock.unlock();
+        }
     }
 
-    
+
     /**
      * Remove an interceptor to the list of interceptors to call for each operation
      */
     private void removeOperationsList( String interceptorName )
     {
-    	Interceptor interceptor = interceptorNames.get( interceptorName );
-    	
-    	try
-    	{
-	        writeLock.lock();
-	    	
-	    	for ( OperationEnum operation : OperationEnum.getOperations() )
-	    	{
-		    	List<String> operationList = operationInterceptors.get( operation );
-		    		    	
-		    	Method[] methods = interceptor.getClass().getDeclaredMethods();
-		    	
-		    	for ( Method method : methods )
-		    	{
-		    		if ( method.getName().equals( operation.getMethodName() ) )
-		    		{
-	    	    		operationList.remove( interceptor.getName() );
-		    	    	
-		    			break;
-		    		}
-		    	}
-	    	}
-	    	
-	    	interceptorNames.remove( interceptorName );
-	    	interceptors.remove( interceptor );
-    	}
-    	finally
-    	{
-    		writeLock.unlock();
-    	}
+        Interceptor interceptor = interceptorNames.get( interceptorName );
+
+        try
+        {
+            writeLock.lock();
+
+            for ( OperationEnum operation : OperationEnum.getOperations() )
+            {
+                List<String> operationList = operationInterceptors.get( operation );
+
+                Method[] methods = interceptor.getClass().getDeclaredMethods();
+
+                for ( Method method : methods )
+                {
+                    if ( method.getName().equals( operation.getMethodName() ) )
+                    {
+                        operationList.remove( interceptor.getName() );
+
+                        break;
+                    }
+                }
+            }
+
+            interceptorNames.remove( interceptorName );
+            interceptors.remove( interceptor );
+        }
+        finally
+        {
+            writeLock.unlock();
+        }
     }
 
 
@@ -706,7 +702,7 @@ public class DefaultDirectoryService imp
                 LOG.warn( "Encountered duplicate definitions for {} interceptor", interceptor.getName() );
                 continue;
             }
-            
+
             interceptorNames.put( interceptor.getName(), interceptor );
         }
 
@@ -714,7 +710,19 @@ public class DefaultDirectoryService imp
         this.interceptorNames = interceptorNames;
 
         // Now update the Map that connect each operation with the list of interceptors.
-    	initOperationsList();
+        initOperationsList();
+    }
+
+
+    /**
+     * Initialize the interceptors
+     */
+    private void initInterceptors() throws LdapException
+    {
+        for ( Interceptor interceptor : interceptors )
+        {
+            interceptor.init( this );
+        }
     }
 
 
@@ -728,7 +736,7 @@ public class DefaultDirectoryService imp
     {
         List<LdifEntry> cloned = new ArrayList<LdifEntry>();
         cloned.addAll( testEntries );
-        
+
         return cloned;
     }
 
@@ -763,7 +771,7 @@ public class DefaultDirectoryService imp
     public void setInstanceLayout( InstanceLayout instanceLayout ) throws IOException
     {
         this.instanceLayout = instanceLayout;
-        
+
         // Create the directories if they are missing
         if ( !instanceLayout.getInstanceDirectory().exists() )
         {
@@ -780,7 +788,7 @@ public class DefaultDirectoryService imp
                 throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getLogDirectory() ) );
             }
         }
-        
+
         if ( !instanceLayout.getRunDirectory().exists() )
         {
             if ( !instanceLayout.getRunDirectory().mkdirs() )
@@ -788,7 +796,7 @@ public class DefaultDirectoryService imp
                 throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getRunDirectory() ) );
             }
         }
-        
+
         if ( !instanceLayout.getPartitionsDirectory().exists() )
         {
             if ( !instanceLayout.getPartitionsDirectory().mkdirs() )
@@ -796,7 +804,7 @@ public class DefaultDirectoryService imp
                 throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getPartitionsDirectory() ) );
             }
         }
-        
+
         if ( !instanceLayout.getConfDirectory().exists() )
         {
             if ( !instanceLayout.getConfDirectory().mkdirs() )
@@ -915,7 +923,7 @@ public class DefaultDirectoryService imp
             // We've got an exception, we cannot add the partition to the partitions
             throw le;
         }
-        
+
         // Now, add the partition to the set of managed partitions
         partitions.add( partition );
     }
@@ -937,7 +945,7 @@ public class DefaultDirectoryService imp
             // Bad ! We can't go any further
             throw le;
         }
-        
+
         // And update the set of managed partitions
         partitions.remove( partition );
     }
@@ -1002,7 +1010,7 @@ public class DefaultDirectoryService imp
         bindContext.setCredentials( credentials );
         bindContext.setDn( principalDn );
         bindContext.setInterceptors( getInterceptors( OperationEnum.BIND ) );
-        
+
         operationManager.bind( bindContext );
 
         return bindContext.getSession();
@@ -1011,7 +1019,7 @@ public class DefaultDirectoryService imp
 
     public CoreSession getSession( Dn principalDn, byte[] credentials, String saslMechanism, String saslAuthId )
         throws Exception
-    {
+        {
         if ( ! started )
         {
             throw new IllegalStateException( "Service has not started." );
@@ -1026,7 +1034,7 @@ public class DefaultDirectoryService imp
         operationManager.bind( bindContext );
 
         return bindContext.getSession();
-    }
+        }
 
 
     public long revert() throws LdapException
@@ -1254,13 +1262,13 @@ public class DefaultDirectoryService imp
         // load the last stored valid CSN value
         LookupOperationContext loc = new LookupOperationContext( getAdminSession() );
         loc.setDn( systemPartition.getSuffixDn() );
-        
+
         // get back all the attributes
         loc.setAttrsId( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
         Entry entry = systemPartition.lookup( loc );
 
         Attribute cntextCsnAt = entry.get( SchemaConstants.CONTEXT_CSN_AT );
-        
+
         if ( cntextCsnAt != null )
         {
             // this is a multivalued attribute but current syncrepl provider implementation stores only ONE value at ou=system
@@ -1339,9 +1347,8 @@ public class DefaultDirectoryService imp
         // --------------------------------------------------------------------
         // And shutdown the server
         // --------------------------------------------------------------------
-        interceptorChain.destroy();
         cacheService.destroy();
-        
+
         if ( lockFile != null )
         {
             try
@@ -1397,7 +1404,7 @@ public class DefaultDirectoryService imp
         this.schemaManager = schemaManager;
     }
 
-    
+
     public LdapApiService getLdapCodecService()
     {
         return ldapCodecService;
@@ -1428,12 +1435,6 @@ public class DefaultDirectoryService imp
     }
 
 
-    public InterceptorChain getInterceptorChain()
-    {
-        return interceptorChain;
-    }
-
-
     public boolean isFirstStart()
     {
         return firstStart;
@@ -1478,10 +1479,10 @@ public class DefaultDirectoryService imp
             Entry serverEntry = new DefaultEntry( schemaManager, adminDn );
 
             serverEntry.put( SchemaConstants.OBJECT_CLASS_AT,
-                                SchemaConstants.TOP_OC,
-                                SchemaConstants.PERSON_OC,
-                                SchemaConstants.ORGANIZATIONAL_PERSON_OC,
-                                SchemaConstants.INET_ORG_PERSON_OC );
+                SchemaConstants.TOP_OC,
+                SchemaConstants.PERSON_OC,
+                SchemaConstants.ORGANIZATIONAL_PERSON_OC,
+                SchemaConstants.INET_ORG_PERSON_OC );
 
             serverEntry.put( SchemaConstants.UID_AT, PartitionNexus.ADMIN_UID );
             serverEntry.put( SchemaConstants.USER_PASSWORD_AT, PartitionNexus.ADMIN_PASSWORD_BYTES );
@@ -1511,8 +1512,8 @@ public class DefaultDirectoryService imp
             Entry serverEntry = new DefaultEntry( schemaManager, userDn );
 
             serverEntry.put( SchemaConstants.OBJECT_CLASS_AT,
-                                SchemaConstants.TOP_OC,
-                                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+                SchemaConstants.TOP_OC,
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
 
             serverEntry.put( SchemaConstants.OU_AT, "users" );
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
@@ -1536,8 +1537,8 @@ public class DefaultDirectoryService imp
             Entry serverEntry = new DefaultEntry( schemaManager, groupDn );
 
             serverEntry.put( SchemaConstants.OBJECT_CLASS_AT,
-                                SchemaConstants.TOP_OC,
-                                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+                SchemaConstants.TOP_OC,
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
 
             serverEntry.put( SchemaConstants.OU_AT, "groups" );
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
@@ -1561,8 +1562,8 @@ public class DefaultDirectoryService imp
             Entry serverEntry = new DefaultEntry( schemaManager, name );
 
             serverEntry.put( SchemaConstants.OBJECT_CLASS_AT,
-                                SchemaConstants.TOP_OC,
-                                SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC );
+                SchemaConstants.TOP_OC,
+                SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC );
 
             serverEntry.put( SchemaConstants.CN_AT, "Administrators" );
             serverEntry.put( SchemaConstants.UNIQUE_MEMBER_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
@@ -1745,12 +1746,12 @@ public class DefaultDirectoryService imp
             }
         }
     }
-    
-    
+
+
     private void initializeSystemPartition() throws Exception
     {
         Partition system = getSystemPartition();
-        
+
         // Add root context entry for system partition
         Dn systemSuffixDn = getDnFactory().create( ServerDNConstants.SYSTEM_DN );
         CoreSession adminSession = getAdminSession();
@@ -1758,11 +1759,11 @@ public class DefaultDirectoryService imp
         if ( !system.hasEntry( new EntryOperationContext( adminSession, systemSuffixDn ) ) )
         {
             Entry systemEntry = new DefaultEntry( schemaManager, systemSuffixDn );
-            
+
             // Add the ObjectClasses
             systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
                 SchemaConstants.ORGANIZATIONAL_UNIT_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );
-            
+
             // Add some operational attributes
             systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN );
             systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
@@ -1770,7 +1771,7 @@ public class DefaultDirectoryService imp
             systemEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
             systemEntry.put( DnUtils.getRdnAttributeType( ServerDNConstants.SYSTEM_DN ), DnUtils
                 .getRdnValue( ServerDNConstants.SYSTEM_DN ) );
-            
+
             AddOperationContext addOperationContext = new AddOperationContext( adminSession, systemEntry );
             system.add( addOperationContext );
         }
@@ -1788,7 +1789,7 @@ public class DefaultDirectoryService imp
         {
             LOG.debug( "---> Initializing the DefaultDirectoryService " );
         }
-        
+
         cacheService = new CacheService();
         cacheService.initialize( this );
 
@@ -1799,7 +1800,7 @@ public class DefaultDirectoryService imp
         triggerExecutionAPCache = new DnNode<TriggerExecutionAdministrativePoint>();
 
         dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
-        
+
         // triggers partition to load schema fully from schema partition
         schemaPartition.initialize();
         partitions.add( schemaPartition );
@@ -1814,15 +1815,15 @@ public class DefaultDirectoryService imp
         partitionNexus.initialize( );
 
         initializeSystemPartition();
-        
+
         // --------------------------------------------------------------------
         // Create all the bootstrap entries before initializing chain
         // --------------------------------------------------------------------
 
         firstStart = createBootstrapEntries();
-        
-        interceptorChain = new InterceptorChain();
-        interceptorChain.init( this );
+
+        // Initialize the interceptors
+        initInterceptors();
 
         // --------------------------------------------------------------------
         // Initialize the changeLog if it's enabled
@@ -2011,19 +2012,19 @@ public class DefaultDirectoryService imp
      */
     public Interceptor getInterceptor( String interceptorName )
     {
-    	try
-    	{
-	        readLock.lock();
-	
-	        for ( Interceptor interceptor:interceptors )
-	        {
-	            if ( interceptor.getName().equalsIgnoreCase( interceptorName ) )
-	            {
-	                return interceptor;
-	            }
-	        }
-	        
-	        return null;
+        try
+        {
+            readLock.lock();
+
+            for ( Interceptor interceptor:interceptors )
+            {
+                if ( interceptor.getName().equalsIgnoreCase( interceptorName ) )
+                {
+                    return interceptor;
+                }
+            }
+
+            return null;
         }
         finally
         {
@@ -2034,39 +2035,39 @@ public class DefaultDirectoryService imp
 
     /**
      * {@inheritDoc}
-     * @throws LdapException 
+     * @throws LdapException
      */
-	public void addFirst( Interceptor interceptor ) throws LdapException 
-	{
-		addInterceptor( interceptor, 0 );
-	}
+    public void addFirst( Interceptor interceptor ) throws LdapException
+    {
+        addInterceptor( interceptor, 0 );
+    }
 
 
     /**
      * {@inheritDoc}
-     * @throws LdapException 
+     * @throws LdapException
      */
-	public void addLast( Interceptor interceptor ) throws LdapException 
-	{
-		addInterceptor( interceptor, -1 );
-	}
+    public void addLast( Interceptor interceptor ) throws LdapException
+    {
+        addInterceptor( interceptor, -1 );
+    }
 
 
     /**
      * {@inheritDoc}
      */
-	public void addAfter( String interceptorName, Interceptor interceptor ) 
-	{
-	}
+    public void addAfter( String interceptorName, Interceptor interceptor )
+    {
+    }
 
 
     /**
      * {@inheritDoc}
      */
-	public void remove( String interceptorName ) 
-	{
-		removeOperationsList( interceptorName );
-	}
+    public void remove( String interceptorName )
+    {
+        removeOperationsList( interceptorName );
+    }
 
 
     /**
@@ -2224,24 +2225,24 @@ public class DefaultDirectoryService imp
     {
         return triggerExecutionAPCache;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public boolean isPwdPolicyEnabled()
     {
         AuthenticationInterceptor authenticationInterceptor = (AuthenticationInterceptor)getInterceptor( AuthenticationInterceptor.class.getSimpleName() );
-        
+
         if ( authenticationInterceptor == null )
         {
             return false;
         }
 
         PpolicyConfigContainer pwdPolicyContainer = authenticationInterceptor.getPwdPolicyContainer();
-        
-        return ( ( pwdPolicyContainer != null ) 
-                && ( ( pwdPolicyContainer.getDefaultPolicy() != null ) 
+
+        return ( ( pwdPolicyContainer != null )
+            && ( ( pwdPolicyContainer.getDefaultPolicy() != null )
                 || ( pwdPolicyContainer.hasCustomConfigs() ) ) );
     }
 
@@ -2262,8 +2263,8 @@ public class DefaultDirectoryService imp
     {
         return subentryCache;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

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=1200792&r1=1200791&r2=1200792&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 Fri Nov 11 09:57:30 2011
@@ -29,7 +29,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.ReferralManager;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.InterceptorChain;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
@@ -1111,9 +1110,10 @@ public class DefaultOperationManager imp
             // Unlock the ReferralManager
             directoryService.getReferralManager().unlock();
 
-            // Call the Add method
-            InterceptorChain interceptorChain = directoryService.getInterceptorChain();
-            return interceptorChain.search( searchContext );
+            // Call the Search method
+            Interceptor head = directoryService.getInterceptor( searchContext.getNextInterceptor() );
+
+            return head.search( searchContext );
         }
         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=1200792&r1=1200791&r2=1200792&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 Fri Nov 11 09:57:30 2011
@@ -51,7 +51,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
@@ -782,9 +781,8 @@ public class AuthenticationInterceptor e
     }
 
 
-    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
-        throws LdapException
-        {
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
+    {
         if ( IS_DEBUG )
         {
             LOG.debug( "Operation Context: {}", searchContext );
@@ -793,8 +791,8 @@ public class AuthenticationInterceptor e
         checkAuthenticated( searchContext );
         checkPwdReset( searchContext );
 
-        return next.search( searchContext );
-        }
+        return next( searchContext );
+    }
 
 
     /**

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=1200792&r1=1200791&r2=1200792&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 Fri Nov 11 09:57:30 2011
@@ -39,7 +39,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilter;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
@@ -1233,11 +1232,11 @@ public class AciAuthorizationInterceptor
     }
 
 
-    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
         LdapPrincipal user = searchContext.getSession().getEffectivePrincipal();
         Dn principalDn = user.getDn();
-        EntryFilteringCursor cursor = next.search( searchContext );
+        EntryFilteringCursor cursor = next( searchContext );
 
         boolean isSubschemaSubentryLookup = subschemaSubentryDn.equals( searchContext.getDn().getNormName() );
         SearchControls searchCtls = searchContext.getSearchControls();

Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java Fri Nov 11 09:57:30 2011
@@ -34,7 +34,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -447,9 +446,9 @@ public class DefaultAuthorizationInterce
     }
 
 
-    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
-        EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
+        EntryFilteringCursor cursor = next( searchContext );
 
         if ( searchContext.getSession().getDirectoryService().isAccessControlEnabled() )
         {

Modified: directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Fri Nov 11 09:57:30 2011
@@ -30,7 +30,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilter;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -165,9 +164,9 @@ public class CollectiveAttributeIntercep
     /**
      * {@inheritDoc}
      */
-    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
-        EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
+        EntryFilteringCursor cursor = next( searchContext );
 
         cursor.addEntryFilter( SEARCH_FILTER );
 

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=1200792&r1=1200791&r2=1200792&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 Fri Nov 11 09:57:30 2011
@@ -25,7 +25,6 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
@@ -171,7 +170,7 @@ public class TimerInterceptor extends Ba
     /**
      * {@inheritDoc}
      */
-    public void bind( NextInterceptor next, BindOperationContext bindContext ) throws LdapException
+    public void bind( BindOperationContext bindContext ) throws LdapException
     {
         long t0 = System.nanoTime();
         next( bindContext );
@@ -514,10 +513,10 @@ public class TimerInterceptor extends Ba
     /**
      * {@inheritDoc}
      */
-    public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
         long t0 = System.nanoTime();
-        EntryFilteringCursor cursor = next.search( searchContext );
+        EntryFilteringCursor cursor = next( searchContext );
         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=1200792&r1=1200791&r2=1200792&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 Fri Nov 11 09:57:30 2011
@@ -26,7 +26,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
@@ -245,7 +244,7 @@ public class NormalizationInterceptor ex
     /**
      * {@inheritDoc}
      */
-    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
         Dn dn = searchContext.getDn();
 
@@ -275,7 +274,7 @@ public class NormalizationInterceptor ex
             searchContext.setFilter( filter );
 
             // TODO Normalize the returned Attributes, storing the UP attributes to format the returned values.
-            return nextInterceptor.search( searchContext );
+            return next( searchContext );
         }
     }
 

Modified: directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Fri Nov 11 09:57:30 2011
@@ -34,7 +34,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -415,9 +414,9 @@ public class OperationalAttributeInterce
     }
 
 
-    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
-        EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
+        EntryFilteringCursor cursor = next( searchContext );
 
         if ( searchContext.isAllOperationalAttributes()
             || ( searchContext.getReturningAttributes() != null && !searchContext.getReturningAttributes().isEmpty() ) )
@@ -431,6 +430,7 @@ public class OperationalAttributeInterce
         }
 
         cursor.addEntryFilter( SEARCH_FILTER );
+
         return cursor;
     }
 

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Fri Nov 11 09:57:30 2011
@@ -39,7 +39,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilter;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
@@ -630,7 +629,7 @@ public class SchemaInterceptor extends B
     }
 
 
-    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
         Dn base = searchContext.getDn();
         SearchControls searchCtls = searchContext.getSearchControls();
@@ -652,7 +651,7 @@ public class SchemaInterceptor extends B
         // Deal with the normal case : searching for a normal value (not subSchemaSubEntry)
         if ( !subschemaSubentryDnNorm.equals( baseNormForm ) )
         {
-            EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
+            EntryFilteringCursor cursor = next( searchContext );
 
             if ( searchCtls.getReturningAttributes() != null )
             {

Modified: directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1200792&r1=1200791&r2=1200792&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Fri Nov 11 09:57:30 2011
@@ -36,7 +36,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilter;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
@@ -1518,9 +1517,9 @@ public class SubentryInterceptor extends
     /**
      * {@inheritDoc}
      */
-    public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
+    public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
     {
-        EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
+        EntryFilteringCursor cursor = next( searchContext );
 
         // object scope searches by default return subentries
         if ( searchContext.getScope() == SearchScope.OBJECT )



Mime
View raw message