directory-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=954755&view=rev
Log:
o Reverted the last two commits that were braking the build
o added a @Ignore for Ldif tests : there is a difference between Java 5 and Java 6 when dumping
Attribute

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.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/event/EventInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
    directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java?rev=954755&r1=954754&r2=954755&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
Tue Jun 15 08:47:57 2010
@@ -40,6 +40,9 @@ public class MoveAndRenameOperationConte
     /** The new superior DN */
     private DN newSuperiorDn;
 
+    /** Cached calculated new DN after move and rename */
+    private DN newDn;
+
     /**
      * Creates a new instance of MoveAndRenameOperationContext.
      */
@@ -120,6 +123,18 @@ public class MoveAndRenameOperationConte
 
     
     /**
+     * Gets cached copy of already computed new name or creates it if not 
+     *
+     * @return the normalized new name after move and rename
+     * @throws Exception if the name cannot be normalized
+     */
+    public DN getNewDn()
+    {
+        return newDn;
+    }
+    
+
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java?rev=954755&r1=954754&r2=954755&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
Tue Jun 15 08:47:57 2010
@@ -25,6 +25,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
 import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControl;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
@@ -44,11 +45,15 @@ public class RenameOperationContext exte
     private RDN newRdn;
 
     /** Cached copy of the new DN */
-    protected DN newDn;
+    private DN newDn;
 
     /** The flag to remove the old RDN Attribute  */
     private boolean deleteOldRdn;
 
+    /** The entry after being renamed and altered for rdn attributes */ 
+    private ClonedServerEntry alteredEntry;
+    
+
     /**
      * Creates a new instance of RenameOperationContext.
      */
@@ -107,6 +112,16 @@ public class RenameOperationContext exte
 
 
     /**
+     * Set the flag to delete the old RDN
+     * @param deleteOldRdn the flag to set
+     */
+    public void setDelOldDn( boolean deleteOldRdn ) 
+    {
+        this.deleteOldRdn = deleteOldRdn;
+    }
+
+
+    /**
      * @return The new DN either computed if null or already computed
      */
     public DN getNewDn()
@@ -125,6 +140,16 @@ public class RenameOperationContext exte
 
 
     /**
+     * Set the new RDN
+     * @param newRdn The new RDN
+     */
+    public void setNewRdn( RDN newRdn )
+    {
+        this.newRdn = newRdn;
+    }
+
+
+    /**
      * Set the new DN
      * @param newDn The new DN
      */
@@ -144,6 +169,30 @@ public class RenameOperationContext exte
     
     
     /**
+     * Returns the entry after it has been renamed and potentially changed for 
+     * RDN alterations.
+     *
+     * @return the new renamed entry
+     */
+    public ClonedServerEntry getAlteredEntry()
+    {
+        return alteredEntry;
+    }
+
+    
+    /**
+     * Set the modified entry once the operation has been proceced
+     * on the backend.
+     *
+     * @param alteredEntry The modified entry
+     */
+    public void setAlteredEntry( ClonedServerEntry alteredEntry ) 
+    {
+        this.alteredEntry = alteredEntry;
+    }
+    
+    
+    /**
      * @see Object#toString()
      */
     public String toString()

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=954755&r1=954754&r2=954755&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 15 08:47:57 2010
@@ -831,13 +831,15 @@ public class AciAuthorizationInterceptor
     public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext
)
         throws LdapException
     {
-        DN oldDn = moveAndRenameContext.getDn();
-        DN newDn = moveAndRenameContext.getNewDn();
+        DN oriChildName = moveAndRenameContext.getDn();
+        DN newParentName = moveAndRenameContext.getNewSuperiorDn();
 
         Entry entry = moveAndRenameContext.getOriginalEntry();
 
         LdapPrincipal principal = moveAndRenameContext.getSession().getEffectivePrincipal();
         DN principalDn = principal.getDN();
+        DN newName = ( DN ) newParentName.clone();
+        newName.add( moveAndRenameContext.getNewRdn().getName() );
 
         // bypass authz code if we are disabled
         if ( !moveAndRenameContext.getSession().getDirectoryService().isAccessControlEnabled()
)
@@ -846,25 +848,26 @@ public class AciAuthorizationInterceptor
             return;
         }
 
-        protectCriticalEntries( oldDn );
+        protectCriticalEntries( oriChildName );
 
         // bypass authz code but manage caches if operation is performed by the admin
         if ( isPrincipalAnAdministrator( principalDn ) )
         {
             next.moveAndRename( moveAndRenameContext );
-            tupleCache.subentryRenamed( oldDn, newDn );
-            groupCache.groupRenamed( oldDn, newDn );
+            tupleCache.subentryRenamed( oriChildName, newName );
+            groupCache.groupRenamed( oriChildName, newName );
             return;
         }
 
         Set<DN> userGroups = groupCache.getGroups( principalDn.getNormName() );
         Collection<ACITuple> tuples = new HashSet<ACITuple>();
