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 2009/08/30 19:10:52 UTC

svn commit: r809382 - in /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema: ./ comparators/ registries/

Author: akarasulu
Date: Sun Aug 30 17:10:51 2009
New Revision: 809382

URL: http://svn.apache.org/viewvc?rev=809382&view=rev
Log:
added containsName to registry, fixed missing lookup for top in objectClass, added default constructor to loaded comparator

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java?rev=809382&r1=809381&r2=809382&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java Sun Aug 30 17:10:51 2009
@@ -137,9 +137,13 @@
             {
                 superiors = new ArrayList<ObjectClass>( superiorOids.size() );
                 
-                for ( String oid : superiorOids )
+                for ( String superiorName : superiorOids )
                 {
-                    superiors.add( ocRegistry.lookup( oid ) );
+                	if ( superiorName.equals( "top" ) )
+                	{
+                		continue;
+                	}
+                    superiors.add( ocRegistry.lookup( ocRegistry.getOidByName( superiorName ) ) );
                 }
             }
 
@@ -147,9 +151,9 @@
             {
                 mayAttributeTypes = new ArrayList<AttributeType>( mayAttributeTypeOids.size() );
                 
-                for ( String oid : mayAttributeTypeOids )
+                for ( String mayAttributeTypeName : mayAttributeTypeOids )
                 {
-                    mayAttributeTypes.add( atRegistry.lookup( oid ) );
+                    mayAttributeTypes.add( atRegistry.lookup( atRegistry.getOidByName( mayAttributeTypeName ) ) );
                 }
             }
 
@@ -157,9 +161,9 @@
             {
                 mustAttributeTypes = new ArrayList<AttributeType>( mustAttributeTypeOids.size() );
                 
-                for ( String oid : mustAttributeTypeOids )
+                for ( String mustAttributeTypeName : mustAttributeTypeOids )
                 {
-                    mustAttributeTypes.add( atRegistry.lookup( oid ) );
+                    mustAttributeTypes.add( atRegistry.lookup( atRegistry.getOidByName( mustAttributeTypeName ) ) );
                 }
             }
         }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java?rev=809382&r1=809381&r2=809382&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NameOrNumericIdComparator.java Sun Aug 30 17:10:51 2009
@@ -60,6 +60,16 @@
     
     
     /**
+     * The IntegerOrderingComparator constructor. Its OID is the IntegerOrderingMatch matching
+     * rule OID.
+     */
+    public NameOrNumericIdComparator()
+    {
+        super( SchemaConstants.NAME_OR_NUMERIC_ID_MATCH_OID );
+    }
+    
+    
+    /**
      * Implementation of the Compare method
      */
     public int compare( String o1, String o2 )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java?rev=809382&r1=809381&r2=809382&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java Sun Aug 30 17:10:51 2009
@@ -59,6 +59,7 @@
     /** maps OIDs to a Set of descendants for that OID */
     private final Map<String,Set<AttributeType>> oidToDescendantSet;
 
+    
     /**
      * Creates a new default AttributeTypeRegistry instance.
      */

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java?rev=809382&r1=809381&r2=809382&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java Sun Aug 30 17:10:51 2009
@@ -365,4 +365,27 @@
         T schemaObject = byName.get( name );
         return schemaObject.getOid();
     }
+
+
+    /**
+     * Checks to see if an alias/name is associated with an OID and it's 
+     * respective schema object in this registry.  Unlike the getOidByName()
+     * method this method does not throw an exception when the name is not
+     * found.
+     * 
+     * @param name The name we are looking for
+     * @return true if the name or it's cannonical form is mapped to a 
+     * schemaObject in this registry, false otherwise.
+     * @throws NamingException If the OID can't be found
+     */
+    public boolean containsName( String name ) throws NamingException
+    {
+    	if ( ! byName.containsKey( name ) )
+    	{
+    		// last resort before giving up check with lower cased version
+        	return byName.containsKey( name.toLowerCase() );
+    	}
+
+        return true;
+    }
 }