directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1031620 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/ core-integ/src/test/java/org/apache/directory/server/core/operational/ core/src/main/java/org/apache/directory/server/core/operati...
Date Fri, 05 Nov 2010 15:15:08 GMT
Author: seelmann
Date: Fri Nov  5 15:15:07 2010
New Revision: 1031620

URL: http://svn.apache.org/viewvc?rev=1031620&view=rev
Log:
Use modifiedEntry instead of clonedEntry for rename operation. RDN changes are not applied
in modifiedEntry, so must be applied in the backend.

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=1031620&r1=1031619&r2=1031620&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
Fri Nov  5 15:15:07 2010
@@ -822,6 +822,9 @@ public class InterceptorChain
         Interceptor head = entry.interceptor;
         NextInterceptor next = entry.nextInterceptor;
         eagerlyPopulateFields( renameContext );
+        Entry originalEntry = getOriginalEntry( renameContext );
+        renameContext.setOriginalEntry( originalEntry );
+        renameContext.setModifiedEntry( originalEntry.clone() );
 
         try
         {

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java?rev=1031620&r1=1031619&r2=1031620&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
Fri Nov  5 15:15:07 2010
@@ -42,7 +42,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
-import org.apache.directory.shared.ldap.message.ModifyDnResponse;
 import org.apache.directory.shared.ldap.message.ModifyResponse;
 import org.apache.directory.shared.ldap.message.Response;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -362,8 +361,7 @@ public class OperationalAttributeService
         assertNull( entry.get( "modifiersName" ) );
         assertNull( entry.get( "modifyTimestamp" ) );
 
-        ModifyDnResponse rename = connection.rename( DN_KATE_BUSH, "cn=KB" );
-        System.out.println( rename );
+        connection.rename( DN_KATE_BUSH, "cn=KB" );
 
         entry = connection.lookup( "cn=KB,ou=system", "*", "+" );
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1031620&r1=1031619&r2=1031620&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
Fri Nov  5 15:15:07 2010
@@ -327,6 +327,12 @@ public class OperationalAttributeInterce
         entry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
         entry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
+        Entry modifiedEntry = renameContext.getOriginalEntry().clone();
+        modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
+        modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        //modifiedEntry.setDn( renameContext.getNewDn() );
+        renameContext.setModifiedEntry( modifiedEntry );
+
         nextInterceptor.rename( renameContext );
     }
 

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java?rev=1031620&r1=1031619&r2=1031620&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
Fri Nov  5 15:15:07 2010
@@ -381,13 +381,18 @@ public abstract class AbstractXdbmPartit
     {
         try
         {
+            DN oldDn = renameContext.getDn();
+            RDN newRdn = renameContext.getNewRdn();
+            boolean deleteOldRdn = renameContext.getDeleteOldRdn();
+
             if ( renameContext.getEntry() != null )
             {
-                store.rename( renameContext.getDn(), renameContext.getNewRdn(), renameContext.getDeleteOldRdn(),
renameContext.getEntry().getClonedEntry() );
+                Entry modifiedEntry = renameContext.getModifiedEntry();
+                store.rename( oldDn, newRdn, deleteOldRdn, modifiedEntry );
             }
             else
             {
-                store.rename( renameContext.getDn(), renameContext.getNewRdn(), renameContext.getDeleteOldRdn()
);
+                store.rename( oldDn, newRdn, deleteOldRdn );
             }
         }
         catch ( Exception e )

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1031620&r1=1031619&r2=1031620&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
Fri Nov  5 15:15:07 2010
@@ -1171,11 +1171,9 @@ public abstract class AbstractStore<E, I
     public synchronized void rename( DN dn, RDN newRdn, boolean deleteOldRdn, Entry entry
) throws Exception
     {
         ID id = getEntryId( dn );
-        boolean hasEntry = true;
 
         if ( entry == null )
         {
-            hasEntry = false;
             entry = lookup( id );
         }
 
@@ -1197,12 +1195,9 @@ public abstract class AbstractStore<E, I
             String newNormType = newAtav.getNormType();
             Object newNormValue = newAtav.getNormValue().get();
 
-            if ( ! hasEntry )
-            {
-                AttributeType newRdnAttrType = schemaManager.lookupAttributeTypeRegistry(
newNormType );
+            AttributeType newRdnAttrType = schemaManager.lookupAttributeTypeRegistry( newNormType
);
 
-                entry.add( newRdnAttrType, newAtav.getUpValue() );
-            }
+            entry.add( newRdnAttrType, newAtav.getUpValue() );
 
             if ( hasUserIndexOn( newNormType ) )
             {



Mime
View raw message