directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r887306 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java
Date Fri, 04 Dec 2009 18:11:21 GMT
Author: elecharny
Date: Fri Dec  4 18:11:21 2009
New Revision: 887306

URL: http://svn.apache.org/viewvc?rev=887306&view=rev
Log:
Fixed some errors in initialization as we were using the registries instead of the schemaManager

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/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?rev=887306&r1=887305&r2=887306&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NameOrNumericIdNormalizer.java
Fri Dec  4 18:11:21 2009
@@ -28,7 +28,7 @@
 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.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.syntaxCheckers.NumericOidSyntaxChecker;
 
 
@@ -47,14 +47,14 @@
     public static final long serialVersionUID = 1L;
 
     private NumericOidSyntaxChecker checker = new NumericOidSyntaxChecker();
-    
-    /** The global registries */
-    private Registries registries;
-    
+
+    /** A reference to the schema manager used to normalize the Name */
+    private SchemaManager schemaManager;
+
     /** A static instance of this normalizer */
     public static final NameOrNumericIdNormalizer INSTANCE = new NameOrNumericIdNormalizer();
-    
-    
+
+
     /**
      * Creates a new instance of GeneralizedTimeNormalizer.
      */
@@ -62,15 +62,8 @@
     {
         super( SchemaConstants.NAME_OR_NUMERIC_ID_MATCH_OID );
     }
-    
-    
-    public NameOrNumericIdNormalizer( Registries registries )
-    {
-        super(  SchemaConstants.NAME_OR_NUMERIC_ID_MATCH_OID  );
-        this.registries = registries;
-    }
-    
-    
+
+
     /**
      * {@inheritDoc} 
      */
@@ -80,34 +73,34 @@
         {
             return null;
         }
-        
+
         String strValue = value.getString();
 
         if ( strValue.length() == 0 )
         {
             return new ClientStringValue( "" );
         }
-        
+
         // if value is a numeric id then return it as is
         if ( checker.isValidSyntax( strValue ) )
         {
             return value;
         }
-        
+
         // if it is a name we need to do a lookup
-        String oid = registries.getOid( strValue );
-        
+        String oid = schemaManager.getRegistries().getOid( strValue );
+
         if ( oid != null )
         {
             return new ClientStringValue( oid );
         }
-        
+
         // if all else fails
-        throw new LdapNamingException( "Encountered name based id of " + value 
-            + " which was not found in the OID registry" , ResultCodeEnum.OTHER );
+        throw new LdapNamingException( "Encountered name based id of " + value
+            + " which was not found in the OID registry", ResultCodeEnum.OTHER );
     }
-    
-    
+
+
     /**
      * {@inheritDoc} 
      */
@@ -117,37 +110,37 @@
         {
             return null;
         }
-        
+
         if ( value.length() == 0 )
         {
             return value;
         }
-        
+
         // if value is a numeric id then return it as is
         if ( checker.isValidSyntax( value ) )
         {
             return value;
         }
-        
+
         // if it is a name we need to do a lookup
-        String oid = registries.getOid( value );
-        
-        if ( oid != null  )
+        String oid = schemaManager.getRegistries().getOid( value );
+
+        if ( oid != null )
         {
             return oid;
         }
-        
+
         // if all else fails
-        throw new LdapNamingException( "Encountered name based id of " + value 
-            + " which was not found in the OID registry" , ResultCodeEnum.OTHER );
+        throw new LdapNamingException( "Encountered name based id of " + value
+            + " which was not found in the OID registry", ResultCodeEnum.OTHER );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
-    public void applyRegistries( Registries registries )
+    public void setSchemaManager( SchemaManager schemaManager )
     {
-        this.registries = registries;
+        this.schemaManager = schemaManager;
     }
 }



Mime
View raw message