directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r530861 [1/2] - in /directory/apacheds/trunk/core/src: main/java/org/apache/directory/server/core/authn/ main/java/org/apache/directory/server/core/authz/ main/java/org/apache/directory/server/core/collective/ main/java/org/apache/directory...
Date Fri, 20 Apr 2007 17:25:44 GMT
Author: elecharny
Date: Fri Apr 20 10:25:42 2007
New Revision: 530861

URL: http://svn.apache.org/viewvc?view=rev&rev=530861
Log:
Modified the ModifyOperationContext, and removed the modify( Name, ModificationItem) method 

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java Fri Apr 20 10:25:42 2007
@@ -44,22 +44,19 @@
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.LdapJndiProperties;
 import org.apache.directory.server.core.jndi.ServerContext;
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
-
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -344,9 +341,7 @@
     {
         if ( IS_DEBUG )
         {
-            log.debug( "Modifying name = '" + opContext.getDn().getUpName() + 
-            		"', modifs = " + AttributeUtils.toString( 
-            				((ModifyOperationContext)opContext).getMods() ) );
+            log.debug( opContext.toString() );
         }
 
         checkAuthenticated( MessageTypeEnum.MODIFY_REQUEST );
@@ -355,19 +350,6 @@
     }
 
     
-    public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
-    {
-        if ( IS_DEBUG )
-        {
-            log.debug( "Modifying name = '" + name.toString() + "'" );
-        }
-
-        checkAuthenticated( MessageTypeEnum.MODIFY_REQUEST );
-        next.modify( name, mods );
-        invalidateAuthenticatorCaches( name );
-    }
-
-
     public void rename( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
         if ( IS_DEBUG )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java Fri Apr 20 10:25:42 2007
@@ -490,84 +490,14 @@
     }
 
 
-    public void modify( NextInterceptor next, OperationContext modifyContext ) throws NamingException
+    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        LdapDN name = modifyContext.getDn();
-        int modOp = ((ModifyOperationContext)modifyContext).getModOp();
-        Attributes mods = ((ModifyOperationContext)modifyContext).getMods();
+        LdapDN name = opContext.getDn();
 
-        Attributes entry = proxy.lookup( new LookupOperationContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
-        LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
-        LdapDN principalDn = principal.getJndiName();
-
-        // bypass authz code if we are disabled
-        if ( !enabled )
-        {
-            next.modify( modifyContext );
-            return;
-        }
-
-        // bypass authz code but manage caches if operation is performed by the admin
-        if ( isPrincipalAnAdministrator( principalDn ) )
-        {
-            next.modify( modifyContext );
-            tupleCache.subentryModified( name, modOp, mods, entry );
-            groupCache.groupModified( name, modOp, mods, entry );
-            return;
-        }
-
-        Set userGroups = groupCache.getGroups( principalDn.toString() );
-        Collection<ACITuple> tuples = new HashSet<ACITuple>();
-        addPerscriptiveAciTuples( proxy, tuples, name, entry );
-        addEntryAciTuples( tuples, entry );
-        addSubentryAciTuples( proxy, tuples, name, entry );
-
-        engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, null, null,
-            Collections.singleton( MicroOperation.MODIFY ), tuples, entry );
-
-        NamingEnumeration attrList = mods.getAll();
-        Collection<MicroOperation> perms = null;
-        
-        switch ( modOp )
-        {
-            case ( DirContext.ADD_ATTRIBUTE  ):
-                perms = ADD_PERMS;
-                break;
-        
-            case ( DirContext.REMOVE_ATTRIBUTE  ):
-                perms = REMOVE_PERMS;
-                break;
-            
-            case ( DirContext.REPLACE_ATTRIBUTE  ):
-                perms = REPLACE_PERMS;
-                break;
-        }
-
-        while ( attrList.hasMore() )
-        {
-            Attribute attr = ( Attribute ) attrList.next();
-
-            for ( int ii = 0; ii < attr.size(); ii++ )
-            {
-                engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, attr
-                    .getID(), attr.get( ii ), perms, tuples, entry );
-            }
-        }
-
-        next.modify( modifyContext );
-        tupleCache.subentryModified( name, modOp, mods, entry );
-        groupCache.groupModified( name, modOp, mods, entry );
-    }
-
-
-    public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
-    {
         // Access the principal requesting the operation, and bypass checks if it is the admin
-        Invocation invocation = InvocationStack.getInstance().peek();
-        PartitionNexusProxy proxy = invocation.getProxy();
         Attributes entry = proxy.lookup( new LookupOperationContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();
@@ -575,14 +505,17 @@
         // bypass authz code if we are disabled
         if ( !enabled )
         {
-            next.modify( name, mods );
+            next.modify( opContext );
             return;
         }
 
+        ModificationItemImpl[] mods =((ModifyOperationContext)opContext).getModItems();
+
         // bypass authz code but manage caches if operation is performed by the admin
         if ( isPrincipalAnAdministrator( principalDn ) )
         {
-            next.modify( name, mods );
+            
+            next.modify( opContext );
             tupleCache.subentryModified( name, mods, entry );
             groupCache.groupModified( name, mods, entry );
             return;
@@ -598,6 +531,7 @@
             Collections.singleton( MicroOperation.MODIFY ), tuples, entry );
 
         Collection<MicroOperation> perms = null;
+
         for ( int ii = 0; ii < mods.length; ii++ )
         {
             switch ( mods[ii].getModificationOp() )
@@ -605,15 +539,18 @@
                 case ( DirContext.ADD_ATTRIBUTE  ):
                     perms = ADD_PERMS;
                     break;
+                    
                 case ( DirContext.REMOVE_ATTRIBUTE  ):
                     perms = REMOVE_PERMS;
                     break;
+                    
                 case ( DirContext.REPLACE_ATTRIBUTE  ):
                     perms = REPLACE_PERMS;
                     break;
             }
 
             Attribute attr = mods[ii].getAttribute();
+            
             for ( int jj = 0; jj < attr.size(); jj++ )
             {
                 engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, attr
@@ -621,11 +558,12 @@
             }
         }
 
-        next.modify( name, mods );
+        
+
+        next.modify( opContext );
         tupleCache.subentryModified( name, mods, entry );
         groupCache.groupModified( name, mods, entry );
     }
