directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r952834 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/context/ core/src/main/java/org/apache/directory/server/core/ core/src/main/java/org/apache/directory/server/core/authz/ core/src/ma...
Date Tue, 08 Jun 2010 21:52:58 GMT
Author: elecharny
Date: Tue Jun  8 21:52:57 2010
New Revision: 952834

URL: http://svn.apache.org/viewvc?rev=952834&view=rev
Log:
o Added the newDN into the MoveOperationContext
o Removed useless DN clone and computation, as we now have the newDn present in the OperationContext
o Removed one lookup in the Move operation

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
Tue Jun  8 21:52:57 2010
@@ -39,6 +39,9 @@ public class MoveOperationContext extend
     /** The parent DN */
     private DN parent;
     
+    /** The New target DN */
+    private DN newDn;
+    
 
     /**
      * Creates a new instance of MoveOperationContext.
@@ -108,6 +111,26 @@ public class MoveOperationContext extend
 
 
     /**
+     *  @return The new DN
+     */
+    public DN getNewDn()
+    {
+        return newDn;
+    }
+    
+
+    /**
+     * Set the new DN
+     *
+     * @param newDn The new DN
+     */
+    public void setNewDn( DN newDn )
+    {
+        this.newDn = newDn;
+    }
+
+
+    /**
      * @return the operation name
      */
     public String getName()

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
Tue Jun  8 21:52:57 2010
@@ -579,7 +579,6 @@ public class DefaultCoreSession implemen
     public void move( DN dn, DN newParent, LogChange log ) throws LdapException
     {
         MoveOperationContext opContext = new MoveOperationContext( this, dn, newParent );
-        
         opContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
Tue Jun  8 21:52:57 2010
@@ -661,6 +661,10 @@ public class DefaultOperationManager imp
             DN dn = opContext.getDn();
             dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
 
+            // Normalize the opContext DN
+            DN parentDn = opContext.getParent();
+            parentDn.normalize( directoryService.getSchemaManager().getNormalizerMapping()
);
+
             // We have to deal with the referral first
             directoryService.getReferralManager().lockRead();
 
@@ -711,10 +715,6 @@ public class DefaultOperationManager imp
             }
 
             // Now, check the destination
-            // Normalize the opContext DN
-            DN parentDn = opContext.getParent();
-            parentDn.normalize( directoryService.getSchemaManager().getNormalizerMapping()
);
-
             // If he parent DN is a referral, or has a referral ancestor, we have to issue
a AffectMultipleDsas result
             // as stated by RFC 3296 Section 5.6.2
             if ( directoryService.getReferralManager().isReferral( parentDn )
@@ -732,6 +732,11 @@ public class DefaultOperationManager imp
             // Unlock the ReferralManager
             directoryService.getReferralManager().unlock();
 
+            // Create the newDN now
+            DN newDn = (DN)(opContext.getParent().clone());
+            newDn.add( dn.getRdn() );
+            opContext.setNewDn( newDn );
+
             // Call the Add method
             InterceptorChain interceptorChain = directoryService.getInterceptorChain();
             interceptorChain.move( opContext );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Tue Jun  8 21:52:57 2010
@@ -909,13 +909,12 @@ public class AciAuthorizationInterceptor
     public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
     {
         DN oriChildName = moveContext.getDn();
-        DN newParentName = moveContext.getParent();
 
         // Access the principal requesting the operation, and bypass checks if it is the
admin
-        Entry entry = moveContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
+        Entry entry = moveContext.getEntry();
+
+        DN newDn = moveContext.getNewDn();
 
-        DN newName = ( DN ) newParentName.clone();
-        newName.add( oriChildName.get( oriChildName.size() - 1 ) );
         LdapPrincipal principal = moveContext.getSession().getEffectivePrincipal();
         DN principalDn = principal.getDN();
 
@@ -932,8 +931,8 @@ public class AciAuthorizationInterceptor
         if ( isPrincipalAnAdministrator( principalDn ) )
         {
             next.move( moveContext );
-            tupleCache.subentryRenamed( oriChildName, newName );
-            groupCache.groupRenamed( oriChildName, newName );
+            tupleCache.subentryRenamed( oriChildName, newDn );
+            groupCache.groupRenamed( oriChildName, newDn );
             return;
         }
 
@@ -960,7 +959,7 @@ public class AciAuthorizationInterceptor
         // and access control subentry operational attributes.
         SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class
             .getName() );
-        Entry subentryAttrs = subentryInterceptor.getSubentryAttributes( newName, importedEntry
);
+        Entry subentryAttrs = subentryInterceptor.getSubentryAttributes( newDn, importedEntry
);
 
         for ( EntryAttribute attribute : importedEntry )
         {
@@ -969,15 +968,15 @@ public class AciAuthorizationInterceptor
 
         Collection<ACITuple> destTuples = new HashSet<ACITuple>();
         // Import permission is only valid for prescriptive ACIs
-        addPerscriptiveAciTuples( moveContext, destTuples, newName, subentryAttrs );
+        addPerscriptiveAciTuples( moveContext, destTuples, newDn, subentryAttrs );
         // Evaluate the target context to see whether it
         // allows an entry named newName to be imported as a subordinate.
         engine.checkPermission( schemaManager, moveContext, userGroups, principalDn,
-            principal.getAuthenticationLevel(), newName, null, null, IMPORT_PERMS, destTuples,
subentryAttrs, null );
+            principal.getAuthenticationLevel(), newDn, null, null, IMPORT_PERMS, destTuples,
subentryAttrs, null );
 
         next.move( moveContext );
-        tupleCache.subentryRenamed( oriChildName, newName );
-        groupCache.groupRenamed( oriChildName, newName );
+        tupleCache.subentryRenamed( oriChildName, newDn );
+        groupCache.groupRenamed( oriChildName, newDn );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
Tue Jun  8 21:52:57 2010
@@ -353,7 +353,7 @@ public class DefaultAuthorizationInterce
             throw new LdapNoPermissionException( msg );
         }
 
