directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r155921 - in incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server: db/jdbm/JdbmDatabase.java jndi/ServerContextFactory.java
Date Wed, 02 Mar 2005 14:07:49 GMT
Author: akarasulu
Date: Wed Mar  2 06:07:47 2005
New Revision: 155921

URL: http://svn.apache.org/viewcvs?view=rev&rev=155921
Log:
committing endi partion patch

Modified:
    incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java
    incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java

Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java?view=diff&r1=155920&r2=155921
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java
Wed Mar  2 06:07:47 2005
@@ -58,8 +58,10 @@
 {
     /** the JDBM record manager used by this database */
     private final RecordManager recMan;
-    /** the suffix of this backend database */
-    private final Name suffix;
+    /** the user provided suffix of this backend database */
+    private final Name upSuffix;
+    /** the normalized suffix of this backend database */
+    private final Name normSuffix;
     /** the working directory to use for files */
     private final String wkdir;
     /** the master table storing entries by primary key */
@@ -96,14 +98,16 @@
     /**
      * Creates a Databased based on JDBM B+Trees.
      *
-     * @param suffix the user provided suffix name 
+     * @param upSuffix the user provided suffix name
+     * @param normSuffix the normalized suffix name
      * @param wkdirPath the path to the working directory where the db resides
      * @throws NamingException if db cannot be created
      */
-    public JdbmDatabase ( final Name suffix, final String wkdirPath )
+    public JdbmDatabase ( final Name upSuffix, final Name normSuffix, final String wkdirPath
)
         throws NamingException
     {
-        this.suffix = suffix;
+        this.upSuffix = upSuffix;
+        this.normSuffix = normSuffix;
         this.wkdir = wkdirPath;
 
         try 
@@ -495,14 +499,14 @@
          * make all other aliases to the target inconsistent.
          * 
          * We need to walk up the path of alias ancestors until we reach the 
-         * suffix, deleting each ( ancestorId, targetId ) tuple in the 
+         * upSuffix, deleting each ( ancestorId, targetId ) tuple in the
          * subtree scope alias.  We only need to do this for the direct parent
          * of the alias on the one level subtree.
          */
         oneAliasIdx.drop( ancestorId, targetId );
         subAliasIdx.drop( ancestorId, targetId );
         
-        while ( ! ancestorDn.equals( suffix ) )
+        while ( ! ancestorDn.equals( upSuffix ) )
         {
             ancestorDn = ancestorDn.getSuffix( 1 );
             ancestorId = getEntryId( ancestorDn.toString() );
@@ -568,13 +572,13 @@
          * id may be null but the alias may be to a valid entry in 
          * another namingContext.  Such aliases are not allowed and we
          * need to point it out to the user instead of saying the target
-         * does not exist when it potentially could outside of this suffix.
+         * does not exist when it potentially could outside of this upSuffix.
          */
-        if ( ! targetDn.startsWith( suffix ) )
+        if ( ! targetDn.startsWith( upSuffix ) )
         {
             // Complain specifically about aliases to outside naming contexts
             throw new NamingException( "[36] aliasDereferencingProblem -"
-                + " the alias points to an entry outside of the " + suffix
+                + " the alias points to an entry outside of the " + upSuffix
                 + " namingContext to an object whose existance cannot be"
                 + " determined." );
         }
@@ -636,14 +640,14 @@
         /*
          * Handle Sub Level Scope Alias Index
          * 
-         * Walk the list of relatives from the parents up to the suffix, testing
+         * Walk the list of relatives from the parents up to the upSuffix, testing
          * to see if the alias' target is a descendant of the relative.  If the
          * alias target is not a descentant of the relative it extends the scope
-         * and is added to the sub tree scope alias index.  The suffix node is
+         * and is added to the sub tree scope alias index.  The upSuffix node is
          * ignored since everything is under its scope.  The first loop 
          * iteration shall handle the parents.
          */
-        while ( ! ancestorDn.equals( suffix ) && null != ancestorId )
+        while ( ! ancestorDn.equals( upSuffix ) && null != ancestorId )
         {
             if ( ! NamespaceTools.isDescendant( ancestorDn, targetDn ) )
             {
@@ -672,7 +676,7 @@
         // entry sequences start at 1.
         //
         
-        if ( dn.equals( suffix ) )
+        if ( dn.equals( normSuffix ) )
         {
             parentId = BigInteger.ZERO;
         }
@@ -760,7 +764,7 @@
         updnIdx.drop( id );
         heirarchyIdx.drop( id );
         
-        // Remove parent's reference to entry only if entry is not the suffix  
+        // Remove parent's reference to entry only if entry is not the upSuffix
         if ( ! parentId.equals( BigInteger.ZERO ) )
         {
             heirarchyIdx.drop( parentId, id );
@@ -811,7 +815,7 @@
      */
     public Name getSuffix()
     {
-        return suffix;
+        return upSuffix;
     }
 
 
@@ -820,7 +824,7 @@
      */
     public Attributes getSuffixEntry() throws NamingException
     {
-        BigInteger id = getEntryId( suffix.toString() );
+        BigInteger id = getEntryId( upSuffix.toString() );
 
         if ( null == id )
         {
@@ -1637,7 +1641,7 @@
          * make all other aliases to the target inconsistent.
          * 
          * We need to walk up the path of alias ancestors right above the moved 
-         * base until we reach the suffix, deleting each ( ancestorId, 
+         * base until we reach the upSuffix, deleting each ( ancestorId,
          * targetId ) tuple in the subtree scope alias.  We only need to do 
          * this for the direct parent of the alias on the one level subtree if
          * the moved base is the alias.
@@ -1649,7 +1653,7 @@
         
         subAliasIdx.drop( ancestorId, targetId );
         
-        while ( ! ancestorDn.equals( suffix ) )
+        while ( ! ancestorDn.equals( upSuffix ) )
         {
             ancestorDn = ancestorDn.getSuffix( 1 );
             ancestorId = getEntryId( ancestorDn.toString() );

Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java?view=diff&r1=155920&r2=155921
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
Wed Mar  2 06:07:47 2005
@@ -447,7 +447,7 @@
 
         LdapName suffix = new LdapName();
         suffix.add( SystemPartition.SUFFIX );
-        Database db = new JdbmDatabase( suffix, wkdir );
+        Database db = new JdbmDatabase( suffix, suffix, wkdir );
 
         AttributeTypeRegistry attributeTypeRegistry;
         attributeTypeRegistry = bootstrapRegistries
@@ -628,7 +628,7 @@
                     .getNormalizer();
             Name normSuffix = new LdapName( ( String ) dnNorm
                     .normalize( configs[ii].getSuffix() ) );
-            Database db = new JdbmDatabase( upSuffix, wkdir );
+            Database db = new JdbmDatabase( upSuffix, normSuffix, wkdir );
 
             // ----------------------------------------------------------------
             // create the search engine using db, enumerators and evaluators



Mime
View raw message