-
 
     public boolean hasEntry( NextInterceptor next, OperationContext entryContext ) throws NamingException
     {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java Fri Apr 20 10:25:42 2007
@@ -49,7 +49,6 @@
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 
@@ -248,31 +247,6 @@
         }
 
         nextInterceptor.modify( opContext );
-    }
-
-
-    /**
-     * This policy needs to be really tight too because some attributes may take part
-     * in giving the user permissions to protected resources.  We do not want users to
-     * self access these resources.  As far as we're concerned no one but the admin
-     * needs access.
-     */
-    public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItemImpl[] items ) throws NamingException
-    {
-        if ( enabled )
-        {
-            protectModifyAlterations( name );
-            nextInterceptor.modify( name, items );
-
-            // update administrators if we change administrators group
-            if ( name.toNormName().equals( ADMIN_GROUP_DN_NORMALIZED.toNormName() ) )
-            {
-                loadAdministrators();
-            }
-            return;
-        }
-        
-        nextInterceptor.modify( name, items );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java Fri Apr 20 10:25:42 2007
@@ -48,7 +48,6 @@
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
@@ -334,15 +333,7 @@
 
     public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-    	ModifyOperationContext ctx = (ModifyOperationContext)opContext;
-        collectiveAttributesSchemaChecker.checkModify( ctx.getDn(), ctx.getModOp(), ctx.getMods() );
+        collectiveAttributesSchemaChecker.checkModify( opContext.getDn(), ((ModifyOperationContext)opContext).getModItems() );
         super.modify( next, opContext );
-    }
-
-
-    public void modify( NextInterceptor next, LdapDN normName, ModificationItemImpl[] mods ) throws NamingException
-    {
-        collectiveAttributesSchemaChecker.checkModify( normName, mods );
-        super.modify( next, normName, mods );
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventService.java Fri Apr 20 10:25:42 2007
@@ -29,17 +29,28 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.naming.Binding;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchControls;
+import javax.naming.event.EventContext;
+import javax.naming.event.NamespaceChangeListener;
+import javax.naming.event.NamingEvent;
+import javax.naming.event.NamingListener;
+import javax.naming.event.ObjectChangeListener;
+
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.normalization.NormalizingVisitor;
@@ -57,23 +68,9 @@
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.Binding;
-import javax.naming.NamingEnumeration;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.Attribute;
-import javax.naming.event.EventContext;
-import javax.naming.event.NamespaceChangeListener;
-import javax.naming.event.NamingEvent;
-import javax.naming.event.NamingListener;
-import javax.naming.event.ObjectChangeListener;
-
 
 /**
  * An interceptor based serivice for notifying NamingListeners of EventContext
@@ -326,32 +323,11 @@
 
     public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
-    	ModifyOperationContext ctx = (ModifyOperationContext)opContext;
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes oriEntry = proxy.lookup( new LookupOperationContext( ctx.getDn() ), PartitionNexusProxy.LOOKUP_BYPASS );
+        Attributes oriEntry = proxy.lookup( new LookupOperationContext( opContext.getDn() ), PartitionNexusProxy.LOOKUP_BYPASS );
         super.modify( next, opContext );
-
-        // package modifications in ModItem format for event delivery
-        ModificationItemImpl[] modItems = new ModificationItemImpl[ctx.getMods().size()];
-        NamingEnumeration list = ctx.getMods().getAll();
-        
-        for ( int ii = 0; ii < modItems.length; ii++ )
-        {
-            modItems[ii] = new ModificationItemImpl( ctx.getModOp(), ( Attribute ) list.next() );
-        }
-        
-        notifyOnModify( ctx.getDn(), modItems, oriEntry );
-    }
-
-
-    public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
-    {
-        Invocation invocation = InvocationStack.getInstance().peek();
-        PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes oriEntry = proxy.lookup( new LookupOperationContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
-        super.modify( next, name, mods );
-        notifyOnModify( name, mods, oriEntry );
+        notifyOnModify( opContext.getDn(), ((ModifyOperationContext)opContext).getModItems(), oriEntry );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java Fri Apr 20 10:25:42 2007
@@ -263,53 +263,8 @@
         assertHasEntry( nextInterceptor, msg, ctx.getDn() );
 
         Attributes entry = nexus.lookup( new LookupOperationContext( ctx.getDn() ) );
-        NamingEnumeration attrIds = ctx.getMods().getIDs();
+        ModificationItemImpl[] items = ctx.getModItems();
         
-        while ( attrIds.hasMore() )
-        {
-            String attrId = ( String ) attrIds.next();
-            Attribute modAttr = ctx.getMods().get( attrId );
-            Attribute entryAttr = entry.get( attrId );
-
-            if ( ctx.getModOp() == DirContext.ADD_ATTRIBUTE )
-            {
-                if ( entryAttr != null )
-                {
-                    for ( int ii = 0; ii < modAttr.size(); ii++ )
-                    {
-                        if ( entryAttr.contains( modAttr.get( ii ) ) )
-                        {
-                            throw new LdapAttributeInUseException( "Trying to add existing value '" + modAttr.get( ii )
-                                + "' to attribute " + attrId );
-                        }
-                    }
-                }
-            }
-        }
-        
-        nextInterceptor.modify( opContext );
-    }
-
-
-    /**
-     * Checks to see the entry being modified exists, otherwise throws the appropriate LdapException.
-     */
-    public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItemImpl[] items ) throws NamingException
-    {
-        // check if entry to modify exists
-        String msg = "Attempt to modify non-existant entry: ";
-
-        // handle operations against the schema subentry in the schema service
-        // and never try to look it up in the nexus below
-        if ( name.getNormName().equalsIgnoreCase( subschemSubentryDn.getNormName() ) )
-        {
-            nextInterceptor.modify( name, items );
-            return;
-        }
-        
-        assertHasEntry( nextInterceptor, msg, name );
-
-        Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
         for ( int ii = 0; ii < items.length; ii++ )
         {
             if ( items[ii].getModificationOp() == DirContext.ADD_ATTRIBUTE )
@@ -330,9 +285,9 @@
                 }
             }
         }
