directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r818376 - in /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap: name/LdapDN.java name/Rdn.java schema/registries/AttributeTypeRegistry.java
Date Thu, 24 Sep 2009 06:35:11 GMT
Author: elecharny
Date: Thu Sep 24 06:35:10 2009
New Revision: 818376

URL: http://svn.apache.org/viewvc?rev=818376&view=rev
Log:
o Added a toString() method
o Added a method to normalize a RDN without having to use a LdapDN

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?rev=818376&r1=818375&r2=818376&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Thu Sep 24 06:35:10 2009
@@ -1437,7 +1437,7 @@
      * @throws InvalidNameException If the RDN is invalid.
      * @throws NamingException If something went wrong.
      */
-    private static void rdnOidToName( Rdn rdn, Map<String, OidNormalizer> oidsMap )
throws InvalidNameException,
+    /** No qualifier */ static void rdnOidToName( Rdn rdn, Map<String, OidNormalizer>
oidsMap ) throws InvalidNameException,
         NamingException
     {
         if ( rdn.getNbAtavs() > 1 )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java?rev=818376&r1=818375&r2=818376&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
Thu Sep 24 06:35:10 2009
@@ -31,10 +31,12 @@
 import java.util.TreeSet;
 
 import javax.naming.InvalidNameException;
+import javax.naming.NamingException;
 
 import org.apache.commons.collections.map.MultiValueMap;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
+import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -309,10 +311,11 @@
 
     /**
      * Transform the external representation of the current RDN to an internal
-     * normalized form where : - types are trimmed and lowercased - values are
-     * trimmed and lowercased
+     * normalized form where : 
+     * - types are trimmed and lower cased 
+     * - values are trimmed and lower cased
      */
-    // WARNING : The protection level is left unspecified intentionnaly.
+    // WARNING : The protection level is left unspecified on purpose.
     // We need this method to be visible from the DnParser class, but not
     // from outside this package.
     /* Unspecified protection */void normalize()
@@ -362,6 +365,28 @@
                 break;
         }
     }
+    
+    
+    /**
+     * Transform a RDN by changing the value to its OID counterpart and
+     * normalizing the value accordingly to its type.
+     *
+     * @param rdn The RDN to modify.
+     * @param oidsMap The map of all existing oids and normalizer.
+     * @throws InvalidNameException If the RDN is invalid.
+     * @throws NamingException If something went wrong.
+     */
+    public Rdn normalize( Map<String, OidNormalizer> oidsMap ) throws InvalidNameException,
NamingException
+    {
+        String upName = getUpName();
+        LdapDN.rdnOidToName( this, oidsMap );
+        normalize();
+        this.upName = upName;
+
+        
+        return this;
+    }
+
 
 
     /**

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=818376&r1=818375&r2=818376&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
Thu Sep 24 06:35:10 2009
@@ -20,6 +20,16 @@
 package org.apache.directory.shared.ldap.schema.registries;
 
 
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.naming.NamingException;
+import javax.naming.directory.NoSuchAttributeException;
+
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
@@ -29,16 +39,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
-import javax.naming.directory.NoSuchAttributeException;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
 
 /**
  * An AttributeType registry service interface.
@@ -307,4 +307,9 @@
             throw new NoSuchAttributeException( ne.getMessage() );
         }
     }
+    
+    public String toString()
+    {
+        return byName.toString();
+    }
 }



Mime
View raw message