-        if ( dn.getNormName().equals( ADMIN_GROUP_DN.getNormName() ) )
+        if ( dn.equals( ADMIN_GROUP_DN ) )
         {
             String msg = I18n.err( I18n.ERR_21 );
             LOG.error( msg );
@@ -367,14 +367,14 @@ public class DefaultAuthorizationInterce
             throw new LdapNoPermissionException( msg );
         }
 
-        if ( dn.size() > 2 && dn.isChildOf( ADMIN_SYSTEM_DN ) && !isAnAdministrator(
principalDn ) )
+        if ( ( dn.size() > 2 ) && dn.isChildOf( ADMIN_SYSTEM_DN ) && !isAnAdministrator(
principalDn ) )
         {
             String msg = I18n.err( I18n.ERR_23, principalDn.getName(), dn.getName() );
             LOG.error( msg );
             throw new LdapNoPermissionException( msg );
         }
 
-        if ( dn.size() > 2 && dn.isChildOf( GROUP_BASE_DN ) && !isAnAdministrator(
principalDn ) )
+        if ( ( dn.size() > 2 ) && dn.isChildOf( GROUP_BASE_DN ) && !isAnAdministrator(
principalDn ) )
         {
             String msg = I18n.err( I18n.ERR_24, principalDn.getName(), dn.getName() );
             LOG.error( msg );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
Tue Jun  8 21:52:57 2010
@@ -387,7 +387,7 @@ public class ExceptionInterceptor extend
         DN oriChildName = opContext.getDn();
         DN newParentName = opContext.getParent();
 
-        if ( oriChildName.getNormName().equalsIgnoreCase( subschemSubentryDn.getNormName()
) )
+        if ( oriChildName.equals( subschemSubentryDn ) )
         {
             throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
I18n.err( I18n.ERR_258,
                 subschemSubentryDn, subschemSubentryDn ) );
@@ -402,9 +402,7 @@ public class ExceptionInterceptor extend
         assertHasEntry( opContext, msg, newParentName );
 
         // check to see if target entry exists
-        String rdn = oriChildName.get( oriChildName.size() - 1 );
-        DN target = ( DN ) newParentName.clone();
-        target.add( rdn );
+        DN target = opContext.getNewDn();
 
         if ( nextInterceptor.hasEntry( new EntryOperationContext( opContext.getSession(),
target ) ) )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
Tue Jun  8 21:52:57 2010
@@ -185,6 +185,12 @@ public class NormalizationInterceptor ex
         {
             opContext.getParent().normalize( schemaManager.getNormalizerMapping() );
         }
+        
+        if ( !opContext.getNewDn().isNormalized() )
+        {
+            opContext.getNewDn().normalize( schemaManager.getNormalizerMapping() );
+        }
+        
 
         nextInterceptor.move( opContext );
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
Tue Jun  8 21:52:57 2010
@@ -291,10 +291,7 @@ public class ReferralInterceptor extends
      **/
     public void move( NextInterceptor next, MoveOperationContext opContext ) throws LdapException
     {
-        DN oldName = opContext.getDn();
-
-        DN newName = ( DN ) opContext.getParent().clone();
-        newName.add( oldName.get( oldName.size() - 1 ) );
+        DN newDn = opContext.getNewDn();
 
         // Check if the entry is a referral itself
         boolean isReferral = isReferral( opContext.getEntry() );
@@ -304,7 +301,7 @@ public class ReferralInterceptor extends
         if ( isReferral )
         {
             // Update the referralManager
-            LookupOperationContext lookupContext = new LookupOperationContext( opContext.getSession(),
newName );
+            LookupOperationContext lookupContext = new LookupOperationContext( opContext.getSession(),
newDn );
 
             Entry newEntry = nexus.lookup( lookupContext );
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=952834&r1=952833&r2=952834&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
Tue Jun  8 21:52:57 2010
@@ -1035,8 +1035,7 @@ public class SubentryInterceptor extends
 
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes
-            DN newName = ( DN ) newParentName.clone();
-            newName.add( oriChildName.get( oriChildName.size() - 1 ) );
+            DN newName = opContext.getNewDn();
             List<Modification> mods = getModsOnEntryRdnChange( oriChildName, newName,
entry );
 
             if ( mods.size() > 0 )



Mime
View raw message