You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/08/07 04:12:59 UTC
svn commit: r683472 -
/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Author: akarasulu
Date: Wed Aug 6 19:12:58 2008
New Revision: 683472
URL: http://svn.apache.org/viewvc?rev=683472&view=rev
Log:
Fix for DIRSERVER-1224:
o Move and Move+Rename operations were not properly setting the DN of the
target entry being moved even though indices were being properly updated.
Fixed by adding entry update with dn change. This is due to switch from
Attributes to ServerEntry where the ServerEntry contains the DN.
o Fixed some hanging cursors and some unnecessary code.
-This line, and those below, will be ignored--
M JdbmStore.java
Modified:
directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=683472&r1=683471&r2=683472&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Wed Aug 6 19:12:58 2008
@@ -49,6 +49,7 @@
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.IndexNotFoundException;
import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.tools.IndexUtils;
import org.apache.directory.shared.ldap.MultiException;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -1676,15 +1677,15 @@
{
String aliasTarget;
- // Now we can handle the appropriate name userIndices for all cases
+ // update normalized DN index
ndnIdx.drop( id );
-
if ( !updn.isNormalized() )
{
updn.normalize( attributeTypeRegistry.getNormalizerMapping() );
}
-
- ndnIdx.add( ndnIdx.getNormalized( updn.toNormName() ), id );
+ ndnIdx.add( updn.toNormName(), id );
+
+ // update user provided DN index
updnIdx.drop( id );
updnIdx.add( updn.getUpName(), id );
@@ -1735,6 +1736,8 @@
// Recursively change the names of the children below
modifyDn( childId, childUpdn, isMove );
}
+
+ children.close();
}
@@ -1742,7 +1745,12 @@
{
Long childId = getEntryId( oldChildDn.toString() );
rename( oldChildDn, newRdn, deleteOldRdn );
- move( oldChildDn, childId, newParentDn );
+ LdapDN newUpdn = move( oldChildDn, childId, newParentDn );
+
+ // Update the current entry
+ ServerEntry entry = lookup( childId );
+ entry.setDn( newUpdn );
+ master.put( childId, entry );
if ( isSyncOnWrite )
{
@@ -1754,7 +1762,12 @@
public void move( LdapDN oldChildDn, LdapDN newParentDn ) throws Exception
{
Long childId = getEntryId( oldChildDn.toString() );
- move( oldChildDn, childId, newParentDn );
+ LdapDN newUpdn = move( oldChildDn, childId, newParentDn );
+
+ // Update the current entry
+ ServerEntry entry = lookup( childId );
+ entry.setDn( newUpdn );
+ master.put( childId, entry );
if ( isSyncOnWrite )
{
@@ -1777,7 +1790,7 @@
* @param newParentDn the normalized dn of the new parent for the child
* @throws NamingException if something goes wrong
*/
- private void move( LdapDN oldChildDn, Long childId, LdapDN newParentDn ) throws Exception
+ private LdapDN move( LdapDN oldChildDn, Long childId, LdapDN newParentDn ) throws Exception
{
// Get the child and the new parent to be entries and Ids
Long newParentId = getEntryId( newParentDn.toString() );
@@ -1799,7 +1812,7 @@
*/
oneLevelIdx.drop( oldParentId, childId );
oneLevelIdx.add( newParentId, childId );
-
+
updateSubLevelIndex( childId, oldParentId, newParentId );
/*
@@ -1814,6 +1827,8 @@
// Call the modifyDn operation with the new updn
modifyDn( childId, newUpdn, true );
+
+ return newUpdn;
}