directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r527485 - 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/event/ main/java/org/apache/directory/server/cor...
Date Wed, 11 Apr 2007 13:21:28 GMT
Author: elecharny
Date: Wed Apr 11 06:21:26 2007
New Revision: 527485

URL: http://svn.apache.org/viewvc?view=rev&rev=527485
Log:
Added a new ServiceContext and used it in all the interceptors

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/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/jndi/ServerContext.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/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/TriggerService.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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -44,6 +44,7 @@
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.BindServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.InvocationStack;
@@ -365,17 +366,18 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
) throws NamingException
+    public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext ) throws NamingException
     {
         if ( IS_DEBUG )
         {
-            log.debug( "Modifying name = '" + name.toString() + "', new RDN = '" + newRn
+ "', oldRDN = '"
-                + deleteOldRn + "'" );
+            log.debug( "Modifying name = '" + modifyDnContext.getDn().getUpName() + "', new
RDN = '" + 
+                ((ModifyDNServiceContext)modifyDnContext).getNewDn() + "', " +
+                "oldRDN = '" + ((ModifyDNServiceContext)modifyDnContext).getDelOldDn() +
"'" );
         }
 
         checkAuthenticated( MessageTypeEnum.MOD_DN_REQUEST );
-        next.modifyRn( name, newRn, deleteOldRn );
-        invalidateAuthenticatorCaches( name );
+        next.modifyRn( modifyDnContext );
+        invalidateAuthenticatorCaches( modifyDnContext.getDn() );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -33,6 +33,7 @@
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.CompareServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -727,8 +728,11 @@
         return next.lookup( lookupContext );
     }
 
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
) throws NamingException
+    public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext ) throws NamingException
     {
+        LdapDN name = modifyDnContext.getDn();
+        String newDn = ((ModifyDNServiceContext)modifyDnContext).getNewDn();
+        
         // Access the principal requesting the operation, and bypass checks if it is the
admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
@@ -737,23 +741,24 @@
         LdapDN principalDn = principal.getJndiName();
         LdapDN newName = ( LdapDN ) name.clone();
         newName.remove( name.size() - 1 );
-        newName.add( parseNormalized( newRn ).get( 0 ) );
+        newName.add( parseNormalized( newDn ).get( 0 ) );
 
         // bypass authz code if we are disabled
         if ( !enabled )
         {
-            next.modifyRn( name, newRn, deleteOldRn );
+            next.modifyRn( modifyDnContext );
             return;
         }
 
         // bypass authz code but manage caches if operation is performed by the admin
         if ( isPrincipalAnAdministrator( principalDn ) )
         {
-            next.modifyRn( name, newRn, deleteOldRn );
+            next.modifyRn( modifyDnContext );
             tupleCache.subentryRenamed( name, newName );
-            if ( groupCache.groupRenamed( name, newName ) )
-            {
-            }
+            
+            // TODO : this method returns a boolean : what should we do with the result ?
+            groupCache.groupRenamed( name, newName );
+
             return;
         }
 
@@ -766,34 +771,7 @@
         engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(),
name, null, null,
             RENAME_PERMS, tuples, entry );
 
-        //        if ( deleteOldRn )
-        //        {
-        //            String oldRn = name.get( name.size() - 1 );
-        //            if ( NamespaceTools.hasCompositeComponents( oldRn ) )
-        //            {
-        //                String[] comps = NamespaceTools.getCompositeComponents( oldRn );
-        //                for ( int ii = 0; ii < comps.length; ii++ )
-        //                {
-        //                    String id = NamespaceTools.getRdnAttribute( comps[ii] );
-        //                    String value = NamespaceTools.getRdnValue( comps[ii] );
-        //                    engine.checkPermission( next, userGroups, user.getJndiName(),
-        //                            user.getAuthenticationLevel(), name, id,
-        //                            value, Collections.singleton( MicroOperation.REMOVE
),
-        //                            tuples, entry );
-        //                }
-        //            }
-        //            else
-        //            {
-        //                String id = NamespaceTools.getRdnAttribute( oldRn );
-        //                String value = NamespaceTools.getRdnValue( oldRn );
-        //                engine.checkPermission( next, userGroups, user.getJndiName(),
-        //                        user.getAuthenticationLevel(), name, id,
-        //                        value, Collections.singleton( MicroOperation.REMOVE ),
-        //                        tuples, entry );
-        //            }
-        //        }
-
-        next.modifyRn( name, newRn, deleteOldRn );
+        next.modifyRn( modifyDnContext );
         tupleCache.subentryRenamed( name, newName );
         groupCache.groupRenamed( name, newName );
     }

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -332,14 +332,15 @@
     //  o The administrator entry cannot be moved or renamed by anyone
     // ------------------------------------------------------------------------
 