-        addPerscriptiveAciTuples( moveAndRenameContext, tuples, oldDn, entry );
+        addPerscriptiveAciTuples( moveAndRenameContext, tuples, oriChildName, ( ( ClonedServerEntry
) entry )
+            .getOriginalEntry() );
         addEntryAciTuples( tuples, entry );
-        addSubentryAciTuples( moveAndRenameContext, tuples, oldDn, entry );
+        addSubentryAciTuples( moveAndRenameContext, tuples, oriChildName, entry );
 
         engine.checkPermission( schemaManager, moveAndRenameContext, userGroups, principalDn,
principal
-            .getAuthenticationLevel(), oldDn, null, null, MOVERENAME_PERMS, tuples, entry,
null );
+            .getAuthenticationLevel(), oriChildName, null, null, MOVERENAME_PERMS, tuples,
entry, null );
 
         // Get the entry again without operational attributes
         // because access control subentry operational attributes
@@ -872,7 +875,8 @@ public class AciAuthorizationInterceptor
         // This will certainly be fixed by the SubentryInterceptor,
         // but after this service.
 
-        Entry importedEntry = moveAndRenameContext.lookup( oldDn, ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS
);
+        Entry importedEntry = moveAndRenameContext.lookup( oriChildName,
+            ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
 
         // As the target entry does not exist yet and so
         // its subentry operational attributes are not there,
@@ -881,7 +885,7 @@ public class AciAuthorizationInterceptor
         // and access control subentry operational attributes.
         SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class
             .getName() );
-        Entry subentryAttrs = subentryInterceptor.getSubentryAttributes( newDn, importedEntry
);
+        Entry subentryAttrs = subentryInterceptor.getSubentryAttributes( newName, importedEntry
);
 
         for ( EntryAttribute attribute : importedEntry )
         {
@@ -890,15 +894,15 @@ public class AciAuthorizationInterceptor
 
         Collection<ACITuple> destTuples = new HashSet<ACITuple>();
         // Import permission is only valid for prescriptive ACIs
-        addPerscriptiveAciTuples( moveAndRenameContext, destTuples, newDn, subentryAttrs
);
+        addPerscriptiveAciTuples( moveAndRenameContext, destTuples, newName, subentryAttrs
);
         // Evaluate the target context to see whether it
         // allows an entry named newName to be imported as a subordinate.
         engine.checkPermission( schemaManager, moveAndRenameContext, userGroups, principalDn,
principal
-            .getAuthenticationLevel(), newDn, null, null, IMPORT_PERMS, destTuples, subentryAttrs,
null );
+            .getAuthenticationLevel(), newName, null, null, IMPORT_PERMS, destTuples, subentryAttrs,
null );
 
         next.moveAndRename( moveAndRenameContext );
-        tupleCache.subentryRenamed( oldDn, newDn );
-        groupCache.groupRenamed( oldDn, newDn );
+        tupleCache.subentryRenamed( oriChildName, newName );
+        groupCache.groupRenamed( oriChildName, newName );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=954755&r1=954754&r2=954755&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
Tue Jun 15 08:47:57 2010
@@ -224,7 +224,7 @@ public class EventInterceptor extends Ba
 
         // Get the modifed entry
         Entry alteredEntry = opContext.lookup( opContext.getNewDn(), ByPassConstants.LOOKUP_BYPASS
);
-        opContext.setModifiedEntry( ( ClonedServerEntry ) alteredEntry );
+        opContext.setAlteredEntry( ( ClonedServerEntry ) alteredEntry );
 
         for ( final RegistrationEntry registration : selecting )
         {
@@ -247,7 +247,7 @@ public class EventInterceptor extends Ba
             return;
         }
 
