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/24 08:50:17 UTC

svn commit: r327982 - in /directory/shared/ldap/trunk/common/src: antlr/valueparser.g java/org/apache/ldap/common/name/NameComponentNormalizer.java java/org/apache/ldap/common/name/SimpleNameComponentNormalizer.java

Author: akarasulu
Date: Sun Oct 23 23:50:03 2005
New Revision: 327982

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

 o added isDefined() into NCN for checking if attribute id is defined first
   or if it even matters for normalization
 o made simple NCN just return true for isDefined() since it does not care 
   about the attribute's id to normalize
 o changed DN parser to check with isDefined() before calling normalization
   methods on a NCN.  If isDefined() returns false we do not normalize the
   component 

JIRA Issues:

 o DIRLDAP-65 - http://issues.apache.org/jira/browse/DIRLDAP-65


Modified:
    directory/shared/ldap/trunk/common/src/antlr/valueparser.g
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/NameComponentNormalizer.java
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/SimpleNameComponentNormalizer.java

Modified: directory/shared/ldap/trunk/common/src/antlr/valueparser.g
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/antlr/valueparser.g?rev=327982&r1=327981&r2=327982&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/antlr/valueparser.g (original)
+++ directory/shared/ldap/trunk/common/src/antlr/valueparser.g Sun Oct 23 23:50:03 2005
@@ -72,7 +72,11 @@
 
         if ( m_normalizer != null ) 
         {
-            if ( m_isOid ) 
+            if ( ! m_normalizer.isDefined( m_lhs ) )
+            {
+                l_buf.append( l_value );
+            }
+            else if ( m_isOid )
             {
                 l_buf.append( m_normalizer.normalizeByOid( m_lhs, l_value ) ) ;
             } 

Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/NameComponentNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/NameComponentNormalizer.java?rev=327982&r1=327981&r2=327982&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/NameComponentNormalizer.java (original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/NameComponentNormalizer.java Sun Oct 23 23:50:03 2005
@@ -1,26 +1,17 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
 /*
- * $Id: NameComponentNormalizer.java,v 1.3 2003/07/31 21:44:49 akarasulu Exp $
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
  *
- * -- (c) LDAPd Group                                                    --
- * -- Please refer to the LICENSE.txt file in the root directory of      --
- * -- any LDAPd project for copyright and distribution information.      --
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
  *
  */
 
@@ -33,34 +24,38 @@
 /**
  * Normalizers of ldap name component attributes and their values.
  * 
- * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
- * @author $Author: akarasulu $
  * @version $Revision$
  */
 public interface NameComponentNormalizer
 {
     /**
+     * Checks to see if an attribute name/oid is defined.
+     *
+     * @param id the name/oid of the attribute to see if it is defined
+     * @return true if it is, false otherwise
+     */
+    boolean isDefined( String id );
+
+    /**
      * Normalizes an attribute's value given the name of the attribute - short
      * names like 'cn' as well as 'commonName' should work here.
      *
-     * @param a_attributeName the name of the attribute
-     * @param a_value the value of the attribute to normalize
+     * @param attributeName the name of the attribute
+     * @param value the value of the attribute to normalize
      * @return the normalized value
      * @throws NamingException if there is a recognition problem or a syntax 
      * issue
      */
-    String normalizeByName( String a_attributeName, String a_value )
-        throws NamingException ;
+    String normalizeByName( String attributeName, String value ) throws NamingException ;
 
     /**
      * Normalizes an attribute's value given the OID of the attribute.
      *
-     * @param a_attributeOid the OID of the attribute
-     * @param a_value the value of the attribute to normalize
+     * @param attributeOid the OID of the attribute
+     * @param value the value of the attribute to normalize
      * @return the normalized value
      * @throws NamingException if there is a recognition problem or a syntax 
      * issue
      */
-    String normalizeByOid( String a_attributeOid, String a_value )
-        throws NamingException ;
+    String normalizeByOid( String attributeOid, String value ) throws NamingException ;
 }

Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/SimpleNameComponentNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/SimpleNameComponentNormalizer.java?rev=327982&r1=327981&r2=327982&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/SimpleNameComponentNormalizer.java (original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/SimpleNameComponentNormalizer.java Sun Oct 23 23:50:03 2005
@@ -59,4 +59,10 @@
     {
         return normalizer.normalize( val ).toString();
     }
+
+
+    public boolean isDefined( String id )
+    {
+        return true;
+    }
 }