directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r808307 - in /directory: apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/ sh...
Date Thu, 27 Aug 2009 07:29:56 GMT
Author: elecharny
Date: Thu Aug 27 07:29:56 2009
New Revision: 808307

URL: http://svn.apache.org/viewvc?rev=808307&view=rev
Log:
o Moved a normalizer to shared
o Fixed the ApacheMeta and System normalizer producers

Added:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java
      - copied, changed from r808297, directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java
Removed:
    directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java
Modified:
    directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApachemetaNormalizerProducer.java
    directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdMatch.java
    directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java

Modified: directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApachemetaNormalizerProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApachemetaNormalizerProducer.java?rev=808307&r1=808306&r2=808307&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApachemetaNormalizerProducer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/ApachemetaNormalizerProducer.java
Thu Aug 27 07:29:56 2009
@@ -25,6 +25,7 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.normalizers.NameOrNumericIdNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 
@@ -58,7 +59,7 @@
     {
         Normalizer normalizer = null;
         
-        normalizer = new NameOrNumericIdNormalizer( registries.getOidRegistry() );
+        normalizer = new NameOrNumericIdNormalizer( registries );
         cb.schemaObjectProduced( this, SchemaConstants.NAME_OR_NUMERIC_ID_MATCH_OID, normalizer
);
 
         normalizer = new NoOpNormalizer( SchemaConstants.OBJECT_CLASS_TYPE_MATCH_OID );

Modified: directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdMatch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdMatch.java?rev=808307&r1=808306&r2=808307&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdMatch.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdMatch.java
Thu Aug 27 07:29:56 2009
@@ -29,6 +29,7 @@
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.LdapSyntax;
+import org.apache.directory.shared.ldap.schema.normalizers.NameOrNumericIdNormalizer;
 import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 

Modified: directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java?rev=808307&r1=808306&r2=808307&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java
Thu Aug 27 07:29:56 2009
@@ -167,7 +167,7 @@
          * ( 2.5.13.1 NAME 'distinguishedNameMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
          */
-        normalizer = new CachingDnNormalizer();
+        normalizer = new CachingDnNormalizer( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID
);
         ( ( CachingDnNormalizer ) normalizer ).setRegistries( registries );
         cb.schemaObjectProduced( this, SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID, normalizer
);
 
@@ -175,77 +175,77 @@
          * ( 2.5.13.2 NAME 'caseIgnoreMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
          */
-        normalizer = new CachingDeepTrimToLowerNormalizer();
+        normalizer = new CachingDeepTrimToLowerNormalizer( SchemaConstants.CASE_IGNORE_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_IGNORE_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 2.5.13.3 NAME 'caseIgnoreOrderingMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
          */
-        normalizer = new CachingDeepTrimToLowerNormalizer();
+        normalizer = new CachingDeepTrimToLowerNormalizer( SchemaConstants.CASE_IGNORE_ORDERING_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_IGNORE_ORDERING_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
          */
-        normalizer = new CachingDeepTrimToLowerNormalizer();
+        normalizer = new CachingDeepTrimToLowerNormalizer( SchemaConstants.CASE_IGNORE_SUBSTRING_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_IGNORE_SUBSTRING_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.5 NAME 'caseExactMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
          */
-        normalizer = new CachingDeepTrimNormalizer();
+        normalizer = new CachingDeepTrimNormalizer( SchemaConstants.CASE_EXACT_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_EXACT_MATCH_MR_OID, normalizer
);
         
         /*
          * ( 2.5.13.6 NAME 'caseExactOrderingMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.CASE_EXACT_ORDERING_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_EXACT_ORDERING_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.7 NAME 'caseExactSubstringsMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
          */
-        normalizer = new CachingDeepTrimNormalizer();
+        normalizer = new CachingDeepTrimNormalizer( SchemaConstants.CASE_EXACT_SUBSTRING_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_EXACT_SUBSTRING_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.8 NAME 'numericStringMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.NUMERIC_STRING_MATCH_MR_OID );
         cb.schemaObjectProduced( this, SchemaConstants.NUMERIC_STRING_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 2.5.13.9 NAME 'numericStringOrderingMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.NUMERIC_STRING_ORDERING_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.NUMERIC_STRING_ORDERING_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.10 NAME 'numericStringSubstringsMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.NUMERIC_STRING_SUBSTRINGS_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.NUMERIC_STRING_SUBSTRINGS_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.11 NAME 'caseIgnoreListMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
          */
-        normalizer = new CachingDeepTrimToLowerNormalizer();
+        normalizer = new CachingDeepTrimToLowerNormalizer( SchemaConstants.CASE_IGNORE_LIST_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_IGNORE_LIST_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 2.5.13.12 NAME 'caseIgnoreListSubstringsMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
          */
-        normalizer = new CachingDeepTrimToLowerNormalizer();
+        normalizer = new CachingDeepTrimToLowerNormalizer( SchemaConstants.CASE_IGNORE_LIST_SUBSTRINGS_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_IGNORE_LIST_SUBSTRINGS_MATCH_MR_OID,
normalizer );
 
         /*
@@ -259,63 +259,63 @@
          * ( 2.5.13.14 NAME 'integerMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.INTEGER_MATCH_MR_OID );
         cb.schemaObjectProduced( this, SchemaConstants.INTEGER_MATCH_MR_OID, normalizer );
 
         /*
          * ( 2.5.13.15 NAME 'integerOrderingMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         cb.schemaObjectProduced( this, SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 2.5.13.16 NAME 'bitStringMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.BIT_STRING_MATCH_MR_OID );
         cb.schemaObjectProduced( this, SchemaConstants.BIT_STRING_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 2.5.13.17 NAME 'octetStringMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.OCTET_STRING_MATCH_MR_OID );
         cb.schemaObjectProduced( this, SchemaConstants.OCTET_STRING_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 2.5.13.18 NAME 'octetStringOrderingMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.OCTET_STRING_ORDERING_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.OCTET_STRING_ORDERING_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.19 NAME 'octetStringSubstringsMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.OCTET_STRING_SUBSTRINGS_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.OCTET_STRING_SUBSTRINGS_MATCH_MR_OID,
normalizer );
         
         /*
          * ( 2.5.13.20 NAME 'telephoneNumberMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.TELEPHONE_NUMBER_MATCH_MR_OID );
         cb.schemaObjectProduced( this, SchemaConstants.TELEPHONE_NUMBER_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.TELEPHONE_NUMBER_SUBSTRINGS_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.TELEPHONE_NUMBER_SUBSTRINGS_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.22 NAME 'presentationAddressMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.PRESENTATION_ADDRESS_MATCH_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.PRESENTATION_ADDRESS_MATCH_MATCH_MR_OID,
normalizer );
 
         /*
@@ -331,7 +331,7 @@
          * 
          * This MatchingRule has been removed from RFC 4517
          */
-        normalizer = new CachingDeepTrimNormalizer();
+        normalizer = new CachingDeepTrimNormalizer( SchemaConstants.PROTOCOL_INFORMATION_MATCH_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.PROTOCOL_INFORMATION_MATCH_MATCH_MR_OID,
normalizer );
 
         // 2.5.13.25 is not defined ...
@@ -342,63 +342,63 @@
          * ( 2.5.13.27 NAME 'generalizedTimeMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
          */
-        normalizer = new CachingDeepTrimNormalizer();
+        normalizer = new CachingDeepTrimNormalizer( SchemaConstants.GENERALIZED_TIME_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.GENERALIZED_TIME_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 2.5.13.28 NAME 'generalizedTimeOrderingMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
          */
-        normalizer = new CachingDeepTrimNormalizer();
+        normalizer = new CachingDeepTrimNormalizer( SchemaConstants.GENERALIZED_TIME_ORDERING_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.GENERALIZED_TIME_ORDERING_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.29 NAME 'integerFirstComponentMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.INTEGER_FIRST_COMPONENT_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.INTEGER_FIRST_COMPONENT_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.31 NAME 'directoryStringFirstComponentMatch'
          *   SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.DIRECTORY_STRING_FIRST_COMPONENT_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.DIRECTORY_STRING_FIRST_COMPONENT_MATCH_MR_OID,
normalizer );
 
         /*
          * ( 2.5.13.32 NAME 'wordMatch'
          *   SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.WORD_MATCH_MR_OID );
         cb.schemaObjectProduced( this, SchemaConstants.WORD_MATCH_MR_OID, normalizer );
 
         /*
          * ( 2.5.13.33 NAME 'keywordMatch'
          *   SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
          */
-        normalizer = new NoOpNormalizer();
+        normalizer = new NoOpNormalizer( SchemaConstants.KEYWORD_MATCH_MR_OID );
         cb.schemaObjectProduced( this, SchemaConstants.KEYWORD_MATCH_MR_OID, normalizer );
 
         /*
          * ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
          */
-        normalizer = new CachingDeepTrimNormalizer();
+        normalizer = new CachingDeepTrimNormalizer( SchemaConstants.CASE_EXACT_IA5_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_EXACT_IA5_MATCH_MR_OID, normalizer
);
 
         /*
          * ( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
          */
-        normalizer = new CachingDeepTrimToLowerNormalizer();
+        normalizer = new CachingDeepTrimToLowerNormalizer( SchemaConstants.CASE_IGNORE_IA5_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_IGNORE_IA5_MATCH_MR_OID, normalizer
);
 
         /*
@@ -406,7 +406,7 @@
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
          */
 
-        normalizer = new CachingDeepTrimToLowerNormalizer();
+        normalizer = new CachingDeepTrimToLowerNormalizer( SchemaConstants.CASE_IGNORE_IA5_SUBSTRINGS_MATCH_MR_OID
);
         cb.schemaObjectProduced( this, SchemaConstants.CASE_IGNORE_IA5_SUBSTRINGS_MATCH_MR_OID,
normalizer );
     }
 }

Copied: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java
(from r808297, directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java?p2=directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java&p1=directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java&r1=808297&r2=808307&rev=808307&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java
Thu Aug 27 07:29:56 2009
@@ -17,17 +17,17 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.schema.bootstrap;
+package org.apache.directory.shared.ldap.schema.normalizers;
 
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.schema.syntaxChecker.NumericOidSyntaxChecker;
 
@@ -41,32 +41,33 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class NameOrNumericIdNormalizer implements Normalizer
+public class NameOrNumericIdNormalizer extends Normalizer
 {
-    // The serial UID
-    private static final long serialVersionUID = 1L;
-    
+    /** The serial UID */
+    public static final long serialVersionUID = 1L;
+
     private NumericOidSyntaxChecker checker = new NumericOidSyntaxChecker();
     
-    private transient OidRegistry registry;
-    
+    /** The global registries */
+    private Registries registries;
     
     /** A static instance of this normalizer */
     public static final NameOrNumericIdNormalizer INSTANCE = new NameOrNumericIdNormalizer();
     
     
-    public NameOrNumericIdNormalizer( OidRegistry registry )
+    /**
+     * Creates a new instance of GeneralizedTimeNormalizer.
+     */
+    public NameOrNumericIdNormalizer()
     {
-        this.registry = registry;
+        super( SchemaConstants.NAME_OR_NUMERIC_ID_MATCH_OID );
     }
     
     
-    /**
-     * 
-     */
-    public NameOrNumericIdNormalizer()
+    public NameOrNumericIdNormalizer( Registries registries )
     {
-        // Nothing to do
+        super(  SchemaConstants.NAME_OR_NUMERIC_ID_MATCH_OID  );
+        this.registries = registries;
     }
     
     
@@ -94,9 +95,11 @@
         }
         
         // if it is a name we need to do a lookup
-        if ( registry.hasOid( strValue ) )
+        String oid = registries.getOid( strValue );
+        
+        if ( oid != null )
         {
-            return new ClientStringValue( registry.getOid( strValue ) );
+            return new ClientStringValue( oid );
         }
         
         // if all else fails
@@ -127,9 +130,11 @@
         }
         
         // if it is a name we need to do a lookup
-        if ( registry.hasOid( value ) )
+        String oid = registries.getOid( value );
+        
+        if ( oid != null  )
         {
-            return registry.getOid( value );
+            return oid;
         }
         
         // if all else fails
@@ -140,6 +145,6 @@
     
     public void setRegistries( Registries registries )
     {
-        this.registry = registries.getOidRegistry();
+        this.registries = registries;
     }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java?rev=808307&r1=808306&r2=808307&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
Thu Aug 27 07:29:56 2009
@@ -19,6 +19,17 @@
  */
 package org.apache.directory.shared.ldap.schema.registries;
 
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.DITContentRule;
+import org.apache.directory.shared.ldap.schema.DITStructureRule;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
+import org.apache.directory.shared.ldap.schema.NameForm;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+
 
 /**
  * Document this class.
@@ -194,6 +205,114 @@
         return ldapSyntaxRegistry;
     }
     
+    
+    /**
+     * Get an OID from a name. As we have many possible registries, we 
+     * have to look in all of them to get the one containing the OID.
+     *
+     * @param name The name we are looking at
+     * @return The associated OID
+     */
+    public String getOid( String name )
+    {
+        // we have many possible Registries to look at.
+        // AttributeType
+        try
+        {
+            AttributeType attributeType = attributeTypeRegistry.lookup( name );
+            
+            return attributeType.getOid();
+        }
+        catch ( NamingException ne )
+        {
+            // Fall down to the next registry
+        }
+        
+        // ObjectClass
+        try
+        {
+            ObjectClass objectClass = objectClassRegistry.lookup( name );
+            
+            return objectClass.getOid();
+        }
+        catch ( NamingException ne )
+        {
+            // Fall down to the next registry
+        }
+
+        // LdapSyntax
+        try
+        {
+            LdapSyntax ldapSyntax = ldapSyntaxRegistry.lookup( name );
+            
+            return ldapSyntax.getOid();
+        }
+        catch ( NamingException ne )
+        {
+            // Fall down to the next registry
+        }
+        
+        // MatchingRule
+        try
+        {
+            MatchingRule matchingRule = matchingRuleRegistry.lookup( name );
+            
+            return matchingRule.getOid();
+        }
+        catch ( NamingException ne )
+        {
+            // Fall down to the next registry
+        }
+        
+        // MatchingRuleUse
+        try
+        {
+            MatchingRuleUse matchingRuleUse = matchingRuleUseRegistry.lookup( name );
+            
+            return matchingRuleUse.getOid();
+        }
+        catch ( NamingException ne )
+        {
+            // Fall down to the next registry
+        }
+        
+        // NameForm
+        try
+        {
+            NameForm nameForm = nameFormRegistry.lookup( name );
+            
+            return nameForm.getOid();
+        }
+        catch ( NamingException ne )
+        {
+            // Fall down to the next registry
+        }
+        
+        // DITContentRule
+        try
+        {
+            DITContentRule ditContentRule = ditContentRuleRegistry.lookup( name );
+            
+            return ditContentRule.getOid();
+        }
+        catch ( NamingException ne )
+        {
+            // Fall down to the next registry
+        }
+
+        // DITStructureRule
+        try
+        {
+            DITStructureRule ditStructureRule = ditStructureRuleRegistry.lookup( name );
+            
+            return ditStructureRule.getOid();
+        }
+        catch ( NamingException ne )
+        {
+            // No more registries to look at...
+            return null;
+        }
+    }
 
     //List<Throwable> checkRefInteg();
 



Mime
View raw message