-        nextInterceptor.modify( name, items );
-    }
 
+        nextInterceptor.modify( opContext );
+    }
 
     /**
      * Checks to see the entry being renamed exists, otherwise throws the appropriate LdapException.

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java Fri Apr 20 10:25:42 2007
@@ -37,7 +37,6 @@
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerContext;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -155,12 +154,6 @@
     public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
         next.modify( opContext );
-    }
-
-
-    public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
-    {
-        next.modify( name, mods );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java Fri Apr 20 10:25:42 2007
@@ -34,7 +34,6 @@
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -156,7 +155,7 @@
     /**
      * Filters {@link PartitionNexus#compare( OperationContext )} call.
      */
-    boolean compare( NextInterceptor next, OperationContext  opContext) throws NamingException;
+    boolean compare( NextInterceptor next, OperationContext opContext) throws NamingException;
 
 
     /**
@@ -175,12 +174,6 @@
      * Filters {@link Partition#modify( OperationContext )} call.
      */
     void modify( NextInterceptor next, OperationContext opContext ) throws NamingException;
-
-
-    /**
-     * Filters {@link Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])} call.
-     */
-    void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] items ) throws NamingException;
 
 
     /**

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Fri Apr 20 10:25:42 2007
@@ -34,7 +34,6 @@
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
@@ -43,7 +42,6 @@
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -127,10 +125,10 @@
         }
 
 
-        public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+        /*public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
         {
             nexus.modify( name, mods );
-        }
+        }*/
 
 
         public NamingEnumeration list( NextInterceptor next, OperationContext opContext ) throws NamingException
@@ -781,7 +779,7 @@
     }
 
 
-    public void modify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+    /*public void modify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
@@ -799,7 +797,7 @@
         {
             throwInterceptorException( head, e );
         }
-    }
+    }*/
 
 
     public NamingEnumeration list( OperationContext opContext ) throws NamingException
@@ -1181,27 +1179,7 @@
                     }
                 }
 