-    public void modifyRn( NextInterceptor nextInterceptor, LdapDN name, String newRn, boolean
deleteOldRn )
+    public void modifyRn( NextInterceptor nextInterceptor, ServiceContext modifyDnContext
)
         throws NamingException
     {
         if ( enabled )
         {
-            protectDnAlterations( name );
+            protectDnAlterations( modifyDnContext.getDn() );
         }
-        nextInterceptor.modifyRn( name, newRn, deleteOldRn );
+        
+        nextInterceptor.modifyRn( modifyDnContext );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -35,6 +35,7 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -379,14 +380,14 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
) throws NamingException
+    public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext ) throws NamingException
     {
-        super.modifyRn( next, name, newRn, deleteOldRn );
-        LdapDN newName = ( LdapDN ) name.clone();
+        super.modifyRn( next, modifyDnContext );
+        LdapDN newName = ( LdapDN ) modifyDnContext.getDn().clone();
         newName.remove( newName.size() - 1 );
-        newName.add( newRn );
+        newName.add( ((ModifyDNServiceContext)modifyDnContext).getNewDn() );
         newName.normalize( attributeRegistry.getNormalizerMapping() );
-        notifyOnNameChange( name, newName );
+        notifyOnNameChange( modifyDnContext.getDn(), newName );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -35,6 +35,7 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -332,9 +333,11 @@
     /**
      * Checks to see the entry being renamed exists, otherwise throws the appropriate LdapException.
      */
-    public void modifyRn( NextInterceptor nextInterceptor, LdapDN dn, String newRn, boolean
deleteOldRn )
+    public void modifyRn( NextInterceptor nextInterceptor, ServiceContext modifyDnContext
)
         throws NamingException
     {
+        LdapDN dn = modifyDnContext.getDn();
+        
         if ( dn.getNormName().equalsIgnoreCase( subschemSubentryDn.getNormName() ) )
         {
             throw new LdapOperationNotSupportedException( 
@@ -350,8 +353,9 @@
         // check to see if target entry exists
         LdapDN newDn = ( LdapDN ) dn.clone();
         newDn.remove( dn.size() - 1 );
-        newDn.add( newRn );
+        newDn.add( ((ModifyDNServiceContext)modifyDnContext).getNewDn() );
         newDn.normalize( normalizerMap );
+        
         if ( nextInterceptor.hasEntry( new EntryServiceContext( newDn ) ) )
         {
             LdapNameAlreadyBoundException e;
@@ -360,7 +364,7 @@
             throw e;
         }
 
-        nextInterceptor.modifyRn( dn, newRn, deleteOldRn );
+        nextInterceptor.modifyRn( modifyDnContext );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -165,9 +165,9 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
) throws NamingException
+    public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext ) throws NamingException
     {
-        next.modifyRn( name, newRn, deleteOldRn );
+        next.modifyRn( modifyDnContext );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -210,9 +210,9 @@
 
 
     /**
-     * Filters {@link Partition#modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean)}
call.
+     * Filters {@link Partition#modifyRn(ServiceContext)} call.
      */
-    void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn )
throws NamingException;
+    void modifyRn( NextInterceptor next, ServiceContext modifyDnContext ) 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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -158,10 +158,10 @@
         }
 
 
-        public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
)
+        public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext )
             throws NamingException
         {
-            nexus.modifyRn( name, newRn, deleteOldRn );
+            nexus.modifyRn( modifyDnContext );
         }
 
 
@@ -875,14 +875,14 @@
     }
 
 
