directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1142153 - in /directory/apacheds/branches/apacheds-no-reverse-index: jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm...
Date Sat, 02 Jul 2011 04:59:44 GMT
Author: elecharny
Date: Sat Jul  2 04:59:43 2011
New Revision: 1142153

URL: http://svn.apache.org/viewvc?rev=1142153&view=rev
Log:
o Cleaned up the JdbmStoreTest and AvlStore classes
o Prepared code for migration of the rename operation
o Removed an useless rename() method

Modified:
    directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
    directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
    directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
    directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
    directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java

Modified: directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1142153&r1=1142152&r2=1142153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
(original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
Sat Jul  2 04:59:43 2011
@@ -129,10 +129,10 @@ public class JdbmStoreTest
 
         EXAMPLE_COM = new Dn( schemaManager, "dc=example,dc=com" );
 
-        OU_AT = schemaManager.getAttributeType( SchemaConstants.OU_AT );
-        DC_AT = schemaManager.getAttributeType( SchemaConstants.DC_AT );
-        SN_AT = schemaManager.getAttributeType( SchemaConstants.SN_AT );
-        APACHE_ALIAS_AT = schemaManager.getAttributeType( ApacheSchemaConstants.APACHE_ALIAS_AT
);
+        OU_AT = schemaManager.getAttributeType( "ou" );
+        DC_AT = schemaManager.getAttributeType( "dc" );
+        SN_AT = schemaManager.getAttributeType( "sn" );
+        APACHE_ALIAS_AT = schemaManager.getAttributeType( "apacheAlias" );
     }
 
 
@@ -214,11 +214,13 @@ public class JdbmStoreTest
 
         // inject context entry
         Dn suffixDn = new Dn( schemaManager, "dc=example,dc=com" );