-
-                public void modify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
-                {
-                    Entry next = getNextEntry();
-                    Interceptor interceptor = next.configuration.getInterceptor();
-
-                    try
-                    {
-                        interceptor.modify( next.nextInterceptor, name, mods );
-                    }
-                    catch ( NamingException ne )
-                    {
-                        throw ne;
-                    }
-                    catch ( Throwable e )
-                    {
-                        throwInterceptorException( interceptor, e );
-                    }
-                }
-
-
+                
                 public NamingEnumeration list( OperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java Fri Apr 20 10:25:42 2007
@@ -31,7 +31,6 @@
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 /**
@@ -102,13 +101,6 @@
      * Calls the next interceptor's {@link Interceptor#modify( NextInterceptor, OperationContext )}.
      */
     void modify( OperationContext opContext ) throws NamingException;
-
-
-    /**
-     * Calls the next interceptor's {@link Interceptor#modify( NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])}.
-     */
-    void modify( LdapDN name, ModificationItemImpl[] items ) throws NamingException;
-
 
     /**
      * Calls the next interceptor's {@link Interceptor#list( NextInterceptor, OperationContext )}.

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Fri Apr 20 10:25:42 2007
@@ -19,24 +19,28 @@
  */
 package org.apache.directory.server.core.interceptor.context;
 
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
 
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 /**
  * A Modify context used for Interceptors. It contains all the informations
  * needed for the modify operation, and used by all the interceptors
+ * 
+ * This context can use either Attributes or ModificationItem, but not both.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class ModifyOperationContext extends AbstractOperationContext
 {
-    /** The modification type */
-    private int modOp;
-
-    /** The modified Attribute  */
-    private Attributes mods;
+    /** The modification items */
+    private ModificationItemImpl[] modItems;
     
     /**
      * 
@@ -53,62 +57,57 @@
      * Creates a new instance of ModifyOperationContext.
      *
      */
-    public ModifyOperationContext( LdapDN dn )
+    public ModifyOperationContext( LdapDN dn, ModificationItemImpl[] modItems )
     {
         super( dn );
+        this.modItems = modItems;
     }
 
     /**
-     * 
-     * Creates a new instance of ModifyOperationContext.
-     *
+     * Set the modified attributes
+     * @param value The modified attributes
      */
-    public ModifyOperationContext( LdapDN dn, int modOp, Attributes mods )
+    public void setModItems( ModificationItemImpl[] modItems ) 
     {
-    	super( dn );
-        this.modOp = modOp;
-        this.mods = mods;
+        this.modItems = modItems;
     }
 
     /**
-     * @return The modify type
+     * @return The modifications
      */
-	public int getModOp() 
-	{
-		return modOp;
-	}
-
-	/**
-	 * Set modification operation type
-	 * @param modOp the Modification operation type
-	 */
-	public void setModOp( int modOp ) 
-	{
-		this.modOp = modOp;
-	}
-
-	/**
-	 * @return The modified attributes
-	 */
-	public Attributes getMods() 
-	{
-		return mods;
-	}
-
-	/**
-	 * Set the modified attributes
-	 * @param value The modified attributes
-	 */
-	public void setMods( Attributes mods ) 
-	{
-		this.mods = mods;
-	}
+    public ModificationItemImpl[] getModItems() 
+    {
+        return modItems;
+    }
+    
+    public static ModificationItemImpl[] createModItems( Attributes attributes, int modOp ) throws NamingException
+    {
+        ModificationItemImpl[] items = new ModificationItemImpl[attributes.size()];
+        NamingEnumeration e = attributes.getAll();
+        int i = 0;
+        
+        while ( e.hasMore() )
+        {
+            items[i++] = new ModificationItemImpl( modOp, ( Attribute ) e.next() );
+        }
 
-	/**
+        return items;
+    }
+    
+    /**
      * @see Object#toString()
      */
     public String toString()
     {
-        return "ModifyContext for DN '" + getDn().getUpName() + "'"; 
+        StringBuilder sb = new StringBuilder();
+        
+        sb.append("ModifyContext for DN '").append( getDn().getUpName() ).append( "', modifications :\n" );
+        
+        for ( ModificationItem mod:modItems )
+        {
+            sb.append( mod ).append( '\n' );
+        }
+        
+        return sb.toString();
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Fri Apr 20 10:25:42 2007
@@ -49,7 +49,6 @@
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.AssertionEnum;
@@ -166,13 +165,27 @@
      */
     public void modifyAttributes( Name name, int modOp, Attributes attrs ) throws NamingException
     {
+        ModificationItemImpl[] modItems = null;
+        
+        if ( attrs != null )
+        {
+            modItems = new ModificationItemImpl[attrs.size()];
+            NamingEnumeration e = attrs.getAll();
+            int i = 0;
+            
+            while ( e.hasMore() )
+            {
+                modItems[i++] = new ModificationItemImpl( modOp, ( Attribute ) e.next() ) ;
+            }
+        }
+
     	if ( name instanceof LdapDN )
     	{
-    		getNexusProxy().modify( new ModifyOperationContext( buildTarget( name ), modOp, attrs ) );
+    		getNexusProxy().modify( new ModifyOperationContext( buildTarget( name ), modItems ) );
     	}
     	else
     	{
-    		getNexusProxy().modify( new ModifyOperationContext( buildTarget( new LdapDN( name ) ), modOp, attrs ) );
+    		getNexusProxy().modify( new ModifyOperationContext( buildTarget( new LdapDN( name ) ), modItems ) );
     	}
     }
 
@@ -216,7 +229,7 @@
             newMods[i] = new ModificationItemImpl( mods[i] );
         }
         
-        getNexusProxy().modify( buildTarget( name ), newMods );
+        getNexusProxy().modify( new ModifyOperationContext( buildTarget( new LdapDN( name ) ), newMods ) );
     }
 
 
@@ -226,7 +239,7 @@
      */
     public void modifyAttributes( Name name, ModificationItemImpl[] mods ) throws NamingException
     {
-        getNexusProxy().modify( buildTarget( name ), mods );
+        getNexusProxy().modify( new ModifyOperationContext( buildTarget( new LdapDN( name ) ), mods ) );
     }
 
 
@@ -620,10 +633,6 @@
      */
     public NamingEnumeration search( Name name, ExprNode filter, SearchControls cons ) throws NamingException
     {
-        /*Name newName = new LdapDN( name.toString() );
-         newName = LdapDN.oidToName( newName, DnOidContainer.getOids() );
-         Name target = buildTarget( ((LdapDN)newName).toLdapName() );*/
-
         LdapDN target = buildTarget( name );
         return getNexusProxy().search( target, getEnvironment(), filter, cons );
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java Fri Apr 20 10:25:42 2007
@@ -29,7 +29,6 @@
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -41,7 +40,6 @@
 import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
-
 import org.apache.directory.shared.ldap.filter.AssertionEnum;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -50,15 +48,13 @@
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
-import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
-
-import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -130,13 +126,6 @@
     {
         LdapDN.normalize( opContext.getDn(), attrNormalizers );
         nextInterceptor.modify( opContext );
-    }
-
-
-    public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItemImpl[] items ) throws NamingException
-    {
-        LdapDN normalized = LdapDN.normalize( name, attrNormalizers );
-        nextInterceptor.modify( normalized, items );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Fri Apr 20 10:25:42 2007
@@ -44,27 +44,27 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.UsageEnum;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
-import org.apache.directory.shared.ldap.util.DateUtils;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.apache.directory.shared.ldap.util.DateUtils;
 
 
 /**
@@ -168,8 +168,7 @@
 
         nextInterceptor.add( opContext );
     }
-
-
+    
     public void modify( NextInterceptor nextInterceptor, OperationContext opContext )
         throws NamingException
     {
@@ -189,38 +188,10 @@
         attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
-
-        ModifyOperationContext newModify = new ModifyOperationContext( 
-            opContext.getDn(),
-        		DirContext.REPLACE_ATTRIBUTE, 
-        		attributes);
-        nexus.modify( newModify );
-    }
-
-
-    public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItemImpl[] items ) throws NamingException
-    {
-        nextInterceptor.modify( name, items );
-
-        if ( name.getNormName().equals( subschemaSubentryDn.getNormName() ) ) 
-        {
-            return;
-        }
         
-        // add operational attributes after call in case the operation fails
-        Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
-        attribute.add( getPrincipal().getName() );
-        attributes.put( attribute );
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
 
-        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
-        attribute.add( DateUtils.getGeneralizedTime() );
-        attributes.put( attribute );
-
-        ModifyOperationContext newModify = new ModifyOperationContext( 
-        		name,
-        		DirContext.REPLACE_ATTRIBUTE, 
-        		attributes);
+        ModifyOperationContext newModify = new ModifyOperationContext( opContext.getDn(), items );
         nexus.modify( newModify );
     }
 
@@ -245,10 +216,9 @@
         newDn.add( ((RenameOperationContext)opContext).getNewRdn() );
         newDn.normalize( registry.getNormalizerMapping() );
         
-        ModifyOperationContext newModify = new ModifyOperationContext( 
-        		newDn,
-        		DirContext.REPLACE_ATTRIBUTE, 
-        		attributes);
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+
+        ModifyOperationContext newModify = new ModifyOperationContext( newDn, items );
         
         nexus.modify( newModify );
     }
@@ -268,10 +238,11 @@
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        ModifyOperationContext newModify = new ModifyOperationContext( 
-        		((MoveOperationContext)opContext).getParent(),
-        		DirContext.REPLACE_ATTRIBUTE, 
-        		attributes);
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+
+
+        ModifyOperationContext newModify = 
+            new ModifyOperationContext( ((MoveOperationContext)opContext).getParent(), items );
         
         nexus.modify( newModify );
     }
@@ -292,10 +263,11 @@
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        ModifyOperationContext newModify = new ModifyOperationContext( 
-        		((MoveAndRenameOperationContext)opContext).getParent(),
-        		DirContext.REPLACE_ATTRIBUTE, 
-        		attributes);
+        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+
+        ModifyOperationContext newModify = 
+            new ModifyOperationContext( 
+        		((MoveAndRenameOperationContext)opContext).getParent(), items );
         nexus.modify( newModify );
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Fri Apr 20 10:25:42 2007
@@ -20,24 +20,17 @@
 package org.apache.directory.server.core.partition;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.naming.NameNotFoundException;
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 /**
@@ -215,34 +208,6 @@
     public Attributes lookup( OperationContext lookupContext ) throws NamingException
     {
         return null;
-        //return lookup( lookupContext );
-    }
-
-
-    /**
-     * This method forwards the request to
-     * {@link Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItemImpl[])} after
-     * translating parameters to {@link ModificationItemImpl}<tt>[]</tt> by default.
-     * Please override this method if there is more effactive way for your
-     * implementation.
-     */
-    public void modify( OperationContext modifyContext ) throws NamingException
-    {
-    	ModifyOperationContext ctx = (ModifyOperationContext)modifyContext;
-    	int modOp = ctx.getModOp();
-    	Attributes mods = ctx.getMods(); 
-    	
-        List<ModificationItemImpl> items = new ArrayList<ModificationItemImpl>( mods.size() );
-        NamingEnumeration e = mods.getAll();
-        
-        while ( e.hasMore() )
-        {
-            items.add( new ModificationItemImpl( modOp, ( Attribute ) e.next() ) );
-        }
-
-        ModificationItemImpl[] itemsArray = new ModificationItemImpl[items.size()];
-        itemsArray = items.toArray( itemsArray );
-        modify( ctx.getDn(), itemsArray );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Fri Apr 20 10:25:42 2007
@@ -725,11 +725,11 @@
     /**
      * @see Partition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])
      */
-    public void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException
+    /*public void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException
     {
         Partition backend = getBackend( dn );
         backend.modify( dn, mods );
-    }
+    }*/
 
 
     /**

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Fri Apr 20 10:25:42 2007
@@ -33,7 +33,6 @@
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -137,18 +136,6 @@
      * @see javax.naming.directory.DirContext#REPLACE_ATTRIBUTE
      */
     void modify( OperationContext opContext ) throws NamingException;
-
-
-    /**
-     * Modifies an entry by using a combination of adds, removes or replace 
-     * operations using a set of ModificationItems.
-     *
-     * @param name the normalized distinguished/absolute name of the entry to modify
-     * @param items the ModificationItems used to affect the modification with
-     * @throws NamingException if there are any problems
-     * @see javax.naming.directory.ModificationItem
-     */
-    void modify( LdapDN name, ModificationItemImpl[] items ) throws NamingException;
 
 
     /**

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Fri Apr 20 10:25:42 2007
@@ -33,8 +33,8 @@
 import javax.naming.NamingException;
 import javax.naming.ServiceUnavailableException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import javax.naming.event.EventContext;
 import javax.naming.event.NamingListener;
@@ -47,14 +47,12 @@
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.event.EventService;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.shared.ldap.exception.LdapSizeLimitExceededException;
 import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -357,56 +355,12 @@
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
-        Integer modOpObj;
         
-        int modOp = ((ModifyOperationContext)opContext).getModOp();
-
-        switch ( modOp )
-        {
-            case ( DirContext.ADD_ATTRIBUTE  ):
-                modOpObj = ADD_MODOP;
-                break;
-
-            case ( DirContext.REMOVE_ATTRIBUTE  ):
-                modOpObj = REMOVE_MODOP;
-                break;
-            
-            case ( DirContext.REPLACE_ATTRIBUTE  ):
-                modOpObj = REPLACE_MODOP;
-                break;
-            
-            default:
-                throw new IllegalArgumentException( "bad modification operation value: " + modOp );
-        }
-
         stack.push( new Invocation( this, caller, "modify", new Object[]
             { opContext }, bypass ) );
         try
         {
             this.configuration.getInterceptorChain().modify( opContext );
-        }
-        finally
-        {
-            stack.pop();
-        }
-    }
-
-
-    public void modify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
-    {
-        modify( name, mods, null );
-    }
-
-
-    public void modify( LdapDN name, ModificationItemImpl[] mods, Collection bypass ) throws NamingException
-    {
-        ensureStarted();
-        InvocationStack stack = InvocationStack.getInstance();
-        stack.push( new Invocation( this, caller, "modify", new Object[]
-            { name, mods }, bypass ) );
-        try
-        {
-            this.configuration.getInterceptorChain().modify( name, mods );
         }
         finally
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Fri Apr 20 10:25:42 2007
@@ -37,8 +37,8 @@
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
-import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.Oid;
+import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.gui.PartitionViewer;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
@@ -47,10 +47,8 @@
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
-import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.name.LdapDN;
-
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -410,9 +408,6 @@
 
 
     public abstract void modify( OperationContext opContext ) throws NamingException;
-
-
-    public abstract void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException;
 
 
     private static final String[] ENTRY_DELETED_ATTRS = new String[] { "entrydeleted" };

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Fri Apr 20 10:25:42 2007
@@ -31,20 +31,18 @@
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
 import org.apache.directory.server.core.partition.impl.btree.BTreePartitionConfiguration;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.IndexNotFoundException;
 import org.apache.directory.server.schema.registries.Registries;
-
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -380,15 +378,8 @@
     public final void modify( OperationContext modifyContext ) throws NamingException
     {
     	ModifyOperationContext ctx = (ModifyOperationContext)modifyContext;
-        store.modify( ctx.getDn(), ctx.getModOp(), ctx.getMods() );
-    }
-
-
-    public final void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException
-    {
-        store.modify( dn, mods );
+        store.modify( ctx.getDn(), ctx.getModItems() );
     }
-
 
     public final void rename( OperationContext renameContext ) throws NamingException
     {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java Fri Apr 20 10:25:42 2007
@@ -647,109 +647,6 @@
     }
 
 
-    private void checkModify( ModifyOperationContext opContext ) throws NamingException
-    {
-        // -------------------------------------------------------------------
-        // Check and update lut if we change the objectClass 
-        // -------------------------------------------------------------------
-    	LdapDN name = opContext.getDn();
-    	int modOp = opContext.getModOp();
-    	Attributes mods = opContext.getMods();
-    	
-        boolean isTargetReferral = lut.isReferral( name );
-        boolean isOcChange = mods.get( SchemaConstants.OBJECT_CLASS_AT ) != null;
-        boolean modsOcHasReferral = hasValue( mods.get( SchemaConstants.OBJECT_CLASS_AT ), REFERRAL_OC );
-        
-        if ( isOcChange )
-        {
-            switch ( modOp )
-            {
-                /* 
-                 * if ADD op where refferal is added to objectClass of a
-                 * non-referral entry then we add a new referral to lut
-                 */
-                case ( DirContext.ADD_ATTRIBUTE  ):
-                    if ( modsOcHasReferral && !isTargetReferral )
-                    {
-                        lut.referralAdded( name );
-                    }
-                    break;
-                /* 
-                 * if REMOVE op where refferal is removed from objectClass of a
-                 * referral entry then we remove the referral from lut
-                 */
-                case ( DirContext.REMOVE_ATTRIBUTE  ):
-                    if ( modsOcHasReferral && isTargetReferral )
-                    {
-                        lut.referralDeleted( name );
-                    }
-                    break;
-                /* 
-                 * if REPLACE op on referral has new set of OC values which does 
-                 * not contain a referral value then we remove the referral from 
-                 * the lut
-                 * 
-                 * if REPLACE op on non-referral has new set of OC values with 
-                 * referral value then we add the new referral to the lut
-                 */
-                case ( DirContext.REPLACE_ATTRIBUTE  ):
-                    if ( isTargetReferral && !modsOcHasReferral )
-                    {
-                        lut.referralDeleted( name );
-                    }
-                    else if ( !isTargetReferral && modsOcHasReferral )
-                    {
-                        lut.referralAdded( name );
-                    }
-                    break;
-                default:
-                    throw new IllegalStateException( "undefined modification operation" );
-            }
-        }
-    }
-
-
-    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
-    {
-        Invocation invocation = InvocationStack.getInstance().peek();
-        ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
-        String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
-
-        // handle a normal modify without following referrals
-        if ( refval == null || refval.equals( IGNORE ) )
-        {
-            next.modify( opContext );
-            checkModify( (ModifyOperationContext)opContext );
-            return;
-        }
-
-        if ( refval.equals( THROW ) )
-        {
-            LdapDN farthest = lut.getFarthestReferralAncestor( opContext.getDn() );
-            
-            if ( farthest == null )
-            {
-                next.modify( opContext );
-                checkModify( (ModifyOperationContext)opContext );
-                return;
-            }
-
-            Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
-            Attribute refs = referral.get( REF_ATTR );
-            doReferralException( farthest, new LdapDN( opContext.getDn().getUpName() ), refs );
-        }
-        else if ( refval.equals( FOLLOW ) )
-        {
-            throw new NotImplementedException( FOLLOW + " referral handling mode not implemented" );
-        }
-        else
-        {
-            throw new LdapNamingException( "Undefined value for " + Context.REFERRAL + " key: " + refval,
-                ResultCodeEnum.OTHER );
-        }
-    }
-
-
     private void checkModify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
     {
         boolean isTargetReferral = lut.isReferral( name );
@@ -814,16 +711,18 @@
     }
 
 