-    public void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
+    public void modifyRn( ServiceContext modifyDnContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.configuration.getInterceptor();
         NextInterceptor next = entry.nextInterceptor;
         try
         {
-            head.modifyRn( next, name, newRn, deleteOldRn );
+            head.modifyRn( next, modifyDnContext );
         }
         catch ( NamingException ne )
         {
@@ -1268,14 +1268,14 @@
                 }
 
 
-                public void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws
NamingException
+                public void modifyRn( ServiceContext modifyDnContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.configuration.getInterceptor();
 
                     try
                     {
-                        interceptor.modifyRn( next.nextInterceptor, name, newRn, deleteOldRn
);
+                        interceptor.modifyRn( next.nextInterceptor, modifyDnContext );
                     }
                     catch ( NamingException ne )
                     {

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -137,9 +137,9 @@
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#modifyRn(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,String,boolean)}.
+     * Calls the next interceptor's {@link Interceptor#modifyRn(NextInterceptor,ServiceContext)}.
      */
-    void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException;
+    void modifyRn( ServiceContext modifyDnContext ) throws NamingException;
 
 
     /**

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?view=diff&rev=527485&r1=527484&r2=527485
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Wed Apr 11 06:21:26 2007
@@ -54,6 +54,7 @@
 import org.apache.directory.server.core.interceptor.context.DeleteServiceContext;
 import org.apache.directory.server.core.interceptor.context.EntryServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -464,6 +465,7 @@
     {
         LdapDN oldDn = buildTarget( oldName );
         LdapDN newDn = buildTarget( newName );
+        
         if ( oldDn.size() == 0 )
         {
             throw new LdapNoPermissionException( "can't rename the rootDSE" );
@@ -499,20 +501,23 @@
          * a move operation.  Furthermore if the RDN in the move operation 
          * changes it is both an RDN change and a move operation.
          */
-        if ( oldName.size() == newName.size() && oldBase.equals( newBase ) )
+        if ( ( oldName.size() == newName.size() ) && oldBase.equals( newBase ) )
         {
-            nexusProxy.modifyRn( oldDn, newRdn, delOldRdn );
+            nexusProxy.modifyRn( new ModifyDNServiceContext( oldDn, newRdn, delOldRdn ) );
         }
         else
         {
             LdapDN parent = ( LdapDN ) newDn.clone();
             parent.remove( newDn.size() - 1 );
+            
             if ( newRdn.equalsIgnoreCase( oldRdn ) )
             {
+                //nexusProxy.move( new MoveServiceContext( oldDn, parent ) );
                 nexusProxy.move( oldDn, parent );
             }
             else
             {
+                //nexusProxy.move( new MoveServiceContext( oldDn, parent, newRdn, delOldRdn
) );
                 nexusProxy.move( oldDn, parent, newRdn, delOldRdn );
             }
         }

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -138,11 +138,11 @@
     }
 
 
-    public void modifyRn( NextInterceptor nextInterceptor, LdapDN name, String newRn, boolean
deleteOldRn )
+    public void modifyRn( NextInterceptor nextInterceptor, ServiceContext modifyDnContext
)
         throws NamingException
     {
-        LdapDN normalized = LdapDN.normalize( name, attrNormalizers );
-        nextInterceptor.modifyRn( normalized, newRn, deleteOldRn );
+        LdapDN.normalize( modifyDnContext.getDn(), attrNormalizers );
+        nextInterceptor.modifyRn( modifyDnContext );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -44,6 +44,7 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -222,10 +223,10 @@
     }
 
 
