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

svn commit: r663834 - in /directory/apacheds/branches/bigbang/core/src: main/java/org/apache/directory/server/core/changelog/ main/java/org/apache/directory/server/core/interceptor/context/ main/java/org/apache/directory/server/core/schema/ test/java/o...

Author: akarasulu
Date: Thu Jun  5 23:17:46 2008
New Revision: 663834

URL: http://svn.apache.org/viewvc?rev=663834&view=rev
Log:
adding add() delete() operations onto AbstractOperation for simplifying code in interceptors

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Thu Jun  5 23:17:46 2008
@@ -85,12 +85,13 @@
     // -----------------------------------------------------------------------
     // Overridden (only change inducing) intercepted methods
     // -----------------------------------------------------------------------
+    
 
     public void add( NextInterceptor next, AddOperationContext opContext ) throws Exception
     {
         next.add( opContext );
 
-        if ( ! changeLog.isEnabled() || opContext.isCollateralOperation() )
+        if ( ! changeLog.isEnabled() || ! opContext.isFirstOperation() )
         {
             return;
         }
@@ -123,14 +124,14 @@
         // must save the entry if change log is enabled
         ServerEntry serverEntry = null;
 
-        if ( changeLog.isEnabled() && ! opContext.isCollateralOperation() )
+        if ( changeLog.isEnabled() && opContext.isFirstOperation() )
         {
             serverEntry = getAttributes( opContext );
         }
 
         next.delete( opContext );
 
-        if ( ! changeLog.isEnabled() || opContext.isCollateralOperation() )
+        if ( ! changeLog.isEnabled() || ! opContext.isFirstOperation() )
         {
             return;
         }
@@ -175,7 +176,7 @@
         Modification modification = ServerEntryUtils.getModificationItem( opContext.getModItems(), entryDeleted );
         boolean isDelete = ( modification != null );
 
-        if ( ! isDelete && ( changeLog.isEnabled() && ! opContext.isCollateralOperation() ) )
+        if ( ! isDelete && ( changeLog.isEnabled() && opContext.isFirstOperation() ) )
         {
             // @todo make sure we're not putting in operational attributes that cannot be user modified
             serverEntry = getAttributes( opContext );
@@ -185,7 +186,7 @@
 
         // @TODO: needs big consideration!!!
         // NOTE: perhaps we need to log this as a system operation that cannot and should not be reapplied?
-        if ( isDelete || ! changeLog.isEnabled() || opContext.isCollateralOperation() )
+        if ( isDelete || ! changeLog.isEnabled() || ! opContext.isFirstOperation() )
         {
             if ( isDelete )
             {
@@ -221,7 +222,7 @@
     {
         ServerEntry serverEntry = null;
         
-        if ( changeLog.isEnabled() && ! renameContext.isCollateralOperation() )
+        if ( changeLog.isEnabled() && renameContext.isFirstOperation() )
         {
             // @todo make sure we're not putting in operational attributes that cannot be user modified
             serverEntry = getAttributes( renameContext );
@@ -229,7 +230,7 @@
 
         next.rename( renameContext );
 
-        if ( ! changeLog.isEnabled() || renameContext.isCollateralOperation() )
+        if ( ! changeLog.isEnabled() || ! renameContext.isFirstOperation() )
         {
             return;
         }
@@ -251,7 +252,7 @@
     {
         ClonedServerEntry serverEntry = null;
         
-        if ( changeLog.isEnabled() && ! opCtx.isCollateralOperation() )
+        if ( changeLog.isEnabled() && opCtx.isFirstOperation() )
         {
             // @todo make sure we're not putting in operational attributes that cannot be user modified
             serverEntry = opCtx.lookup( opCtx.getDn(), ByPassConstants.LOOKUP_BYPASS );
@@ -259,7 +260,7 @@
 
         next.moveAndRename( opCtx );
 
-        if ( ! changeLog.isEnabled() || opCtx.isCollateralOperation() )
+        if ( ! changeLog.isEnabled() || ! opCtx.isFirstOperation() )
         {
             return;
         }
@@ -281,7 +282,7 @@
     {
         next.move( opCtx );
 
-        if ( ! changeLog.isEnabled() || opCtx.isCollateralOperation() )
+        if ( ! changeLog.isEnabled() || ! opCtx.isFirstOperation() )
         {
             return;
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java Thu Jun  5 23:17:46 2008
@@ -23,6 +23,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.naming.ldap.Control;
@@ -30,6 +31,8 @@
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -53,11 +56,8 @@
     /** The associated response's controls */
     private Map<String, Control> responseControls = new HashMap<String, Control>(4);
 
-    /** A flag to tell that this is a collateral operation */
-    private boolean collateralOperation;
-    
     /** the Interceptors bypassed by this operation */
-    private Collection<String> bypassed;
+    private Collection<String> byPassed;
     
     private LdapPrincipal authorizedPrincipal;
     
@@ -89,33 +89,6 @@
     }
 
 
-    /**
-     * Creates a new instance of AbstractOperationContext.
-     *
-     * @param dn the associated DN
-     * @param collateralOperation true if op is collateral, false otherwise
-     */
-    public AbstractOperationContext( CoreSession session, LdapDN dn, boolean collateralOperation )
-    {
-        this.dn = dn;
-        this.session = session;
-        this.collateralOperation = collateralOperation;
-    }
-
-
-    /**
-     * Creates an operation context where the operation is considered a side
-     * effect of a direct operation.
-     *
-     * @param collateralOperation true if this is a side effect operation
-     */
-    public AbstractOperationContext( CoreSession session, boolean collateralOperation )
-    {
-        this.session = session;
-        this.collateralOperation = collateralOperation;
-    }
-    
-    
     public CoreSession getSession()
     {
         return session;
@@ -126,21 +99,11 @@
     {
         this.session = session;
     }
-
-
-    /**
-     * Tells if the current operation is considered a side effect of the
-     * current context
-     */
-    public boolean isCollateralOperation()
-    {
-        return collateralOperation;
-    }
-
-
-    public void setCollateralOperation( boolean collateralOperation )
+    
+    
+    protected void setAuthorizedPrincipal( LdapPrincipal authorizedPrincipal )
     {
-        this.collateralOperation = collateralOperation;
+        this.authorizedPrincipal = authorizedPrincipal;
     }
 
 
@@ -251,12 +214,12 @@
      */
     public Collection<String> getByPassed()
     {
-        if ( bypassed == null )
+        if ( byPassed == null )
         {
             return Collections.emptyList();
         }
         
-        return Collections.unmodifiableCollection( bypassed );
+        return Collections.unmodifiableCollection( byPassed );
     }
     
     
@@ -267,7 +230,7 @@
      */
     public void setByPassed( Collection<String> byPassed )
     {
-        this.bypassed = byPassed;
+        this.byPassed = byPassed;
     }
 
     
@@ -279,7 +242,7 @@
      */
     public boolean isBypassed( String interceptorName )
     {
-        return bypassed != null && bypassed.contains( interceptorName );
+        return byPassed != null && byPassed.contains( interceptorName );
     }
 
 
@@ -290,18 +253,61 @@
      */
     public boolean hasBypass()
     {
-        return bypassed != null && !bypassed.isEmpty();
+        return byPassed != null && !byPassed.isEmpty();
     }
+
     
+    private void setup( AbstractOperationContext opContext )
+    {
+        opContext.setPreviousOperation( this );
+        next = opContext;
+        opContext.setByPassed( byPassed );
+        opContext.setAuthorizedPrincipal( authorizedPrincipal );
+    }
+    
+    
+    public void add( ServerEntry entry, Collection<String> byPassed ) throws Exception
+    {
+        AddOperationContext opContext = new AddOperationContext( session, entry );
+        setup( opContext );
+        opContext.setByPassed( byPassed );
+        session.getDirectoryService().getOperationManager().add( opContext );
+    }
     
+    
+    public void delete( LdapDN dn, Collection<String> byPassed ) throws Exception
+    {
+        DeleteOperationContext opContext = new DeleteOperationContext( session, dn );
+        setup( opContext );
+        opContext.setByPassed( byPassed );
+        session.getDirectoryService().getOperationManager().delete( opContext );
+    }
+    
+    
+    public void modify( LdapDN dn, List<Modification> mods, Collection<String> byPassed ) throws Exception
+    {
+        ModifyOperationContext opContext = new ModifyOperationContext( session, dn, mods );
+        setup( opContext );
+        opContext.setByPassed( byPassed );
+        session.getDirectoryService().getOperationManager().modify( opContext );
+    }
+    
+    
+    // TODO - need synchronization here and where we update links
     public LookupOperationContext newLookupContext( LdapDN dn )
     {
-        return new LookupOperationContext( session, dn );
+        LookupOperationContext opContext = new LookupOperationContext( session, dn );
+        setup( opContext );
+        return opContext;
     }
 
 
     public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
     {
+        if ( opContext != next )
+        {
+            throw new IllegalStateException( "Cannot execute indirect lookup if it is not the next operation." );
+        }
         return session.getDirectoryService().getOperationManager().lookup( opContext );
     }
 
@@ -364,8 +370,20 @@
     }
     
     
+    protected void setNextOperation( OperationContext next )
+    {
+        this.next = next;
+    }
+    
+    
     public OperationContext getPreviousOperation()
     {
         return previous;
     }
+    
+    
+    protected void setPreviousOperation( OperationContext previous )
+    {
+        this.previous = previous;
+    }
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java Thu Jun  5 23:17:46 2008
@@ -68,38 +68,15 @@
 
 
     /**
-     * Creates a new instance of AddOperationContext.
-     *
-     * @param collateralOperation whether or not this is a side-effect
-     */
-    public AddOperationContext( CoreSession session, boolean collateralOperation )
-    {
-        super( session, collateralOperation );
-    }
-
-
-    /**
-     * Creates a new instance of AddOperationContext.
-     *
-     * @param dn the name of the entry being added
-     * @param collateralOperation whether or not this is a side-effect
-     */
-    public AddOperationContext( CoreSession session, LdapDN dn, boolean collateralOperation )
-    {
-        super( session, dn, collateralOperation );
-    }
-
-
-    /**
      * Creates a new instance of ModifyOperationContext.
      *
      * @param dn the name of the entry being added
      * @param entry the entry being added
      * @param collateralOperation whether or not this is a side-effect
      */
-    public AddOperationContext( CoreSession session, LdapDN dn, ServerEntry entry, boolean collateralOperation )
+    public AddOperationContext( CoreSession session, LdapDN dn, ServerEntry entry )
     {
-        super( session, dn, collateralOperation );
+        super( session, dn );
         this.entry = entry;
     }
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java Thu Jun  5 23:17:46 2008
@@ -23,13 +23,17 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.naming.ldap.Control;
 
+import org.apache.commons.lang.NotImplementedException;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -406,4 +410,22 @@
     {
         return previous;
     }
+
+
+    public void add( ServerEntry entry, Collection<String> bypass ) throws Exception
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public void delete( LdapDN dn, Collection<String> bypass ) throws Exception
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public void modify( LdapDN dn, List<Modification> mods, Collection<String> bypass ) throws Exception
+    {
+        throw new NotImplementedException();
+    }
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java Thu Jun  5 23:17:46 2008
@@ -46,17 +46,6 @@
     /**
      * Creates a new instance of DeleteOperationContext.
      *
-     * @param collateralOperation true if this is a side effect operation
-     */
-    public DeleteOperationContext( CoreSession session, boolean collateralOperation )
-    {
-        super( session, collateralOperation );
-    }
-
-
-    /**
-     * Creates a new instance of DeleteOperationContext.
-     *
      * @param deleteDn The entry DN to delete
      */
     public DeleteOperationContext( CoreSession session, LdapDN deleteDn )
@@ -66,18 +55,6 @@
 
 
     /**
-     * Creates a new instance of DeleteOperationContext.
-     *
-     * @param deleteDn The entry DN to delete
-     * @param collateralOperation true if this is a side effect operation
-     */
-    public DeleteOperationContext( CoreSession session, LdapDN deleteDn, boolean collateralOperation )
-    {
-        super( session, deleteDn, collateralOperation );
-    }
-
-
-    /**
      * @return the operation name
      */
     public String getName()

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Thu Jun  5 23:17:46 2008
@@ -73,21 +73,6 @@
 
 
     /**
-     * Creates a new instance of ModifyOperationContext.
-     *
-     * @param dn the dn of the entry to be modified
-     * @param modItems the modifications to be performed on the entry
-     * @param collateralOperation true if op is collateral, false otherwise
-     */
-    public ModifyOperationContext( CoreSession session, LdapDN dn, 
-        List<Modification> modItems, boolean collateralOperation )
-    {
-        super( session, dn, collateralOperation );
-        this.modItems = modItems;
-    }
-
-
-    /**
      * Set the modified attributes
      * @param modItems The modified attributes
      */

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java Thu Jun  5 23:17:46 2008
@@ -21,6 +21,7 @@
 
 
 import java.util.Collection;
+import java.util.List;
 
 import javax.naming.ldap.Control;
 
@@ -28,6 +29,7 @@
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -265,11 +267,17 @@
     ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception;
     
     
+    void modify( LdapDN dn, List<Modification> mods, Collection<String> bypass ) throws Exception;
+    
+    
+    void add( ServerEntry entry, Collection<String> bypass ) throws Exception;
+    
+    
+    void delete( LdapDN dn, Collection<String> bypass ) throws Exception;
+    
+    
 //    AddOperationContext newAddContext( ServerEntry entry );
-//    
-//    
-//    void add( ServerEntry entry, Collection<String> bypass ) throws Exception;
-//    
-//    
+    
+    
 //    void add( AddOperationContext addContext ) throws Exception;
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Thu Jun  5 23:17:46 2008
@@ -960,8 +960,6 @@
         LdapDN name = new LdapDN( "cn=schemaModifications,ou=schema" );
         name.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
         
-        ModifyOperationContext modifyContext = new ModifyOperationContext( opContext.getSession(), name, mods, true );
-        modifyContext.setByPassed( SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().modify( modifyContext );
+        opContext.modify( name, mods, SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
     }
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Thu Jun  5 23:17:46 2008
@@ -35,8 +35,6 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.referral.ReferralInterceptor;
 import org.apache.directory.server.schema.bootstrap.Schema;
@@ -151,9 +149,7 @@
         ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, 
             opContext.getSession().getDirectoryService().getRegistries() );
 
-        AddOperationContext addContext = new AddOperationContext( opContext.getSession(), dn, entry, true );
-        addContext.setByPassed( BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().add( addContext );
+        opContext.add( entry, BYPASS );
     }
     
     
@@ -166,9 +162,7 @@
         ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, 
             opContext.getSession().getDirectoryService().getRegistries() );
 
-        AddOperationContext addContext = new AddOperationContext( opContext.getSession(), dn, entry, true );
-        addContext.setByPassed( BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().add( addContext );
+        opContext.add( entry, BYPASS );
     }
     
     
@@ -180,9 +174,7 @@
         Attributes attrs = getAttributes( syntaxCheckerDescription );
         ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, 
             opContext.getSession().getDirectoryService().getRegistries() );
-        AddOperationContext addContext = new AddOperationContext( opContext.getSession(), dn, entry, true );
-        addContext.setByPassed( BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().add( addContext );
+        opContext.add( entry, BYPASS );
     }
     
     
@@ -194,18 +186,14 @@
             opContext.getSession().getDirectoryService().getRegistries() );
         entry.setDn( dn );
 
-        AddOperationContext addContext = new AddOperationContext( opContext.getSession(), dn, entry, true );
-        addContext.setByPassed( BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().add( addContext );
+        opContext.add( entry, BYPASS );
     }
 
 
     public void deleteSchemaObject( OperationContext opContext, SchemaObject obj ) throws Exception
     {
         LdapDN dn = getDn( obj );
-        DeleteOperationContext delContext = new DeleteOperationContext( opContext.getSession(), dn, true );
-        delContext.setByPassed( BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().delete( delContext );
+        opContext.delete( dn, BYPASS );
     }
 
     
@@ -214,9 +202,7 @@
         String schemaName = getSchema( normalizerDescription );
         LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn=" 
             + schemaName + ",ou=schema" );
-        DeleteOperationContext delContext = new DeleteOperationContext( opContext.getSession(), dn, true );
-        delContext.setByPassed( BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().delete( delContext );
+        opContext.delete( dn, BYPASS );
     }
 
 
@@ -225,9 +211,7 @@
         String schemaName = getSchema( syntaxCheckerDescription );
         LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn=" 
             + schemaName + ",ou=schema" );
-        DeleteOperationContext delContext = new DeleteOperationContext( opContext.getSession(), dn, true );
-        delContext.setByPassed( BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().delete( delContext );
+        opContext.delete( dn, BYPASS );
     }
 
 
@@ -236,9 +220,7 @@
         String schemaName = getSchema( comparatorDescription );
         LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn=" 
             + schemaName + ",ou=schema" );
-        DeleteOperationContext delContext = new DeleteOperationContext( opContext.getSession(), dn, true );
-        delContext.setByPassed( BYPASS );
-        opContext.getSession().getDirectoryService().getOperationManager().delete( delContext );
+        opContext.delete( dn, BYPASS );
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=663834&r1=663833&r2=663834&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Thu Jun  5 23:17:46 2008
@@ -65,6 +65,7 @@
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
 import org.apache.directory.shared.ldap.aci.UserClass;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
@@ -182,21 +183,21 @@
         tuples.add( new ACITuple( EMPTY_USER_CLASS_COLLECTION, AuthenticationLevel.NONE, 
             PROTECTED_ITEMS, EMPTY_MICRO_OPERATION_SET, true, 0 ) );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, new MockProxy( 1 ), null, null, null,
+        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, new MockOperation( 1 ), null, null, null,
             null, ENTRY_NAME, null, null, ENTRY, null, null ).size() );
 
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, new MockProxy( 3 ), null, null, null,
+        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, new MockOperation( 3 ), null, null, null,
             null, ENTRY_NAME, null, null, ENTRY, null, null ).size() );
     }
 
     
-    class MockProxy implements OperationContext
+    class MockOperation implements OperationContext
     {
         final int count;
         final CoreSession session; 
 
 
-        public MockProxy( int count ) throws Exception 
+        public MockOperation( int count ) throws Exception 
         {
             this.count = count;
             this.session = new DefaultCoreSession( new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ), 
@@ -424,6 +425,27 @@
             // TODO Auto-generated method stub
             return false;
         }
+
+
+        public void add( ServerEntry entry, Collection<String> bypass ) throws Exception
+        {
+            // TODO Auto-generated method stub
+            
+        }
+
+
+        public void delete( LdapDN dn, Collection<String> bypass ) throws Exception
+        {
+            // TODO Auto-generated method stub
+            
+        }
+
+
+        public void modify( LdapDN dn, List<Modification> mods, Collection<String> bypass ) throws Exception
+        {
+            // TODO Auto-generated method stub
+            
+        }
     }
 
     class MockDirectoryService implements DirectoryService