-    public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
+        LdapDN name = opContext.getDn();
+        ModificationItemImpl[] mods = ((ModifyOperationContext)opContext).getModItems();
 
         // handle a normal modify without following referrals
         if ( refval == null || refval.equals( IGNORE ) )
         {
-            next.modify( name, mods );
+            next.modify( opContext );
             checkModify( name, mods );
             return;
         }
@@ -833,7 +732,7 @@
             LdapDN farthest = lut.getFarthestReferralAncestor( name );
             if ( farthest == null )
             {
-                next.modify( name, mods );
+                next.modify( opContext );
                 checkModify( name, mods );
                 return;
             }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java Fri Apr 20 10:25:42 2007
@@ -35,6 +35,7 @@
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.MetaSchemaConstants;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
@@ -895,6 +896,7 @@
             new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, modifiersName ) );
         LdapDN name = new LdapDN( "cn=schemaModifications,ou=schema" );
         name.normalize( globalRegistries.getAttributeTypeRegistry().getNormalizerMapping() );
-        invocation.getProxy().modify( name, mods, SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
+        
+        invocation.getProxy().modify( new ModifyOperationContext( name, mods ), SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Fri Apr 20 10:25:42 2007
@@ -36,6 +36,7 @@
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.bootstrap.Schema;
@@ -574,7 +575,7 @@
         mods[2] = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
             new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ) );
         