-        Entry entry = new DefaultEntry( schemaManager, suffixDn );
-        entry.add( "objectClass", "top", "domain" );
-        entry.add( "dc", "example" );
-        entry.add( SchemaConstants.ENTRY_CSN_AT, new CsnFactory( 0 ).newInstance().toString()
);
-        entry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
+        Entry entry = new DefaultEntry( schemaManager, suffixDn,
+            "objectClass: top", 
+            "objectClass: domain",
+            "dc: example",
+            "entryCSN", new CsnFactory( 0 ).newInstance().toString(),
+            SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
+        
         store2.add( entry );
 
         // lookup the context entry
@@ -516,13 +518,15 @@ public class JdbmStoreTest
 
         // add an alias and delete to test dropAliasIndices method
         Dn dn = new Dn( schemaManager, "commonName=Jack Daniels,ou=Apache,ou=Board of Directors,o=Good
Times Co." );
-        Entry entry = new DefaultEntry( schemaManager, dn );
-        entry.add( "objectClass", "top", "alias", "extensibleObject" );
-        entry.add( "ou", "Apache" );
-        entry.add( "commonName", "Jack Daniels" );
-        entry.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co."
);
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        Entry entry = new DefaultEntry( schemaManager, dn,
+            "objectClass: top", 
+            "objectClass: alias", 
+            "objectClass: extensibleObject",
+            "ou: Apache",
+            "commonName: Jack Daniels",
+            "aliasedObjectName: cn=Jack Daniels,ou=Engineering,o=Good Times Co.",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
         store.add( entry );
 
         store.delete( dn ); // drops the alias indices
@@ -563,12 +567,15 @@ public class JdbmStoreTest
 
         // dn id 12
         Dn martinDn = new Dn( schemaManager, "cn=Marting King,ou=Sales,o=Good Times Co."
);
-        Entry entry = new DefaultEntry( schemaManager, martinDn );
-        entry.add( "objectClass", "top", "person", "organizationalPerson" );
-        entry.add( "ou", "Sales" );
-        entry.add( "cn", "Martin King" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        Entry entry = new DefaultEntry( schemaManager, martinDn,
+            "objectClass: top", 
+            "objectClass: person", 
+            "objectClass: organizationalPerson",
+            "ou: Sales",
+            "cn: Martin King",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
+        
         store.add( entry );
 
         cursor = subLevelIdx.forwardCursor( 2L );
@@ -588,21 +595,24 @@ public class JdbmStoreTest
 
         // dn id 13
         Dn marketingDn = new Dn( schemaManager, "ou=Marketing,ou=Sales,o=Good Times Co."
);
-        entry = new DefaultEntry( schemaManager, marketingDn );
-        entry.add( "objectClass", "top", "organizationalUnit" );
-        entry.add( "ou", "Marketing" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        entry = new DefaultEntry( schemaManager, marketingDn,
+            "objectClass: top", 
+            "objectClass: organizationalUnit",
+            "ou: Marketing",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
         store.add( entry );
 
         // dn id 14
         Dn jimmyDn = new Dn( schemaManager, "cn=Jimmy Wales,ou=Marketing, ou=Sales,o=Good
Times Co." );
-        entry = new DefaultEntry( schemaManager, jimmyDn );
-        entry.add( "objectClass", "top", "person", "organizationalPerson" );
-        entry.add( "ou", "Marketing" );
-        entry.add( "cn", "Jimmy Wales" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        entry = new DefaultEntry( schemaManager, jimmyDn,
+            "objectClass: top", 
+            "objectClass: person", 
+            "objectClass: organizationalPerson",
+            "ou: Marketing",
+            "cn: Jimmy Wales",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
         store.add( entry );
 
         newDn = newParentDn.add( marketingDn.getRdn() );
@@ -662,12 +672,14 @@ public class JdbmStoreTest
     public void testAddWithoutParentId() throws Exception
     {
         Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co."
);
-        Entry entry = new DefaultEntry( schemaManager, dn );
-        entry.add( "objectClass", "top", "person", "organizationalPerson" );
-        entry.add( "ou", "Not Present" );
-        entry.add( "cn", "Martin King" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        Entry entry = new DefaultEntry( schemaManager, dn,
+            "objectClass: top", 
+            "objectClass: person",
+            "objectClass: organizationalPerson",
+            "ou: Not Present",
+            "cn: Martin King",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
         store.add( entry );
     }
 
@@ -678,7 +690,7 @@ public class JdbmStoreTest
         Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
 
         List<Modification> mods = new ArrayList<Modification>();
-        Attribute attrib = new DefaultAttribute( SchemaConstants.OU_AT, OU_AT );
+        Attribute attrib = new DefaultAttribute( "ou", OU_AT );
         attrib.add( "Engineering" );
 
         Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
attrib );
@@ -693,18 +705,20 @@ public class JdbmStoreTest
     public void testRename() throws Exception
     {
         Dn dn = new Dn( schemaManager, "cn=Pivate Ryan,ou=Engineering,o=Good Times Co." );
-        Entry entry = new DefaultEntry( schemaManager, dn );
-        entry.add( "objectClass", "top", "person", "organizationalPerson" );
-        entry.add( "ou", "Engineering" );
-        entry.add( "cn", "Private Ryan" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        Entry entry = new DefaultEntry( schemaManager, dn,
+            "objectClass: top", 
+            "objectClass: person", 
+            "objectClass: organizationalPerson",
+            "ou", "Engineering",
+            "cn", "Private Ryan",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
 
         store.add( entry );
 
         Rdn rdn = new Rdn( "sn=James" );
 
-        store.rename( dn, rdn, true );
+        store.rename( dn, rdn, true, entry );
     }
 
 
@@ -712,18 +726,20 @@ public class JdbmStoreTest
     public void testRenameEscaped() throws Exception
     {
         Dn dn = new Dn( schemaManager, "cn=Pivate Ryan,ou=Engineering,o=Good Times Co." );
-        Entry entry = new DefaultEntry( schemaManager, dn );
-        entry.add( "objectClass", "top", "person", "organizationalPerson" );
-        entry.add( "ou", "Engineering" );
-        entry.add( "cn", "Private Ryan" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        Entry entry = new DefaultEntry( schemaManager, dn,
+            "objectClass: top", 
+            "objectClass: person", 
+            "objectClass: organizationalPerson",
+            "ou", "Engineering",
+            "cn", "Private Ryan",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
 
         store.add( entry );
 
         Rdn rdn = new Rdn( "sn=Ja\\+es" );
 
-        store.rename( dn, rdn, true );
+        store.rename( dn, rdn, true, entry );
 
         Dn dn2 = new Dn( schemaManager, "sn=Ja\\+es,ou=Engineering,o=Good Times Co." );
         Long id = store.getEntryId( dn2 );
@@ -785,7 +801,7 @@ public class JdbmStoreTest
         Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
 
         List<Modification> mods = new ArrayList<Modification>();
-        Attribute attrib = new DefaultAttribute( SchemaConstants.SURNAME_AT, SN_AT );
+        Attribute attrib = new DefaultAttribute( "sn", SN_AT );
 
         String attribVal = "Walker";
         attrib.add( attribVal );
@@ -815,7 +831,7 @@ public class JdbmStoreTest
         Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
 
         List<Modification> mods = new ArrayList<Modification>();
-        Attribute attrib = new DefaultAttribute( SchemaConstants.SN_AT, SN_AT );
+        Attribute attrib = new DefaultAttribute( "sn", SN_AT );
 
         String attribVal = "Johnny";
         attrib.add( attribVal );
@@ -846,7 +862,7 @@ public class JdbmStoreTest
         Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
 
         List<Modification> mods = new ArrayList<Modification>();
-        Attribute attrib = new DefaultAttribute( SchemaConstants.SN_AT, SN_AT );
+        Attribute attrib = new DefaultAttribute( "sn", SN_AT );
 
         Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
attrib );
         mods.add( add );
@@ -875,16 +891,18 @@ public class JdbmStoreTest
     public void testModifyReplaceNonExistingIndexAttribute() throws Exception
     {
         Dn dn = new Dn( schemaManager, "cn=Tim B,ou=Sales,o=Good Times Co." );
-        Entry entry = new DefaultEntry( schemaManager, dn );
-        entry.add( "objectClass", "top", "person", "organizationalPerson" );
-        entry.add( "cn", "Tim B" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        Entry entry = new DefaultEntry( schemaManager, dn,
+            "objectClass: top", 
+            "objectClass: person", 
+            "objectClass: organizationalPerson",
+            "cn: Tim B",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
 
         store.add( entry );
 
         List<Modification> mods = new ArrayList<Modification>();
-        Attribute attrib = new DefaultAttribute( SchemaConstants.OU_AT, OU_AT );
+        Attribute attrib = new DefaultAttribute( "ou", OU_AT );
 
         String attribVal = "Marketing";
         attrib.add( attribVal );
@@ -943,5 +961,4 @@ public class JdbmStoreTest
         assertTrue( uuidIndexDbFile.exists() );
         assertTrue( uuidIndexTxtFile.exists() );
     }
-
 }

Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java?rev=1142153&r1=1142152&r2=1142153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
(original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
Sat Jul  2 04:59:43 2011
@@ -383,16 +383,9 @@ public abstract class AbstractXdbmPartit
             Dn oldDn = renameContext.getDn();
             Rdn newRdn = renameContext.getNewRdn();
             boolean deleteOldRdn = renameContext.getDeleteOldRdn();
-
-            if ( renameContext.getEntry() != null )
-            {
-                Entry modifiedEntry = renameContext.getModifiedEntry();
-                store.rename( oldDn, newRdn, deleteOldRdn, modifiedEntry );
-            }
-            else
-            {
-                store.rename( oldDn, newRdn, deleteOldRdn );
-            }
+            
+            Entry modifiedEntry = renameContext.getModifiedEntry();
+            store.rename( oldDn, newRdn, deleteOldRdn, modifiedEntry );
         }
         catch ( Exception e )
         {

Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1142153&r1=1142152&r2=1142153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
(original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
Sat Jul  2 04:59:43 2011
@@ -1393,15 +1393,6 @@ public abstract class AbstractStore<E, I
     /**
      * {@inheritDoc}
      */
-    public synchronized void rename( Dn dn, Rdn newRdn, boolean deleteOldRdn ) throws Exception
-    {
-        rename( dn, newRdn, deleteOldRdn, null );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public synchronized void moveAndRename( Dn oldDn, Dn newSuperiorDn, Rdn newRdn, Entry
modifiedEntry, boolean deleteOldRdn ) throws Exception
     {
     	// Check that the old entry exists
@@ -1453,15 +1444,6 @@ public abstract class AbstractStore<E, I
     /**
      * {@inheritDoc}
      */
-    public synchronized void move( Dn oldDn, Dn newSuperiorDn, Dn newDn  ) throws Exception
-    {
-        move( oldDn, newSuperiorDn, newDn, null );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public synchronized void move( Dn oldDn, Dn newSuperiorDn, Dn newDn, Entry modifiedEntry
) throws Exception
     {
         // Check that the parent Dn exists
@@ -1499,13 +1481,6 @@ public abstract class AbstractStore<E, I
             oldParentId = oldParentIds.get( oldParentIds.size() - 1 );
         }
 
-        ID contextEntryId = rootId;
-        
-        if ( newParentIds.size() > 1 )
-        {
-            contextEntryId = newParentIds.get( 1 );
-        }
-
         /*
          * Drop the old parent child relationship and add the new one
          * Set the new parent id for the child replacing the old parent id
@@ -1513,59 +1488,8 @@ public abstract class AbstractStore<E, I
         oneLevelIdx.drop( oldParentId, entryId );
         oneLevelIdx.add( newParentId, entryId );
 
-        // Update the sublevel index
-        // first, drop the old position in the subLevel index
-        for ( ID ancestor : oldParentIds )
-        {
-            if ( ancestor.equals( rootId ) )
-            {
-                continue;
-            }
-            
-            subLevelIdx.drop( ancestor, oldParentId );
-        }
-        
-        // find all the children of the childId
-        Cursor<IndexEntry<ID, E, ID>> cursor = subLevelIdx.forwardCursor( entryId
);
-
-        List<ID> childIds = new ArrayList<ID>();
-        childIds.add( entryId );
-
-        while ( cursor.next() )
-        {
-            childIds.add( cursor.get().getId() );
-        }
-
-        // detach the childId and all its children from oldParentId and all it parents excluding
the root
-        for ( ID pid : oldParentIds )
-        {
-            for ( ID cid : childIds )
-            {
-                subLevelIdx.drop( pid, cid );
-            }
-        }
-
-        // then add the new position in the sublevel index
-        for ( ID id : newParentIds )
-        {
-            if ( id.equals( rootId ) || id.equals( contextEntryId ) )
-            {
-                // Skip the rootDSE and the context entry
-                continue;
-            }
-            
-            // Add the <ancestor, newId> tuple
-            subLevelIdx.add( id, entryId );
-        }
-
-        // attach the childId and all its children to newParentId and all it parents excluding
the root
-        for ( ID id : newParentIds )
-        {
-            for ( ID cid : childIds )
-            {
-                subLevelIdx.add( id, cid );
-            }
-        }
+        // Update the subLevel index
+        updateSubLevelIndex( entryId, oldParentIds, newParentIds );
 
         // Update the Rdn index
         ParentIdAndRdn<ID> oldKey = new ParentIdAndRdn<ID>( oldParentId, oldDn.getRdn()
);
@@ -2237,18 +2161,35 @@ public abstract class AbstractStore<E, I
      * @param newParentId new parent's id
      * @throws Exception
      */
-    protected void updateSubLevelIndex( ID entryId, ID oldParentId, ID newParentId ) throws
Exception
+    protected void updateSubLevelIndex( ID entryId, List<ID> oldParentIds, List<ID>
newParentIds ) throws Exception
     {
-        ID tempId = oldParentId;
-        List<ID> parentIds = new ArrayList<ID>();
+        ID rootId = getRootId();
+        ID oldParentId = rootId;
+        
+        if ( oldParentIds.size() > 2 )
+        {
+            oldParentId = oldParentIds.get( oldParentIds.size() - 1 );
+        }
 
-        // find all the parents of the oldParentId
-        while ( ( tempId != null ) && !tempId.equals( getRootId() ) && !tempId.equals(
getSuffixId() ) )
+        ID contextEntryId = rootId;
+        
+        if ( newParentIds.size() > 1 )
         {
-            parentIds.add( tempId );
-            tempId = getParentId( tempId );
+            contextEntryId = newParentIds.get( 1 );
         }
 
+        // Update the sublevel index
+        // first, drop the old position in the subLevel index
+        for ( ID ancestor : oldParentIds )
+        {
+            if ( ancestor.equals( rootId ) )
+            {
+                continue;
+            }
+            
+            subLevelIdx.drop( ancestor, oldParentId );
+        }
+        
         // find all the children of the childId
         Cursor<IndexEntry<ID, E, ID>> cursor = subLevelIdx.forwardCursor( entryId
);
 
@@ -2261,7 +2202,7 @@ public abstract class AbstractStore<E, I
         }
 
         // detach the childId and all its children from oldParentId and all it parents excluding
the root
-        for ( ID pid : parentIds )
+        for ( ID pid : oldParentIds )
         {
             for ( ID cid : childIds )
             {
@@ -2269,18 +2210,21 @@ public abstract class AbstractStore<E, I
             }
         }
 
-        parentIds.clear();
-        tempId = newParentId;
-
-        // find all the parents of the newParentId
-        while ( ( tempId != null)  && !tempId.equals( getRootId() ) && !tempId.equals(
getSuffixId() ) )
+        // then add the new position in the sublevel index
+        for ( ID id : newParentIds )
         {
-            parentIds.add( tempId );
-            tempId = getParentId( tempId );
+            if ( id.equals( rootId ) || id.equals( contextEntryId ) )
+            {
+                // Skip the rootDSE and the context entry
+                continue;
+            }
+            
+            // Add the <ancestor, newId> tuple
+            subLevelIdx.add( id, entryId );
         }
 
         // attach the childId and all its children to newParentId and all it parents excluding
the root
-        for ( ID id : parentIds )
+        for ( ID id : newParentIds )
         {
             for ( ID cid : childIds )
             {

Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=1142153&r1=1142152&r2=1142153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
(original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
Sat Jul  2 04:59:43 2011
@@ -573,25 +573,6 @@ public interface Store<E, ID extends Com
     void rename( Dn dn, Rdn newRdn, boolean deleteOldRdn, Entry entry ) throws Exception;
 
 
-    /**
-     * Changes the relative distinguished name of an entry specified by a
-     * distinguished name with the optional removal of the old Rdn attribute
-     * value from the entry.  Name changes propagate down as dn changes to the
-     * descendants of the entry where the Rdn changed.
-     *
-     * An Rdn change operation does not change parent child relationships.  It
-     * merely propagates a name change at a point in the DIT where the Rdn is
-     * changed. The change propagates down the subtree rooted at the
-     * distinguished name specified.
-     *
-     * @param dn the normalized distinguished name of the entry to alter
-     * @param newRdn the new Rdn to set
-     * @param deleteOldRdn whether or not to remove the old Rdn attr/val
-     * @throws Exception if there are any errors propagating the name changes
-     */
-    void rename( Dn dn, Rdn newRdn, boolean deleteOldRdn ) throws Exception;
-
-    
     void moveAndRename( Dn oldChildDn, Dn newParentDn, Rdn newRdn, Entry entry, boolean deleteOldRdn
) throws Exception;
 
 
@@ -622,38 +603,6 @@ public interface Store<E, ID extends Com
      * @param oldDn The previous entry Dn
      * @param newSuperior The new superior Dn
      * @param newDn The new Dn
-     * @throws Exception If the move failed
-     */
-    void move( Dn oldDn, Dn newSuperior, Dn newDn ) throws Exception;
-
-
-    /**
-     * <p>Move an entry from one place to the other. The Rdn remains unchanged,
-     * the parent Dn changes</p>
-     * <p>We have to update some of the index when moving an entry. Assuming
-     * that the target destination does not exist, the following index must
-     * be updated :</p>
-     * <ul>
-     * <li><b>oneLevel</b> index</li>
-     * <li><b>subLevel</b> index</li>
-     * </ul>
-     * <p>If the moved entry is an alias, then we also have to update the
-     * following index :</p>
-     * <ul>
-     * <li><b>oneAlias</b> index</li>
-     * <li><b>subAlias</b> index</li>
-     * </ul>
-     * <p>The <b>Alias</b> index is not updated, as the entry ID won't
change.</p> 
-     * <p>We have a few check we must do before moving the entry :
-     * <ul>
-     * <li>The destination must not exist
-     * <li>The moved entry must exist (this has already been checked)
-     * <li>The moved entry must not inherit from a referral (already checked)
-     * </ul>
-     *
-     * @param oldDn The previous entry Dn
-     * @param newSuperior The new superior Dn
-     * @param newDn The new Dn
      * @param entry The entry to move
      * @throws Exception If the move failed
      */

Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java?rev=1142153&r1=1142152&r2=1142153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
(original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
Sat Jul  2 04:59:43 2011
@@ -381,7 +381,7 @@ public class AbstractStoreTest
         // move
         Dn newSuperior = new Dn( schemaManager, "o=Good Times Co." );
         Dn newDn = new Dn( schemaManager, "cn=user,o=Good Times Co." );
-        store.move( dn, newSuperior, newDn );
+        store.move( dn, newSuperior, newDn , entry);
         entry = verifyParentId( newDn );
         
         // move and rename
@@ -396,9 +396,9 @@ public class AbstractStoreTest
     
     private Entry verifyParentId( Dn dn ) throws Exception
     {
-        Long entryId = store.getEntryId( dn );
         Entry entry = store.lookup( dn );
-        Long parentId = store.getParentId( entryId );
+        List<Long> parentIds = store.getParentIds( dn );
+        Long parentId = parentIds.get( parentIds.size() - 1 );
         
         Attribute parentIdAt = entry.get( SchemaConstants.ENTRY_PARENT_ID_AT );
         assertNotNull( parentIdAt );

Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java?rev=1142153&r1=1142152&r2=1142153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
(original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
Sat Jul  2 04:59:43 2011
@@ -603,18 +603,20 @@ public class AvlStoreTest
     public void testRename() throws Exception
     {
         Dn dn = new Dn( schemaManager, "cn=Pivate Ryan,ou=Engineering,o=Good Times Co." );
-        DefaultEntry entry = new DefaultEntry( schemaManager, dn );
-        entry.add( "objectClass", "top", "person", "organizationalPerson" );
-        entry.add( "ou", "Engineering" );
-        entry.add( "cn", "Private Ryan" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        DefaultEntry entry = new DefaultEntry( schemaManager, dn,
+            "objectClass: top", 
+            "objectClass: person", 
+            "objectClass: organizationalPerson",
+            "ou", "Engineering",
+            "cn", "Private Ryan",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
 
         store.add( entry );
 
         Rdn rdn = new Rdn( "sn=James" );
 
-        store.rename( dn, rdn, true );
+        store.rename( dn, rdn, true, entry );
     }
 
 
@@ -622,18 +624,20 @@ public class AvlStoreTest
     public void testRenameEscaped() throws Exception
     {
         Dn dn = new Dn( schemaManager, "cn=Pivate Ryan,ou=Engineering,o=Good Times Co." );
-        DefaultEntry entry = new DefaultEntry( schemaManager, dn );
-        entry.add( "objectClass", "top", "person", "organizationalPerson" );
-        entry.add( "ou", "Engineering" );
-        entry.add( "cn", "Private Ryan" );
-        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
-        entry.add( "entryUUID", UUID.randomUUID().toString() );
+        DefaultEntry entry = new DefaultEntry( schemaManager, dn,
+            "objectClass: top", 
+            "objectClass: person", 
+            "objectClass: organizationalPerson",
+            "ou: Engineering",
+            "cn: Private Ryan",
+            "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
+            "entryUUID", UUID.randomUUID().toString() );
 
         store.add( entry );
 
         Rdn rdn = new Rdn( "sn=Ja\\+es" );
 
-        store.rename( dn, rdn, true );
+        store.rename( dn, rdn, true, entry );
 
         Dn dn2 = new Dn( schemaManager, "sn=Ja\\+es,ou=Engineering,o=Good Times Co." );
         Long id = store.getEntryId( dn2 );



Mime
View raw message