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/17 00:10:43 UTC

svn commit: r1202927 - 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 16 23:10:42 2011
New Revision: 1202927

URL: http://svn.apache.org/viewvc?rev=1202927&view=rev
Log:
Modified the way we handle modifications done on the SSSE : we don't enter the chain anymore.

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/context/AbstractOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.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=1202927&r1=1202926&r2=1202927&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 16 23:10:42 2011
@@ -371,7 +371,7 @@ public abstract class BaseInterceptor im
      * @param operationContext The operation context
      * @return The next interceptor in the list for this operation
      */
-    private Interceptor getNextInterceptor( OperationContext operationContext )
+    protected Interceptor getNextInterceptor( OperationContext operationContext )
     {
         String currentInterceptor = operationContext.getNextInterceptor();
 

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=1202927&r1=1202926&r2=1202927&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 16 23:10:42 2011
@@ -110,18 +110,27 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public CoreSession getSession()
     {
         return session;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void setSession( CoreSession session )
     {
         this.session = session;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void setAuthorizedPrincipal( LdapPrincipal authorizedPrincipal )
     {
         this.authorizedPrincipal = authorizedPrincipal;
@@ -148,48 +157,72 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void addRequestControl( Control requestControl )
     {
         requestControls.put( requestControl.getOid(), requestControl );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Control getRequestControl( String numericOid )
     {
         return requestControls.get( numericOid );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasRequestControl( String numericOid )
     {
         return requestControls.containsKey( numericOid );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasRequestControls()
     {
         return ! requestControls.isEmpty();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void addResponseControl( Control responseControl )
     {
         responseControls.put( responseControl.getOid(), responseControl );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Control getResponseControl( String numericOid )
     {
         return responseControls.get( numericOid );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasResponseControl( String numericOid )
     {
         return responseControls.containsKey( numericOid );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Control[] getResponseControls()
     {
         if ( responseControls.isEmpty() )
@@ -201,18 +234,27 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasResponseControls()
     {
         return ! responseControls.isEmpty();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int getResponseControlCount()
     {
         return responseControls.size();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void addRequestControls( Control[] requestControls )
     {
         for ( Control c : requestControls )
@@ -222,6 +264,9 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void setRequestControls( Map<String, Control> requestControls )
     {
         this.requestControls = requestControls;
@@ -294,6 +339,28 @@ public abstract class AbstractOperationC
     }
 
 
+    
+    
+    /**
+     * @return The number of the current interceptor in the list
+     */
+    public int getCurrentInterceptor()
+    {
+        return currentInterceptor;
+    }
+    
+    
+    /**
+     * Sets the current interceptor number to a new value.
+     * 
+     * @param currentInterceptor The new current interceptor value
+     */
+    public void setCurrentInterceptor( int currentInterceptor )
+    {
+        this.currentInterceptor = currentInterceptor;
+    }
+
+    
     /**
      * Sets the set of bypassed Interceptors.
      * 
@@ -372,6 +439,9 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
     {
         if ( lookupContext != next )
@@ -383,6 +453,9 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Entry lookup( Dn dn, Collection<String> byPassed ) throws LdapException
     {
         LookupOperationContext lookupContext = newLookupContext( dn );
@@ -391,6 +464,9 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Entry lookup( Dn dn, Collection<String> byPassed, String... attrIds ) throws LdapException
     {
         LookupOperationContext lookupContext = newLookupContext( dn );
@@ -400,6 +476,9 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void modify( Dn dn, List<Modification> mods, Collection<String> byPassed ) throws LdapException
     {
         ModifyOperationContext modifyContext = new ModifyOperationContext( session, dn, mods );
@@ -410,12 +489,20 @@ public abstract class AbstractOperationC
 
 
     // TODO - need synchronization here and where we update links
+    /**
+     * {@inheritDoc}
+     */
     public LookupOperationContext newLookupContext( Dn dn )
     {
         LookupOperationContext lookupContext = new LookupOperationContext( session, dn );
         setup( lookupContext );
         return lookupContext;
     }
+
+    
+    /**
+     * {@inheritDoc}
+     */
     public LdapPrincipal getEffectivePrincipal()
     {
         if ( authorizedPrincipal != null )
@@ -430,14 +517,18 @@ public abstract class AbstractOperationC
     // -----------------------------------------------------------------------
     // OperationContext Linked List Methods
     // -----------------------------------------------------------------------
-
-
+    /**
+     * {@inheritDoc}
+     */
     public boolean isFirstOperation()
     {
         return previous == null;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public OperationContext getFirstOperation()
     {
         if ( previous == null )
@@ -449,6 +540,9 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public OperationContext getLastOperation()
     {
         if ( next == null )
@@ -460,12 +554,18 @@ public abstract class AbstractOperationC
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public OperationContext getNextOperation()
     {
         return next;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected void setNextOperation( OperationContext next )
     {
         this.next = next;

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java?rev=1202927&r1=1202926&r2=1202927&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java Wed Nov 16 23:10:42 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;
 
@@ -43,11 +43,11 @@ import org.apache.directory.shared.ldap.
 public interface OperationContext
 {
     /**
-     * Checks to see if this operation is the first operation in a chain of 
-     * operations performed on the DirectoryService.  The first operation in  
-     * a sequence of operations, is not a byproduct of another operation 
-     * unlike operations following in the sequence.  The other operations 
-     * following the first, occur as a side effect to complete this first 
+     * Checks to see if this operation is the first operation in a chain of
+     * operations performed on the DirectoryService.  The first operation in
+     * a sequence of operations, is not a byproduct of another operation
+     * unlike operations following in the sequence.  The other operations
+     * following the first, occur as a side effect to complete this first
      * operation.
      * 
      * @return true if the operation is the first, false otherwise
@@ -58,7 +58,7 @@ public interface OperationContext
     /**
      * Gets the first, direct operation issued against the DirectoryService.
      *
-     * @return the first, direct operation issued 
+     * @return the first, direct operation issued
      */
     OperationContext getFirstOperation();
     
@@ -74,7 +74,7 @@ public interface OperationContext
     /**
      * Gets the next, indirect operation issued on the DirectoryService.
      *
-     * @return the next, indirect operation issued 
+     * @return the next, indirect operation issued
      */
     OperationContext getNextOperation();
     
@@ -85,12 +85,26 @@ public interface OperationContext
      * @return the last, operation issued
      */
     OperationContext getLastOperation();
+    
+    
+    /**
+     * @return The number of the current interceptor in the list
+     */
+    int getCurrentInterceptor();
+    
+    
+    /**
+     * Sets the current interceptor number to a new value.
+     * 
+     * @param currentInterceptor The new current interceptor value
+     */
+    void setCurrentInterceptor( int currentInterceptor );
 
 
     /**
-     * Gets the effective principal for this operation which may not be the 
+     * Gets the effective principal for this operation which may not be the
      * same as the authenticated principal when the session for this context
-     * has an explicit authorization id, or this operation was applied with 
+     * has an explicit authorization id, or this operation was applied with
      * the proxy authorization control.
      * 
      * @see CoreSession#getAuthenticatedPrincipal()
@@ -117,23 +131,23 @@ public interface OperationContext
     /**
      * Gets the server entry associated with the target Dn of this
      * OperationContext.  The entry associated with the Dn may be altered
-     * during the course of processing an LDAP operation through the 
+     * during the course of processing an LDAP operation through the
      * InterceptorChain.  This place holder is put here to prevent the need
      * for repetitive lookups of the target entry.  Furthermore the returned
      * entry may be altered by any Interceptor in the chain and this is why a
-     * ClonedServerEntry is returned instead of a Entry.  A 
+     * ClonedServerEntry is returned instead of a Entry.  A
      * ClonedServerEntry has an immutable reference to the original state of
      * the target entry.  The original state can be accessed via a call to
-     * {@link ClonedServerEntry#getOriginalEntry()}.  The return value may be 
-     * null in which case any lookup performed to access it may set it to 
+     * {@link ClonedServerEntry#getOriginalEntry()}.  The return value may be
+     * null in which case any lookup performed to access it may set it to
      * prevent the need for subsequent lookups.
      * 
-     * Also note that during the course of handling some operations such as 
+     * Also note that during the course of handling some operations such as
      * those that rename, move or rename and move the entry, may alter the Dn
      * of this entry.  Interceptor implementors should not presume the Dn or
-     * the values contained in this entry are currently what is present in the 
-     * DIT.  The original entry contained in the ClonedServerEntry shoudl be 
-     * used as the definitive source of information about the state of the 
+     * the values contained in this entry are currently what is present in the
+     * DIT.  The original entry contained in the ClonedServerEntry shoudl be
+     * used as the definitive source of information about the state of the
      * entry in the DIT before returning from the Partition subsystem.
      * 
      * @return target entry associated with the Dn of this OperationContext
@@ -158,7 +172,7 @@ public interface OperationContext
     void addResponseControl( Control responseControl );
     
     
-    /** 
+    /**
      * Checks to see if a response control is present on this operation.
      *
      * @param numericOid the numeric OID of the control also known as it's type OID
@@ -179,7 +193,7 @@ public interface OperationContext
     /**
      * Gets all the response controls producted during this operation.
      *
-     * @return an array over all the response controls 
+     * @return an array over all the response controls
      */
     Control[] getResponseControls();
     
@@ -208,7 +222,7 @@ public interface OperationContext
     void addRequestControl( Control requestControl );
     
     
-    /** 
+    /**
      * Checks to see if a request control is present on this request.
      *
      * @param numericOid the numeric OID of the control also known as it's type OID
@@ -273,7 +287,7 @@ public interface OperationContext
     Collection<String> getByPassed();
     
     /**
-     * Gets the next interceptor in the list of interceptors. The 
+     * Gets the next interceptor in the list of interceptors. The
      * position in the list will be incremented.
      * 
      * @return The next interceptor from the list of interceptors
@@ -331,7 +345,7 @@ public interface OperationContext
     /**
      * Process the delete for inner operations. This is only valid for SubschemaSubentry
      * operations, and will most certainly be removed later.
-     *  
+     * 
      * @param dn
      * @throws LdapException
      */

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java?rev=1202927&r1=1202926&r2=1202927&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java Wed Nov 16 23:10:42 2011
@@ -324,4 +324,17 @@ public class MockOperation implements Op
         // TODO Auto-generated method stub
         return "";
     }
+
+
+    @Override
+    public int getCurrentInterceptor()
+    {
+        return 0;
+    }
+
+
+    @Override
+    public void setCurrentInterceptor( int currentInterceptor )
+    {
+    }
 }

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=1202927&r1=1202926&r2=1202927&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 Wed Nov 16 23:10:42 2011
@@ -1375,7 +1375,7 @@ public class SchemaInterceptor extends B
             }
 
             modifyContext.setModItems( cleanMods );
-
+            
             // Now that the entry has been modified, update the SSSE
             schemaSubEntryManager.modifySchemaSubentry( modifyContext, modifyContext
                 .hasRequestControl( Cascade.OID ) );

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java?rev=1202927&r1=1202926&r2=1202927&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java (original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java Wed Nov 16 23:10:42 2011
@@ -22,10 +22,15 @@ package org.apache.directory.server.core
 
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.DnFactory;
+import org.apache.directory.server.core.api.InterceptorEnum;
+import org.apache.directory.server.core.api.OperationEnum;
+import org.apache.directory.server.core.api.interceptor.Interceptor;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.api.schema.DescriptionParsers;
 import org.apache.directory.server.i18n.I18n;
@@ -85,17 +90,17 @@ public class SchemaSubentryManager
     /** The description parsers */
     private final DescriptionParsers parsers;
     
-    /** 
-     * Maps the OID of a subschemaSubentry operational attribute to the index of 
+    /**
+     * Maps the OID of a subschemaSubentry operational attribute to the index of
      * the handler in the schemaObjectHandlers array.
-     */ 
+     */
     private final Map<String, Integer> opAttr2handlerIndex = new HashMap<String, Integer>( 11 );
     private static final String CASCADING_ERROR =
             "Cascading has not yet been implemented: standard operation is in effect.";
 
     private static AttributeType ENTRY_CSN_ATTRIBUTE_TYPE;
     
-    static 
+    static
     {
         VALID_OU_VALUES.add( Strings.toLowerCase( SchemaConstants.NORMALIZERS_AT ) );
         VALID_OU_VALUES.add( Strings.toLowerCase( SchemaConstants.COMPARATORS_AT ) );
@@ -155,11 +160,77 @@ public class SchemaSubentryManager
     }
 
     
-    /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#modifySchemaSubentry(org.apache.directory.server.core.interceptor.context.ModifyOperationContext, org.apache.directory.server.core.entry.Entry, org.apache.directory.server.core.entry.Entry, boolean)
+
+    private Interceptor findNextInterceptor( OperationEnum operation, DirectoryService directoryService )
+    {
+        Interceptor interceptor = null;
+        
+        List<Interceptor> allInterceptors = directoryService.getInterceptors();
+        List<String> operationInterceptors = directoryService.getInterceptors( operation );
+        int position = 0;
+        String addInterceptor = operationInterceptors.get( position );
+        
+        for ( Interceptor inter : allInterceptors )
+        {
+            String interName = inter.getName();
+            
+            if ( interName.equals( InterceptorEnum.SCHEMA_INTERCEPTOR.getName() ) )
+            {
+                // Found, get out
+                position++;
+                
+                if ( position < operationInterceptors.size() )
+                {
+                    interceptor = directoryService.getInterceptor( operationInterceptors.get( position ) );
+                }
+                
+                break;
+            }
+            
+            if ( interName.equals( addInterceptor ) )
+            {
+                position++;
+                addInterceptor = operationInterceptors.get( position );
+            }
+        }
+        
+        return interceptor;
+    }
+    
+    
+    private int findPosition( OperationEnum operation, Interceptor interceptor, DirectoryService directoryService )
+    {
+        int position = 1;
+        
+        List<String> interceptors = directoryService.getInterceptors( operation );
+        
+        String interceptorName = interceptor.getName();
+        
+        for ( String name : interceptors )
+        {
+            if ( name.equals( interceptorName ) )
+            {
+                break;
+            }
+            
+            position++;
+        }
+        
+        return position;
+    }
+    
+    
+    /**
+     * @TODO
      */
-    public void modifySchemaSubentry( ModifyOperationContext modifyContext, boolean doCascadeModify ) throws LdapException 
+    public void modifySchemaSubentry( ModifyOperationContext modifyContext, boolean doCascadeModify ) throws LdapException
     {
+        DirectoryService directoryService = modifyContext.getSession().getDirectoryService();
+        Interceptor nextAdd = findNextInterceptor( OperationEnum.ADD, directoryService );
+        int positionAdd = findPosition( OperationEnum.ADD, nextAdd, directoryService );
+        Interceptor nextDelete = findNextInterceptor( OperationEnum.DELETE, directoryService );
+        int positionDelete = findPosition( OperationEnum.DELETE, nextDelete, directoryService );
+
         for ( Modification mod : modifyContext.getModItems() )
         {
             String opAttrOid = schemaManager.getAttributeTypeRegistry().getOidByName( mod.getAttribute().getId() );
@@ -169,12 +240,12 @@ public class SchemaSubentryManager
             switch ( mod.getOperation() )
             {
                 case ADD_ATTRIBUTE :
-                    modifyAddOperation( modifyContext, opAttrOid, serverAttribute, doCascadeModify );
+                    modifyAddOperation( nextAdd, positionAdd, modifyContext, opAttrOid, serverAttribute, doCascadeModify );
                     break;
                     
                 case REMOVE_ATTRIBUTE :
-                    modifyRemoveOperation( modifyContext, opAttrOid, serverAttribute );
-                    break; 
+                    modifyRemoveOperation( nextDelete, positionDelete, modifyContext, opAttrOid, serverAttribute );
+                    break;
                     
                 case REPLACE_ATTRIBUTE :
                     // a hack to allow entryCSN modification
@@ -194,7 +265,7 @@ public class SchemaSubentryManager
     
     
     /**
-     * Handles the modify remove operation on the subschemaSubentry for schema entities. 
+     * Handles the modify remove operation on the subschemaSubentry for schema entities.
      * 
      * @param opAttrOid the numeric id of the operational attribute modified
      * @param mods the attribute with the modifications
@@ -202,7 +273,7 @@ public class SchemaSubentryManager
      * @throws Exception if there are problems updating the registries and the
      * schema partition
      */
-    private void modifyRemoveOperation( ModifyOperationContext modifyContext, String opAttrOid, 
+    private void modifyRemoveOperation( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, String opAttrOid,
         Attribute mods ) throws LdapException
     {
         int index = opAttr2handlerIndex.get( opAttrOid );
@@ -214,15 +285,17 @@ public class SchemaSubentryManager
                 
                 for ( LdapComparatorDescription comparatorDescription : comparatorDescriptions )
                 {
-                    subentryModifier.delete( modifyContext, comparatorDescription );
+                    subentryModifier.delete( nextInterceptor, position, modifyContext, comparatorDescription );
                 }
+                
                 break;
+                
             case( NORMALIZER_INDEX ):
                 NormalizerDescription[] normalizerDescriptions = parsers.parseNormalizers( mods );
                 
                 for ( NormalizerDescription normalizerDescription : normalizerDescriptions )
                 {
-                    subentryModifier.delete( modifyContext, normalizerDescription );
+                    subentryModifier.delete( nextInterceptor, position, modifyContext, normalizerDescription );
                 }
                 
                 break;
@@ -232,7 +305,7 @@ public class SchemaSubentryManager
                 
                 for ( SyntaxCheckerDescription syntaxCheckerDescription : syntaxCheckerDescriptions )
                 {
-                    subentryModifier.delete( modifyContext, syntaxCheckerDescription );
+                    subentryModifier.delete( nextInterceptor, position, modifyContext, syntaxCheckerDescription );
                 }
                 
                 break;
@@ -242,7 +315,7 @@ public class SchemaSubentryManager
                 
                 for ( LdapSyntax syntax : syntaxes )
                 {
-                    subentryModifier.deleteSchemaObject( modifyContext, syntax );
+                    subentryModifier.deleteSchemaObject( nextInterceptor, position, modifyContext, syntax );
                 }
                 
                 break;
@@ -252,7 +325,7 @@ public class SchemaSubentryManager
                 
                 for ( MatchingRule mr : mrs )
                 {
-                    subentryModifier.deleteSchemaObject( modifyContext, mr );
+                    subentryModifier.deleteSchemaObject( nextInterceptor, position, modifyContext, mr );
                 }
                 
                 break;
@@ -262,7 +335,7 @@ public class SchemaSubentryManager
                 
                 for ( AttributeType at : ats )
                 {
-                    subentryModifier.deleteSchemaObject( modifyContext, at );
+                    subentryModifier.deleteSchemaObject( nextInterceptor, position, modifyContext, at );
                 }
                 
                 break;
@@ -272,7 +345,7 @@ public class SchemaSubentryManager
 
                 for ( ObjectClass oc : ocs )
                 {
-                    subentryModifier.deleteSchemaObject( modifyContext, oc );
+                    subentryModifier.deleteSchemaObject( nextInterceptor, position, modifyContext, oc );
                 }
                 
                 break;
@@ -282,7 +355,7 @@ public class SchemaSubentryManager
                 
                 for ( MatchingRuleUse mru : mrus )
                 {
-                    subentryModifier.deleteSchemaObject( modifyContext, mru );
+                    subentryModifier.deleteSchemaObject( nextInterceptor, position, modifyContext, mru );
                 }
                 
                 break;
@@ -292,7 +365,7 @@ public class SchemaSubentryManager
                 
                 for ( DITStructureRule dsr : dsrs )
                 {
-                    subentryModifier.deleteSchemaObject( modifyContext, dsr );
+                    subentryModifier.deleteSchemaObject( nextInterceptor, position, modifyContext, dsr );
                 }
                 
                 break;
@@ -302,7 +375,7 @@ public class SchemaSubentryManager
                 
                 for ( DITContentRule dcr : dcrs )
                 {
-                    subentryModifier.deleteSchemaObject( modifyContext, dcr );
+                    subentryModifier.deleteSchemaObject( nextInterceptor, position, modifyContext, dcr );
                 }
                 
                 break;
@@ -312,7 +385,7 @@ public class SchemaSubentryManager
                 
                 for ( NameForm nf : nfs )
                 {
-                    subentryModifier.deleteSchemaObject( modifyContext, nf );
+                    subentryModifier.deleteSchemaObject( nextInterceptor, position, modifyContext, nf );
                 }
                 
                 break;
@@ -324,7 +397,7 @@ public class SchemaSubentryManager
     
     
     /**
-     * Handles the modify add operation on the subschemaSubentry for schema entities. 
+     * Handles the modify add operation on the subschemaSubentry for schema entities.
      * 
      * @param opAttrOid the numeric id of the operational attribute modified
      * @param mods the attribute with the modifications
@@ -333,7 +406,7 @@ public class SchemaSubentryManager
      * @throws Exception if there are problems updating the registries and the
      * schema partition
      */
-    private void modifyAddOperation( ModifyOperationContext modifyContext, String opAttrOid, 
+    private void modifyAddOperation( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, String opAttrOid,
         Attribute mods, boolean doCascadeModify ) throws LdapException
     {
         if ( doCascadeModify )
@@ -350,7 +423,7 @@ public class SchemaSubentryManager
                 
                 for ( LdapComparatorDescription comparatorDescription : comparatorDescriptions )
                 {
-                    subentryModifier.add( modifyContext, comparatorDescription );
+                    subentryModifier.add( nextInterceptor, position, modifyContext, comparatorDescription );
                 }
                 
                 break;
@@ -360,7 +433,7 @@ public class SchemaSubentryManager
                 
                 for ( NormalizerDescription normalizerDescription : normalizerDescriptions )
                 {
-                    subentryModifier.add( modifyContext, normalizerDescription );
+                    subentryModifier.add( nextInterceptor, position, modifyContext, normalizerDescription );
                 }
                 
                 break;
@@ -370,7 +443,7 @@ public class SchemaSubentryManager
                 
                 for ( SyntaxCheckerDescription syntaxCheckerDescription : syntaxCheckerDescriptions )
                 {
-                    subentryModifier.add( modifyContext, syntaxCheckerDescription );
+                    subentryModifier.add( nextInterceptor, position, modifyContext, syntaxCheckerDescription );
                 }
                 
                 break;
@@ -380,7 +453,7 @@ public class SchemaSubentryManager
                 
                 for ( LdapSyntax syntax : syntaxes )
                 {
-                    subentryModifier.addSchemaObject( modifyContext, syntax );
+                    subentryModifier.addSchemaObject( nextInterceptor, position, modifyContext, syntax );
                 }
                 
                 break;
@@ -390,7 +463,7 @@ public class SchemaSubentryManager
                 
                 for ( MatchingRule mr : mrs )
                 {
-                    subentryModifier.addSchemaObject( modifyContext, mr );
+                    subentryModifier.addSchemaObject( nextInterceptor, position, modifyContext, mr );
                 }
                 
                 break;
@@ -400,7 +473,7 @@ public class SchemaSubentryManager
                 
                 for ( AttributeType at : ats )
                 {
-                    subentryModifier.addSchemaObject( modifyContext, at );
+                    subentryModifier.addSchemaObject( nextInterceptor, position, modifyContext, at );
                 }
                 
                 break;
@@ -410,7 +483,7 @@ public class SchemaSubentryManager
 
                 for ( ObjectClass oc : ocs )
                 {
-                    subentryModifier.addSchemaObject( modifyContext, oc );
+                    subentryModifier.addSchemaObject( nextInterceptor, position, modifyContext, oc );
                 }
                 
                 break;
@@ -420,7 +493,7 @@ public class SchemaSubentryManager
                 
                 for ( MatchingRuleUse mru : mrus )
                 {
-                    subentryModifier.addSchemaObject( modifyContext, mru );
+                    subentryModifier.addSchemaObject( nextInterceptor, position, modifyContext, mru );
                 }
                 
                 break;
@@ -430,7 +503,7 @@ public class SchemaSubentryManager
                 
                 for ( DITStructureRule dsr : dsrs )
                 {
-                    subentryModifier.addSchemaObject( modifyContext, dsr );
+                    subentryModifier.addSchemaObject( nextInterceptor, position, modifyContext, dsr );
                 }
                 
                 break;
@@ -440,7 +513,7 @@ public class SchemaSubentryManager
                 
                 for ( DITContentRule dcr : dcrs )
                 {
-                    subentryModifier.addSchemaObject( modifyContext, dcr );
+                    subentryModifier.addSchemaObject( nextInterceptor, position, modifyContext, dcr );
                 }
                 
                 break;
@@ -450,7 +523,7 @@ public class SchemaSubentryManager
                 
                 for ( NameForm nf : nfs )
                 {
-                    subentryModifier.addSchemaObject( modifyContext, nf );
+                    subentryModifier.addSchemaObject( nextInterceptor, position, modifyContext, nf );
                 }
                 
                 break;

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=1202927&r1=1202926&r2=1202927&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Wed Nov 16 23:10:42 2011
@@ -20,14 +20,11 @@
 package org.apache.directory.server.core.schema;
 
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.directory.server.core.api.DnFactory;
-import org.apache.directory.server.core.api.InterceptorEnum;
-import org.apache.directory.server.core.api.interceptor.context.OperationContext;
+import org.apache.directory.server.core.api.interceptor.Interceptor;
+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.ModifyOperationContext;
 import org.apache.directory.shared.ldap.model.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -60,19 +57,6 @@ import org.apache.directory.shared.util.
  */
 public class SchemaSubentryModifier
 {
-    private static final Collection<String> BYPASS;
-    
-    static
-    {
-        Set<String> c = new HashSet<String>();
-        c.add( InterceptorEnum.AUTHENTICATION_INTERCEPTOR.getName() );
-        c.add( InterceptorEnum.ACI_AUTHORIZATION_INTERCEPTOR.getName() );
-        c.add( InterceptorEnum.DEFAULT_AUTHORIZATION_INTERCEPTOR.getName() );
-        c.add( InterceptorEnum.EXCEPTION_INTERCEPTOR.getName() );
-        c.add( InterceptorEnum.SCHEMA_INTERCEPTOR.getName() );
-        BYPASS = Collections.unmodifiableCollection( c );
-    }
-    
     private AttributesFactory factory = new AttributesFactory();
 
     /** The server schemaManager */
@@ -139,7 +123,7 @@ public class SchemaSubentryModifier
     }
     
 
-    public void add( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws LdapException
+    public void add( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, LdapComparatorDescription comparatorDescription ) throws LdapException
     {
         String schemaName = getSchema( comparatorDescription );
         Dn dn = dnFactory.create(
@@ -150,11 +134,14 @@ public class SchemaSubentryModifier
         
         Entry entry = getEntry( dn, comparatorDescription );
 
-        opContext.add( entry, BYPASS );
+        AddOperationContext addContext = new AddOperationContext( modifyContext.getSession(), entry );
+        addContext.setCurrentInterceptor( position );
+
+        nextInterceptor.add( addContext );
     }
     
     
-    public void add( OperationContext opContext, NormalizerDescription normalizerDescription ) throws LdapException
+    public void add( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, NormalizerDescription normalizerDescription ) throws LdapException
     {
         String schemaName = getSchema( normalizerDescription );
         Dn dn = dnFactory.create(
@@ -165,11 +152,14 @@ public class SchemaSubentryModifier
         
         Entry entry = getEntry( dn, normalizerDescription );
 
-        opContext.add( entry, BYPASS );
+        AddOperationContext addContext = new AddOperationContext( modifyContext.getSession(), entry );
+        addContext.setCurrentInterceptor( position );
+
+        nextInterceptor.add( addContext );
     }
     
     
-    public void add( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws LdapException
+    public void add( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws LdapException
     {
         String schemaName = getSchema( syntaxCheckerDescription );
         Dn dn = dnFactory.create(
@@ -179,29 +169,41 @@ public class SchemaSubentryModifier
             SchemaConstants.OU_SCHEMA );
         
         Entry entry = getEntry( dn, syntaxCheckerDescription );
-        opContext.add( entry, BYPASS );
+
+        AddOperationContext addContext = new AddOperationContext( modifyContext.getSession(), entry );
+        addContext.setCurrentInterceptor( position );
+
+        nextInterceptor.add( addContext );
     }
     
     
-    public void addSchemaObject( OperationContext opContext, SchemaObject obj ) throws LdapException
+    public void addSchemaObject( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, SchemaObject obj ) throws LdapException
     {
         Schema schema = schemaManager.getLoadedSchema( obj.getSchemaName() );
         Dn dn = getDn( obj );
         Entry entry = factory.getAttributes( obj, schema, schemaManager );
         entry.setDn( dn );
+        
+        AddOperationContext addContext = new AddOperationContext( modifyContext.getSession(), entry );
+        addContext.setCurrentInterceptor( position );
 
-        opContext.add( entry, BYPASS );
+        nextInterceptor.add( addContext );
     }
 
 
-    public void deleteSchemaObject( OperationContext opContext, SchemaObject obj ) throws LdapException
+    public void deleteSchemaObject( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, SchemaObject obj ) throws LdapException
     {
         Dn dn = getDn( obj );
-        opContext.delete( dn );
+
+        DeleteOperationContext deleteContext = new DeleteOperationContext( modifyContext.getSession(), dn );
+        deleteContext.setEntry( modifyContext.getSession().lookup( dn ) );
+        deleteContext.setCurrentInterceptor( position );
+
+        nextInterceptor.delete( deleteContext );
     }
 
     
-    public void delete( OperationContext opContext, NormalizerDescription normalizerDescription ) throws LdapException
+    public void delete( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, NormalizerDescription normalizerDescription ) throws LdapException
     {
         String schemaName = getSchema( normalizerDescription );
         Dn dn = dnFactory.create(
@@ -210,11 +212,15 @@ public class SchemaSubentryModifier
             "cn=" + schemaName,
             SchemaConstants.OU_SCHEMA );
         
-        opContext.delete( dn );
+        DeleteOperationContext deleteContext = new DeleteOperationContext( modifyContext.getSession(), dn );
+        deleteContext.setEntry( modifyContext.getSession().lookup( dn ) );
+        deleteContext.setCurrentInterceptor( position );
+
+        nextInterceptor.delete( deleteContext );
     }
 
 
-    public void delete( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws LdapException
+    public void delete( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws LdapException
     {
         String schemaName = getSchema( syntaxCheckerDescription );
         Dn dn = dnFactory.create(
@@ -222,11 +228,16 @@ public class SchemaSubentryModifier
             SchemaConstants.SYNTAX_CHECKERS_PATH,
             "cn=" + schemaName,
             SchemaConstants.OU_SCHEMA );
-        opContext.delete( dn );
+
+        DeleteOperationContext deleteContext = new DeleteOperationContext( modifyContext.getSession(), dn );
+        deleteContext.setEntry( modifyContext.getSession().lookup( dn ) );
+        deleteContext.setCurrentInterceptor( position );
+
+        nextInterceptor.delete( deleteContext );
     }
 
 
-    public void delete( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws LdapException
+    public void delete( Interceptor nextInterceptor, int position, ModifyOperationContext modifyContext, LdapComparatorDescription comparatorDescription ) throws LdapException
     {
         String schemaName = getSchema( comparatorDescription );
         Dn dn = dnFactory.create(
@@ -235,7 +246,11 @@ public class SchemaSubentryModifier
             "cn=" + schemaName,
             SchemaConstants.OU_SCHEMA );
         
-        opContext.delete( dn );
+        DeleteOperationContext deleteContext = new DeleteOperationContext( modifyContext.getSession(), dn );
+        deleteContext.setEntry( modifyContext.getSession().lookup( dn ) );
+        deleteContext.setCurrentInterceptor( position );
+
+        nextInterceptor.delete( deleteContext );
     }