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 2005/10/26 05:34:35 UTC

svn commit: r328545 - in /directory/apacheds/trunk: core/src/main/java/org/apache/ldap/server/normalization/ core/src/main/java/org/apache/ldap/server/schema/ core/src/main/java/org/apache/ldap/server/schema/bootstrap/ main/src/test/org/apache/ldap/ser...

Author: akarasulu
Date: Tue Oct 25 20:34:27 2005
New Revision: 328545

URL: http://svn.apache.org/viewcvs?rev=328545&view=rev
Log:
changes ...

 o OID registry did not perform normalized lookups with hasOid() so I added that
   and everything worked fine.  What worried me is why this popped up now.  I 
   can only attribute it to new code executing for the first time.

 This fixes DIREVE-294.

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalAttributeTypeRegistry.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
    directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java
    directory/apacheds/trunk/xdocs/users/index.xml

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java?rev=328545&r1=328544&r2=328545&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java Tue Oct 25 20:34:27 2005
@@ -154,7 +154,7 @@
 
         filter.accept( visitor );
 
-        // check that after pruning we have valid branch node at the top 
+        // check that after pruning we have valid branch node at the top
         if ( ! filter.isLeaf() )
         {
             BranchNode child = ( BranchNode ) filter;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalAttributeTypeRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalAttributeTypeRegistry.java?rev=328545&r1=328544&r2=328545&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalAttributeTypeRegistry.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalAttributeTypeRegistry.java Tue Oct 25 20:34:27 2005
@@ -147,7 +147,6 @@
     {
         try
         {
-
             if ( oidRegistry.hasOid( id ) )
             {
                 return byOid.containsKey( oidRegistry.getOid( id ) ) ||

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java?rev=328545&r1=328544&r2=328545&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java Tue Oct 25 20:34:27 2005
@@ -115,7 +115,6 @@
         if ( Character.isDigit( name.charAt( 0 ) ) )
         {
             monitor.getOidWithOid( name );
-
             return name;
         }
 
@@ -124,18 +123,14 @@
         if ( byName.containsKey( name ) )
         {
             String oid = ( String ) byName.get( name );
-
             monitor.oidResolved( name, oid );
-
             return oid;
         }
 
         if ( bootstrap.hasOid( name ) )
         {
             String oid = bootstrap.getOid( name );
-
             monitor.oidResolved( name, oid );
-
             return oid;
         }
 
@@ -147,19 +142,15 @@
          * returned on a getNameSet.
          */
         String lowerCase = name.trim().toLowerCase();
-
         if ( ! name.equals( lowerCase ) )
 		{
 			if ( byName.containsKey( lowerCase ) )
 	        {
 	            String oid = ( String ) byName.get( lowerCase );
-
 	            monitor.oidResolved( name, lowerCase, oid );
-	
-	            // We expect to see this version of the key again so we add it
 
+	            // We expect to see this version of the key again so we add it
 	            byName.put( name, oid );
-
                 return oid;
 	        }
 			
@@ -172,23 +163,17 @@
 			if ( bootstrap.hasOid( lowerCase) )
 			{
 	            String oid = bootstrap.getOid( name );
-
                 monitor.oidResolved( name, oid );
 
 	            // We expect to see this version of the key again so we add it
-
                 byName.put( name, oid );
-
                 return oid;
 			}
 		}
 
         String msg = "OID for name '" + name + "' was not " + "found within the OID registry";
-
         NamingException fault = new NamingException ( msg );
-
         monitor.oidResolutionFailed( name, fault );
-
         throw fault;
     }
 
@@ -198,8 +183,50 @@
      */
     public boolean hasOid( String name )
     {
-        return this.byName.containsKey( name ) || this.byOid.containsKey( name )  ||
-               this.bootstrap.hasOid( name );
+        // check first with non-normalized name
+        if ( this.byName.containsKey( name ) || this.byOid.containsKey( name ) )
+        {
+            return true;
+        }
+
+        // check next with non-normalized name on the bootstrap registry
+        if ( this.bootstrap.hasOid( name ) )
+        {
+            return true;
+        }
+
+        /*
+        * As a last resort we check if name is not normalized and if the
+        * normalized version used as a key returns an OID.  If the normalized
+        * name works add the normalized name as a key with its OID to the
+        * byName lookup.  BTW these normalized versions of the key are not
+        * returned on a getNameSet.
+        */
+        String lowerCase = name.trim().toLowerCase();
+        if ( ! name.equals( lowerCase ) )
+		{
+			if ( byName.containsKey( lowerCase ) )
+	        {
+	            String oid = ( String ) byName.get( lowerCase );
+	            monitor.oidResolved( name, lowerCase, oid );
+
+	            // We expect to see this version of the key again so we add it
+	            byName.put( name, oid );
+                return true;
+	        }
+
+			/*
+			 * Some LDAP servers (MS Active Directory) tend to use some of the
+			 * bootstrap oid names as all caps, like OU. This should resolve that.
+			 * Lets stash this in the byName if we find it.
+			 */
+			if ( bootstrap.hasOid( lowerCase) )
+			{
+                return true;
+			}
+		}
+
+        return false;
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java?rev=328545&r1=328544&r2=328545&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java Tue Oct 25 20:34:27 2005
@@ -105,7 +105,13 @@
      */
     public boolean hasOid( String name )
     {
-        return this.byName.containsKey( name ) || this.byOid.containsKey( name );
+        if ( this.byName.containsKey( name ) || this.byOid.containsKey( name ) )
+        {
+            return true;
+        }
+
+        String normalized = name.toLowerCase();
+        return this.byName.containsKey( normalized ) || this.byOid.containsKey( normalized );
     }
 
 
@@ -207,14 +213,14 @@
          *          Add new value to the list
          * 2). If we do not have a value then we just add it as a String
          */
-        Object value = null;
+        Object value;
         if ( ! byOid.containsKey( oid ) )
         {
             value = name;
         }
         else 
         {
-            ArrayList list = null;
+            ArrayList list;
             value = byOid.get( oid );
             
             if ( value instanceof String )

Modified: directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java?rev=328545&r1=328544&r2=328545&view=diff
==============================================================================
--- directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java (original)
+++ directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java Tue Oct 25 20:34:27 2005
@@ -253,5 +253,13 @@
         e = sysRoot.search( "", "(& (bogusAttribute=abc123)(ou=abc123) )", cons );
         assertNotNull( e );
         assertFalse( e.getClass().equals( EmptyEnumeration.class ) );
+
+        e = sysRoot.search( "", "(OBJECTclass=*)", cons );
+        assertNotNull( e );
+        assertFalse( e.getClass().equals( EmptyEnumeration.class ) );
+
+        e = sysRoot.search( "", "(objectclass=*)", cons );
+        assertNotNull( e );
+        assertFalse( e.getClass().equals( EmptyEnumeration.class ) );
     }
 }

Modified: directory/apacheds/trunk/xdocs/users/index.xml
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/xdocs/users/index.xml?rev=328545&r1=328544&r2=328545&view=diff
==============================================================================
--- directory/apacheds/trunk/xdocs/users/index.xml (original)
+++ directory/apacheds/trunk/xdocs/users/index.xml Tue Oct 25 20:34:27 2005
@@ -50,6 +50,28 @@
 
         <tr>
           <td>
+            <a href="./subentries.html">Subentries</a>
+          </td>
+          <td>
+            Documents the subentry implementation which 
+            conforms to <a href="http://www.faqs.org/rfcs/rfc3672.html">
+            RFC 3672</a>.
+          </td>
+        </tr>
+
+        <tr>
+          <td>
+            <a href="./collective.html">Collective Attributes</a>
+          </td>
+          <td>
+            Documents the collective attributes implementation which 
+            conforms to <a href="http://www.faqs.org/rfcs/rfc3671.html">
+            RFC 3671</a>.
+          </td>
+        </tr>
+
+        <tr>
+          <td>
             <a href="./configuration.html">Configuration</a>
           </td>
           <td>