-        partition.modify( dn, mods );
+        partition.modify( new ModifyOperationContext( dn, mods ) );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=530861&r1=530860&r2=530861
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Fri Apr 20 10:25:42 2007
@@ -23,11 +23,11 @@
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 import java.util.Set;
 
 import javax.naming.NamingEnumeration;
@@ -49,11 +49,11 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -1147,190 +1147,6 @@
         }
     }
 
-    /**
-     * Check that the modify operations are allowed, and the conform to
-     * the schema.
-     * 
-     * @param next The next interceptor to call when we are done with the local operation
-     * @param name The DN on which the modification is being done 
-     * @param modOp The modification. One of :
-     *   DirContext.ADD_ATTRIBUTE
-     *   DirContext.REMOVE_ATTRIBUTE
-     *   DirContext.REPLACE_ATTRIBUTE
-     * @param mods The modifications to check. Each operation is atomic, and should
-     * be applied to a copy of the entry, in order to check that the schema is not
-     * violated at the end. For instance, we can't delete an attribute that does
-     * not exist and add it later. The opposite is legal.
-     * 
-     * @throws NamingException The generic exception we get if an illegal operation occurs
-     * @throws LdapNameNotFoundException If we don't find the entry, then this exception is thrown.
-     * @throws LdapInvalidAttributeIdentifierException The modified attribute is not known
-     * by the schema, or the Entry is not extensible.
-     * @throws LdapNoSuchAttributeException The modified Attribute does not exist in the 
-     * current entry or is not added by a previous modification operation.
-     * @throws LdapSchemaViolationException Another schema violation occured.
-     */
-    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
-    {
-    	LdapDN name = opContext.getDn();
-    	int modOp = ((ModifyOperationContext)opContext).getModOp();
-    	Attributes mods = ((ModifyOperationContext)opContext).getMods();
-    	
-        Attributes entry = null; 
-
-        // handle operations against the schema subentry in the schema service
-        // and never try to look it up in the nexus below
-        if ( name.getNormName().equalsIgnoreCase( subschemaSubentryDn.getNormName() ) )
-        {
-            entry = getSubschemaEntry( schemaSubentryReturnAttributes );
-        }
-        else
-        {
-            entry = nexus.lookup( new LookupOperationContext( name ) );
-        }
-
-        Attributes targetEntry = SchemaUtils.getTargetEntry( modOp, mods, entry );
-        
-        if ( entry == null )
-        {
-            log.error( "No entry with this name :{}", name );
-            throw new LdapNameNotFoundException( "The entry which name is " + name + " is not found." );
-        }
-        
-        Attribute objectClass = getResultantObjectClasses( modOp, mods.get( SchemaConstants.OBJECT_CLASS_AT ), entry.get( SchemaConstants.OBJECT_CLASS_AT ) );
-        ObjectClassRegistry ocRegistry = this.registries.getObjectClassRegistry();
-        AttributeTypeRegistry atRegistry = this.registries.getAttributeTypeRegistry();
-
-        NamingEnumeration changes = mods.getIDs();
-        
-        Attributes tmpEntryForAdd = ( Attributes ) entry.clone();
-        
-        while ( changes.hasMore() )
-        {
-            String id = ( String ) changes.next();
-            Attribute change = mods.get( id );
-
-            if ( !atRegistry.hasAttributeType( change.getID() ) && 
-                !objectClass.contains( SchemaConstants.EXTENSIBLE_OBJECT_OC ) )
-            {
-                throw new LdapInvalidAttributeIdentifierException( "unrecognized attributeID " + change.getID() );
-            }
-            
-            if ( modOp == DirContext.ADD_ATTRIBUTE )
-            {
-                tmpEntryForAdd.put( change );
-                
-                if ( change.size() == 0 )
-                {
-                    // not ok for add but ok for replace and delete
-                    throw new LdapInvalidAttributeValueException( "No value is not a valid value for an attribute.", 
-                        ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
-                }
-            }
-
-            if ( ( modOp == DirContext.REMOVE_ATTRIBUTE ) && ( entry.get( change.getID() ) == null ) )
-            {
-                throw new LdapNoSuchAttributeException();
-            }
-
-            // for required attributes we need to check if all values are removed
-            // if so then we have a schema violation that must be thrown
-            if ( ( modOp == DirContext.REMOVE_ATTRIBUTE ) && isRequired( change.getID(), objectClass )
-                && isCompleteRemoval( change, entry ) )
-            {
-                throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION );
-            }
-        }
-
-        if ( modOp == DirContext.ADD_ATTRIBUTE )
-        {
-            assertNumberOfAttributeValuesValid( tmpEntryForAdd );
-        }
-        
-        if ( modOp == DirContext.REMOVE_ATTRIBUTE )
-        {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, modOp, mods, registries.getOidRegistry() );
-            SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, modOp, mods, objectClass );
-        }
-
-        if ( modOp == DirContext.REPLACE_ATTRIBUTE )
-        {
-            SchemaChecker.preventRdnChangeOnModifyReplace( name, modOp, mods, registries.getOidRegistry() );
-            SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, modOp, mods );
-            assertNumberOfAttributeValuesValid( mods );
-        }
-
-        // let's figure out if we need to add or take away from mods to maintain 
-        // the objectClass attribute with it's hierarchy of ancestors 
-        if ( mods.get( SchemaConstants.OBJECT_CLASS_AT ) != null )
-        {
-            Attribute alteredObjectClass = ( Attribute ) objectClass.clone();
-            alterObjectClasses( alteredObjectClass );
-
-            if ( !alteredObjectClass.equals( objectClass ) )
-            {
-                Attribute ocMods = mods.get( SchemaConstants.OBJECT_CLASS_AT );
-                
-                switch ( modOp )
-                {
-                    case ( DirContext.ADD_ATTRIBUTE  ):
-                        if ( ocMods.contains( SchemaConstants.TOP_OC ) )
-                        {
-                            ocMods.remove( SchemaConstants.TOP_OC );
-                        }
-                    
-                        for ( int ii = 0; ii < alteredObjectClass.size(); ii++ )
-                        {
-                            if ( !objectClass.contains( alteredObjectClass.get( ii ) ) )
-                            {
-                                ocMods.add( alteredObjectClass.get( ii ) );
-                            }
-                        }
-                        
-                        break;
-                        
-                    case ( DirContext.REMOVE_ATTRIBUTE  ):
-                        for ( int ii = 0; ii < alteredObjectClass.size(); ii++ )
-                        {
-                            if ( !objectClass.contains( alteredObjectClass.get( ii ) ) )
-                            {
-                                ocMods.remove( alteredObjectClass.get( ii ) );
-                            }
-                        }
-                    
-                        break;
-                        
-                    case ( DirContext.REPLACE_ATTRIBUTE  ):
-                        for ( int ii = 0; ii < alteredObjectClass.size(); ii++ )
-                        {
-                            if ( !objectClass.contains( alteredObjectClass.get( ii ) ) )
-                            {
-                                ocMods.add( alteredObjectClass.get( ii ) );
-                            }
-                        }
-                    
-                        break;
-                        
-                    default:
-                        break;
-                }
-            }
-        }
-
-        if ( name.startsWith( schemaBaseDN ) )
-        {
-            schemaManager.modify( name, modOp, mods, entry, targetEntry );
-        }
-        else if ( subschemaSubentryDn.getNormName().equals( name.getNormName() ) )
-        {
-            schemaManager.modifySchemaSubentry( name, modOp, mods, entry, targetEntry );
-            return;
-        }
-        
-        next.modify( opContext );
-    }
-    
-    
     public void moveAndRename( NextInterceptor next, OperationContext opContext )
         throws NamingException
     {
@@ -1383,9 +1199,11 @@
 
     private final static String[] schemaSubentryReturnAttributes = new String[] { "+", "*" };
     
-    public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+    public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
     {
         Attributes entry = null; 
+        LdapDN name = opContext.getDn();
+        ModificationItemImpl[] mods = ((ModifyOperationContext)opContext).getModItems();
 
         // handle operations against the schema subentry in the schema service
         // and never try to look it up in the nexus below
@@ -1688,7 +1506,7 @@
             return;
         }
         
-        next.modify( name, mods );
+        next.modify( opContext );
     }
 
 



Mime
View raw message