-        moveAndRenameContext.setModifiedEntry( moveAndRenameContext.lookup( moveAndRenameContext.getNewDn(),
+        moveAndRenameContext.setAlteredEntry( ( ClonedServerEntry ) moveAndRenameContext.lookup(
moveAndRenameContext.getNewDn(),
             ByPassConstants.LOOKUP_BYPASS ) );
 
         for ( final RegistrationEntry registration : selecting )

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=954755&r1=954754&r2=954755&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 15 08:47:57 2010
@@ -213,8 +213,10 @@ public class NormalizationInterceptor ex
     public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext
moveAndRenameContext )
         throws LdapException
     {
-        RDN rdn = moveAndRenameContext.getNewRdn();
+        DN rdn = new DN();
+        rdn.add( moveAndRenameContext.getNewRdn() );
         rdn.normalize( schemaManager.getNormalizerMapping() );
+        moveAndRenameContext.setNewRdn( rdn.getRdn() );
 
         if ( !moveAndRenameContext.getDn().isNormalized() )
         {

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=954755&r1=954754&r2=954755&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
Tue Jun 15 08:47:57 2010
@@ -363,7 +363,7 @@ public class LdifPartition extends BTree
 
         // Get the modified entry and store it in the context for post usage
         ClonedServerEntry modifiedEntry = lookup( id );
-        moveAndRenameContext.setModifiedEntry( modifiedEntry );
+        moveAndRenameContext.setAlteredEntry( modifiedEntry );
 
         entryMoved( oldDn, modifiedEntry, id );
     }
@@ -383,7 +383,7 @@ public class LdifPartition extends BTree
 
         // Get the modified entry and store it in the context for post usage
         ClonedServerEntry modifiedEntry = lookup( id );
-        renameContext.setModifiedEntry( modifiedEntry );
+        renameContext.setAlteredEntry( modifiedEntry );
 
         // Now move the potential children for the old entry
         // and remove the old entry

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java?rev=954755&r1=954754&r2=954755&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
Tue Jun 15 08:47:57 2010
@@ -189,16 +189,7 @@ public class PersistentSearchListener im
 
     public void entryMovedAndRenamed( MoveAndRenameOperationContext opContext )
     {
-        if ( ! control.isNotificationEnabled( ChangeType.MODDN ) )
-        {
-            return;
-        }
-    
-        InternalSearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId()
);
-        respEntry.setObjectName( opContext.getModifiedEntry().getDn() );
-        respEntry.setEntry( opContext.getModifiedEntry() );
-        setECResponseControl( respEntry, opContext, ChangeType.MODDN );
-        session.getIoSession().write( respEntry );
+        entryRenamed( opContext );
     }
 
 
@@ -210,8 +201,8 @@ public class PersistentSearchListener im
         }
     
         InternalSearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId()
);
-        respEntry.setObjectName( opContext.getModifiedEntry().getDn() );
-        respEntry.setEntry( opContext.getModifiedEntry() );
+        respEntry.setObjectName( opContext.getAlteredEntry().getDn() );
+        respEntry.setEntry( opContext.getAlteredEntry() );
         setECResponseControl( respEntry, opContext, ChangeType.MODDN );
         session.getIoSession().write( respEntry );
     }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java?rev=954755&r1=954754&r2=954755&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
Tue Jun 15 08:47:57 2010
@@ -318,10 +318,10 @@ public class SyncReplSearchListener impl
 
             if ( pushInRealTime )
             {
-                Entry alteredEntry = opContext.getModifiedEntry();
+                Entry alteredEntry = opContext.getAlteredEntry();
                 
                 InternalSearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId()
);
-                respEntry.setObjectName( opContext.getModifiedEntry().getDn() );
+                respEntry.setObjectName( opContext.getAlteredEntry().getDn() );
                 respEntry.setEntry( alteredEntry );
 
                 SyncStateValueControl syncModify = new SyncStateValueControl();
@@ -372,13 +372,13 @@ public class SyncReplSearchListener impl
                 syncModify.setSyncStateType( SyncStateTypeEnum.MODDN );
                 syncModify.setEntryUUID( StringTools.uuidToBytes( entry.get(
                     SchemaConstants.ENTRY_UUID_AT ).getString() ) );
-                syncModify.setCookie( getCookie( opContext.getModifiedEntry() ) );
+                syncModify.setCookie( getCookie( opContext.getAlteredEntry() ) );
                 respEntry.add( syncModify );
                 respEntry.add( modDnControl );
                 
                 WriteFuture future = session.getIoSession().write( respEntry );
                 
-                handleWriteFuture( future, opContext.getModifiedEntry(), null, modDnControl
);
+                handleWriteFuture( future, opContext.getAlteredEntry(), null, modDnControl
);
             }
             else
             {

Modified: directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java?rev=954755&r1=954754&r2=954755&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
(original)
+++ directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
Tue Jun 15 08:47:57 2010
@@ -46,6 +46,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -486,6 +487,7 @@ public class LdifUtilsTest
     
     
     @Test
+    @Ignore("The attributes are not printed in the same order in Java5 and Java6")
     public void testConvertEntryNoControls() throws Exception 
     {
         String expected = 
@@ -515,6 +517,7 @@ public class LdifUtilsTest
     
     
     @Test
+    @Ignore("The attributes are not printed in the same order in Java5 and Java6")
     public void testConvertEntryOneControl() throws Exception 
     {
         String expected = 



Mime
View raw message