Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 74592 invoked from network); 24 Sep 2009 06:35:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Sep 2009 06:35:34 -0000 Received: (qmail 75383 invoked by uid 500); 24 Sep 2009 06:35:34 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 75310 invoked by uid 500); 24 Sep 2009 06:35:34 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 75300 invoked by uid 99); 24 Sep 2009 06:35:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Sep 2009 06:35:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Sep 2009 06:35:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AA70E23888E9; Thu, 24 Sep 2009 06:35:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090924063511.AA70E23888E9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 oidsMap ) throws InvalidNameException, + /** No qualifier */ static void rdnOidToName( Rdn rdn, Map 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 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(); + } }