-    public void modifyRn( NextInterceptor nextInterceptor, LdapDN name, String newRn, boolean
deleteOldRn )
+    public void modifyRn( NextInterceptor nextInterceptor, ServiceContext modifyDnContext
)
         throws NamingException
     {
-        nextInterceptor.modifyRn( name, newRn, deleteOldRn );
+        nextInterceptor.modifyRn( modifyDnContext );
 
         // add operational attributes after call in case the operation fails
         Attributes attributes = new AttributesImpl( true );
@@ -237,9 +238,9 @@
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        LdapDN newDn = ( LdapDN ) name.clone();
-        newDn.remove( name.size() - 1 );
-        newDn.add( newRn );
+        LdapDN newDn = ( LdapDN ) modifyDnContext.getDn().clone();
+        newDn.remove( modifyDnContext.getDn().size() - 1 );
+        newDn.add( ((ModifyDNServiceContext)modifyDnContext).getNewDn() );
         newDn.normalize( registry.getNormalizerMapping() );
         
         ModifyServiceContext newModify = new ModifyServiceContext( 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -33,6 +33,7 @@
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -255,7 +256,7 @@
         LdapDN newName = ( LdapDN ) newParentName.clone();
         newName.add( newRn );
         move( oldName, newParentName );
-        modifyRn( newName, newRn, deleteOldRn );
+        modifyRn( new ModifyDNServiceContext( newName, newRn, deleteOldRn ) );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -952,10 +952,10 @@
     /**
      * @see Partition#modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean)
      */
-    public void modifyRn( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws NamingException
+    public void modifyRn( ServiceContext modifyDnContext ) throws NamingException
     {
-        Partition backend = getBackend( dn );
-        backend.modifyRn( dn, newRdn, deleteOldRdn );
+        Partition backend = getBackend( modifyDnContext.getDn() );
+        backend.modifyRn( modifyDnContext );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -31,6 +31,7 @@
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -214,14 +215,10 @@
      * This makes sense only in certain namespaces like LDAP and will be ignored
      * if it is irrelavent.
      *
-     * @param name the normalized distinguished/absolute name of the entry to
-     * modify the RN of.
-     * @param newRn the new RN of the entry specified by name
-     * @param deleteOldRn boolean flag which removes the old RN attribute
-     * from the entry if set to true, and has no affect if set to false
+     * @param modifyDnContext the modify DN context
      * @throws NamingException if there are any problems
      */
-    void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException;
+    void modifyRn( ServiceContext modifyDnContext ) 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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -549,22 +549,22 @@
     }
 
 
-    public void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
+    public void modifyRn( ServiceContext modifyDnContext ) throws NamingException
     {
-        modifyRn( name, newRn, deleteOldRn, null );
+        modifyRn( modifyDnContext, null );
     }
 
 
-    public void modifyRn( LdapDN name, String newRn, boolean deleteOldRn, Collection bypass
) throws NamingException
+    public void modifyRn( ServiceContext modifyDnContext, Collection bypass ) throws NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
         Object[] args = new Object[]
-            { name, newRn, deleteOldRn ? Boolean.TRUE : Boolean.FALSE };
+            { modifyDnContext };
         stack.push( new Invocation( this, caller, "modifyRn", args, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().modifyRn( name, newRn, deleteOldRn );
+            this.configuration.getInterceptorChain().modifyRn( modifyDnContext );
         }
         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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -470,7 +470,7 @@
     }
 
 
-    public abstract void modifyRn( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws
NamingException;
+    public abstract void modifyRn( ServiceContext modifyDnContext ) throws NamingException;
 
 
     public abstract void move( LdapDN oldChildDn, LdapDN newParentDn ) throws NamingException;

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -31,6 +31,7 @@
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.partition.Partition;
@@ -387,9 +388,10 @@
     }
 
 
-    public final void modifyRn( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws NamingException
+    public final void modifyRn( ServiceContext modifyDnContext ) throws NamingException
     {
-        store.modifyRn( dn, newRdn, deleteOldRdn );
+        ModifyDNServiceContext ctx = (ModifyDNServiceContext)modifyDnContext;
+        store.modifyRn( ctx.getDn(), ctx.getNewDn(), ctx.getDelOldDn() );
     }
 
 

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -48,6 +48,7 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -556,27 +557,31 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, LdapDN oldName, String newRdn, boolean deleteOldRdn
)
+    public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext )
         throws NamingException
     {
+        LdapDN oldName = modifyDnContext.getDn();
+        
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
         LdapDN newName = ( LdapDN ) oldName.clone();
         newName.remove( oldName.size() - 1 );
 
-        LdapDN newRdnName = new LdapDN( newRdn );
+        LdapDN newRdnName = new LdapDN( ((ModifyDNServiceContext)modifyDnContext).getNewDn()
);
         newRdnName.normalize( attrRegistry.getNormalizerMapping() );
         newName.add( newRdnName.toNormName() );
 
         // handle a normal modify without following referrals
         if ( refval == null || refval.equals( IGNORE ) )
         {
-            next.modifyRn( oldName, newRdn, deleteOldRdn );
+            next.modifyRn( modifyDnContext );
+            
             if ( lut.isReferral( oldName ) )
             {
                 lut.referralChanged( oldName, newName );
             }
+            
             return;
         }
 
@@ -584,15 +589,19 @@
         {
             LdapDN farthestSrc = lut.getFarthestReferralAncestor( oldName );
             LdapDN farthestDst = lut.getFarthestReferralAncestor( newName );
+            
             if ( farthestSrc == null && farthestDst == null && !lut.isReferral(
newName ) )
             {
-                next.modifyRn( oldName, newRdn, deleteOldRdn );
+                next.modifyRn( modifyDnContext );
+                
                 if ( lut.isReferral( oldName ) )
                 {
                     lut.referralChanged( oldName, newName );
                 }
+                
                 return;
             }
+            
             if ( farthestSrc != null )
             {
                 Attributes referral = invocation.getProxy().lookup( new LookupServiceContext(
farthestSrc ),

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=527485&r1=527484&r2=527485
==============================================================================
--- 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
Wed Apr 11 06:21:26 2007
@@ -49,6 +49,7 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -1352,8 +1353,12 @@
     }
     
 
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
) throws NamingException
+    public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext ) throws NamingException
     {
+        LdapDN name = modifyDnContext.getDn();
+        String newRn = ((ModifyDNServiceContext)modifyDnContext).getNewDn();
+        boolean deleteOldRn = ((ModifyDNServiceContext)modifyDnContext).getDelOldDn();
+        
         Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
 
         if ( name.startsWith( schemaBaseDN ) )
@@ -1361,7 +1366,7 @@
             schemaManager.modifyRn( name, newRn, deleteOldRn, entry );
         }
         
-        next.modifyRn( name, newRn, deleteOldRn );
+        next.modifyRn( modifyDnContext );
     }
 
     private final static String[] schemaSubentryReturnAttributes = new String[] { "+", "*"
};

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?view=diff&rev=527485&r1=527484&r2=527485
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
Wed Apr 11 06:21:26 2007
@@ -33,6 +33,7 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ModifyServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -696,8 +697,11 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
) throws NamingException
+    public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext ) throws NamingException
     {
+        LdapDN name = modifyDnContext.getDn();
+        String newRn = ((ModifyDNServiceContext)modifyDnContext).getNewDn();
+        
         Attributes entry = nexus.lookup( new LookupServiceContext( name ) );
         Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
 
@@ -719,7 +723,7 @@
 
             String newNormName = newName.toNormName();
             subentryCache.setSubentry( newNormName, ss, subentry.getTypes() );
-            next.modifyRn( name, newRn, deleteOldRn );
+            next.modifyRn( modifyDnContext );
 
             subentry = subentryCache.getSubentry( newNormName );
             ExprNode filter = new PresenceNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT
) );
@@ -748,7 +752,7 @@
                 log.warn( msg );
                 throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN
);
             }
