directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1143929 - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/directory/server/xdbm/
Date Thu, 07 Jul 2011 17:30:33 GMT
Author: elecharny
Date: Thu Jul  7 17:30:33 2011
New Revision: 1143929

URL: http://svn.apache.org/viewvc?rev=1143929&view=rev
Log:
o Improved the buildEntryDn() method
o Added some comments and Javadoc

Modified:
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=1143929&r1=1143928&r2=1143929&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Thu Jul  7 17:30:33 2011
@@ -86,6 +86,9 @@ public class JdbmStore<E> extends Abstra
     // -----------------------------------------------------------------------
     // C O N F I G U R A T I O N   M E T H O D S
     // -----------------------------------------------------------------------
+    /**
+     * {@inheritDoc}}
+     */
     public Long getDefaultId()
     {
         return 1L;

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=1143929&r1=1143928&r2=1143929&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
Thu Jul  7 17:30:33 2011
@@ -205,6 +205,9 @@ public abstract class AbstractStore<E, I
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int getCacheSize()
     {
         return cacheSize;
@@ -1103,7 +1106,14 @@ public abstract class AbstractStore<E, I
     @SuppressWarnings("unchecked")
     public synchronized void delete( ID id ) throws Exception
     {
+        // First get the entry
         Entry entry = master.get( id );
+        
+        if ( entry == null )
+        {
+            // Not allowed
+            throw new LdapNoSuchObjectException( "Cannot find an entry for ID " + id );
+        }
 
         Attribute objectClass = entry.get( OBJECT_CLASS_AT );
 
@@ -1112,17 +1122,20 @@ public abstract class AbstractStore<E, I
             dropAliasIndices( id );
         }
 
+        // Update the ObjectClass index
         for ( Value<?> value : objectClass )
         {
             objectClassIdx.drop( value.getString(), id );
         }
 
+        // Update the rdn, oneLevel, subLevel, entryCsn and entryUuid indexes
         rdnIdx.drop( id );
         oneLevelIdx.drop( id );
         subLevelIdx.drop( id );
         entryCsnIdx.drop( id );
         entryUuidIdx.drop( id );
 
+        // Update the user indexes
         for ( Attribute attribute : entry )
         {
             String attributeOid = attribute.getAttributeType().getOid();
@@ -1446,10 +1459,10 @@ public abstract class AbstractStore<E, I
     protected Dn buildEntryDn( ID id ) throws Exception
     {
         ID parentId = id;
+        ID rootId = getRootId();
 
-        List<Rdn> rdnList = new ArrayList<Rdn>();
         StringBuilder upName = new StringBuilder();
-        String normName = "";
+        boolean isFirst = true;
 
         do
         {
@@ -1458,23 +1471,21 @@ public abstract class AbstractStore<E, I
 
             for ( Rdn rdn : rdns )
             {
-                if ( rdnList.isEmpty() )
+                if ( isFirst )
                 {
-                    normName = rdn.getNormName();
-                    upName.append( rdn.getName() );
+                    isFirst = false;
                 }
                 else
                 {
-                    normName = normName + "," + rdn.getNormName();
-                    upName.append( ',' ).append( rdn.getName() );
+                    upName.append( ',' );
                 }
-
-                rdnList.add( rdn );
+                
+                upName.append( rdn.getName() );
             }
 
             parentId = cur.getParentId();
         }
-        while ( !parentId.equals( getRootId() ) );
+        while ( !parentId.equals( rootId ) );
 
         Dn dn = new Dn( schemaManager, upName.toString() );
 

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=1143929&r1=1143928&r2=1143929&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
Thu Jul  7 17:30:33 2011
@@ -447,9 +447,10 @@ public interface Store<E, ID extends Com
 
 
     /**
-     * Gets the normalized Dn of the entry identified by the given id.
+     * Gets the Entry's Dn identified by the given id.
+     * 
      * @param id the entry's id
-     * @return the normalized entry Dn
+     * @return the entry's Dn
      */
     Dn getEntryDn( ID id ) throws Exception;
 



Mime
View raw message