You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2008/03/29 21:24:06 UTC

svn commit: r642599 - in /directory/sandbox/akarasulu/bigbang/apacheds: core-constants/src/main/java/org/apache/directory/server/core/partition/Oid.java jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java

Author: kayyagari
Date: Sat Mar 29 13:24:05 2008
New Revision: 642599

URL: http://svn.apache.org/viewvc?rev=642599&view=rev
Log:
added Sub Level Index support to JdbmStore
added an OID for sublevel index

Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/core-constants/src/main/java/org/apache/directory/server/core/partition/Oid.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-constants/src/main/java/org/apache/directory/server/core/partition/Oid.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-constants/src/main/java/org/apache/directory/server/core/partition/Oid.java?rev=642599&r1=642598&r2=642599&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-constants/src/main/java/org/apache/directory/server/core/partition/Oid.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-constants/src/main/java/org/apache/directory/server/core/partition/Oid.java Sat Mar 29 13:24:05 2008
@@ -42,8 +42,9 @@
     public static final String SUBALIAS = "1.3.6.1.4.1.18060.0.4.1.2.6";
     /** Private OID (1.3.6.1.4.1.18060.0.4.1.2.7) for _alias index */
     public static final String ALIAS = "1.3.6.1.4.1.18060.0.4.1.2.7";
-
-
+    /** Private OID (1.3.6.1.4.1.18060.0.4.1.2.8) for _subLevel index*/
+    public static final String SUBLEVEL = "1.3.6.1.4.1.18060.0.4.1.2.8";
+    
     private Oid()
     {
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=642599&r1=642598&r2=642599&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Sat Mar 29 13:24:05 2008
@@ -112,6 +112,9 @@
     /** a system index on aliasedObjectName attribute */
     private JdbmIndex<String,E> aliasIdx;
     
+    /** a system index on the entries of descendants of root DN*/
+    private JdbmIndex<Long,E> subLevelIdx;
+    
     /** Two static declaration to avoid lookup all over the code */
     private static AttributeType OBJECT_CLASS_AT;
     private static AttributeType ALIASED_OBJECT_NAME_AT;
@@ -371,6 +374,14 @@
             systemIndices.put( Oid.ALIAS, aliasIdx );
             aliasIdx.init( attributeTypeRegistry.lookup( Oid.ALIAS ), workingDirectory );
         }
+        
+        if ( subLevelIdx == null )
+        {
+            subLevelIdx = new JdbmIndex<Long, E>();
+            subLevelIdx.setAttributeId( Oid.SUBLEVEL );
+            systemIndices.put( Oid.SUBLEVEL, subLevelIdx );
+            subLevelIdx.init( attributeTypeRegistry.lookup( Oid.SUBLEVEL ), workingDirectory );
+        }
     }
 
 
@@ -518,7 +529,8 @@
         array.add( subAliasIdx );
         array.add( hierarchyIdx );
         array.add( existanceIdx );
-
+        array.add( subLevelIdx );
+        
         // Sync all user defined userIndices
         for ( Index idx:array )
         {
@@ -672,6 +684,20 @@
     }
 
 
+    public Index<Long,E> getSubLevelIndex()
+    {
+        return subLevelIdx;
+    }
+
+
+    public void setSubLevelIndex( Index<Long,E> index ) throws NamingException
+    {
+        protect( "subLevelIndex" );
+        subLevelIdx = ( JdbmIndex<Long,E> ) convertIndex( index );
+        systemIndices.put( index.getAttributeId(), subLevelIdx );
+    }
+    
+    
     public Iterator<String> userIndices()
     {
         return userIndices.keySet().iterator();
@@ -1034,7 +1060,14 @@
         ndnIdx.add( normName.toNormName(), id );
         updnIdx.add( normName.getUpName(), id );
         hierarchyIdx.add( parentId, id );
-
+        
+        Long tempId = parentId;
+        while( tempId != null && tempId != 0 && tempId != 1 )
+        {
+            subLevelIdx.add( tempId, id );
+            tempId = getParentId( tempId );
+        }
+        
         // Now work on the user defined userIndices
         NamingEnumeration<String> list = entry.getIDs();
         
@@ -1098,7 +1131,8 @@
         ndnIdx.drop( id );
         updnIdx.drop( id );
         hierarchyIdx.drop( id );
-
+        subLevelIdx.drop( id );
+        
         // Remove parent's reference to entry only if entry is not the upSuffix
         if ( !parentId.equals( 0L ) )
         {