-            next.modifyRn( name, newRn, deleteOldRn );
+            next.modifyRn( modifyDnContext );
 
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java?view=diff&rev=527485&r1=527484&r2=527485
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
Wed Apr 11 06:21:26 2007
@@ -42,6 +42,7 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddServiceContext;
 import org.apache.directory.server.core.interceptor.context.LookupServiceContext;
+import org.apache.directory.server.core.interceptor.context.ModifyDNServiceContext;
 import org.apache.directory.server.core.interceptor.context.ServiceContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
@@ -371,12 +372,16 @@
     }
     
 
-    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
) throws NamingException
+    public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext ) throws NamingException
     {
+        LdapDN name = modifyDnContext.getDn();
+        String newRn = ((ModifyDNServiceContext)modifyDnContext).getNewDn();
+        boolean deleteOldRn = ((ModifyDNServiceContext)modifyDnContext).getDelOldDn();
+        
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
         {
-            next.modifyRn( name, newRn, deleteOldRn );
+            next.modifyRn( modifyDnContext );
             return;
         }
         
@@ -406,7 +411,7 @@
         // Gather a Map<ActionTime,TriggerSpecification> where TriggerSpecification.ldapOperation
= LdapOperation.MODIFYDN_RENAME.
         Map triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFYDN_RENAME
);
         
-        next.modifyRn( name, newRn, deleteOldRn );
+        next.modifyRn( modifyDnContext );
         triggerSpecCache.subentryRenamed( name, newDN );
         
         // Fire AFTER Triggers.

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?view=diff&rev=527485&r1=527484&r2=527485
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
Wed Apr 11 06:21:26 2007
@@ -397,11 +397,11 @@
         }
 
 
-        public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
)
+        public void modifyRn( NextInterceptor next, ServiceContext modifyDnContext )
             throws NamingException
         {
             interceptors.add( this );
-            next.modifyRn( name, newRn, deleteOldRn );
+            next.modifyRn( modifyDnContext );
         }
 
 



Mime
View raw message