directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r923667 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/aci/ main/java/org/apache/directory/shared/ldap/name/ main/java/org/apache/directory/shared/ldap/schema/comparators/ main/java/org/apache/directory/sh...
Date Tue, 16 Mar 2010 10:22:37 GMT
Author: elecharny
Date: Tue Mar 16 10:22:36 2010
New Revision: 923667

URL: http://svn.apache.org/viewvc?rev=923667&view=rev
Log:
o Migrating the exceptions
o DN now does not inherit anymore from Name

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnParser.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java Tue Mar 16 10:22:36 2010
@@ -182,7 +182,7 @@ public abstract class UserClass implemen
             boolean isFirst = true;
             buffer.append( "{ " );
             
-            for ( javax.naming.Name name:names )
+            for ( DN name:names )
             {
                 if ( isFirst )
                 {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java Tue Mar 16 10:22:36 2010
@@ -31,6 +31,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
 
+import javax.naming.InvalidNameException;
 import javax.naming.Name;
 
 import org.apache.directory.shared.i18n.I18n;
@@ -62,7 +63,7 @@ import org.slf4j.LoggerFactory;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DN implements Name, Externalizable
+public class DN implements Externalizable
 {
     /** The LoggerFactory used by this class */
     protected static final Logger LOG = LoggerFactory.getLogger( DN.class );
@@ -122,18 +123,18 @@ public class DN implements Name, Externa
 
 
     /**
-     * Transduces, or copies a Name to an DN.
+     * Copies a DN to an DN.
      *
      * @param name composed of String name components.
      * @throws LdapInvalidDnException If the Name is invalid.
      */
-    public DN( Name name ) throws LdapInvalidDnException
+    public DN( DN dn ) throws LdapInvalidDnException
     {
-        if ( ( name != null ) && ( name.size() != 0 ) )
+        if ( ( dn != null ) && ( dn.size() != 0 ) )
         {
-            for ( int ii = 0; ii < name.size(); ii++ )
+            for ( int ii = 0; ii < dn.size(); ii++ )
             {
-                String nameComponent = name.get( ii );
+                String nameComponent = dn.get( ii );
                 add( nameComponent );
             }
         }
@@ -264,7 +265,7 @@ public class DN implements Name, Externa
      * @throws LdapInvalidNameException If the DN is invalid.
      * @throws LdapInvalidDnException If something went wrong.
      */
-    public static Name normalize( String name, Map<String, OidNormalizer> oidsMap ) throws LdapInvalidDnException
+    public static DN normalize( String name, Map<String, OidNormalizer> oidsMap ) throws LdapInvalidDnException
     {
         if ( ( name == null ) || ( name.length() == 0 ) || ( oidsMap == null ) || ( oidsMap.size() == 0 ) )
         {
@@ -562,7 +563,7 @@ public class DN implements Name, Externa
      * @param dn The DN.
      * @return A integer, which is the size of the UTF-8 byte array
      */
-    public static int getNbBytes( Name dn )
+    public static int getNbBytes( DN dn )
     {
         DN newDn = ( DN ) dn;
         return newDn.bytes == null ? 0 : newDn.bytes.length;
@@ -584,83 +585,39 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public boolean startsWith( Name name )
+    public boolean startsWith( DN dn )
     {
-        if ( name == null )
+        if ( dn == null )
         {
             return true;
         }
-        else if ( name instanceof DN )
-        {
-            DN nameDN = ( DN ) name;
-
-            if ( nameDN.size() == 0 )
-            {
-                return true;
-            }
-
-            if ( nameDN.size() > size() )
-            {
-                // The name is longer than the current DN.
-                return false;
-            }
-
-            // Ok, iterate through all the RDN of the name,
-            // starting a the end of the current list.
-
-            for ( int i = nameDN.size() - 1; i >= 0; i-- )
-            {
-                RDN nameRdn = nameDN.rdns.get( nameDN.rdns.size() - i - 1 );
-                RDN ldapRdn = rdns.get( rdns.size() - i - 1 );
-
-                if ( nameRdn.compareTo( ldapRdn ) != 0 )
-                {
-                    return false;
-                }
-            }
 
+        if ( dn.size() == 0 )
+        {
             return true;
         }
-        else
+
+        if ( dn.size() > size() )
         {
-            if ( name.size() == 0 )
-            {
-                return true;
-            }
+            // The name is longer than the current DN.
+            return false;
+        }
 
-            if ( name.size() > size() )
-            {
-                // The name is longer than the current DN.
-                return false;
-            }
+        // Ok, iterate through all the RDN of the name,
+        // starting a the end of the current list.
 
-            // Ok, iterate through all the RDN of the name,
-            // starting a the end of the current list.
-            int starting = size() - name.size();
+        for ( int i = dn.size() - 1; i >= 0; i-- )
+        {
+            RDN nameRdn = dn.rdns.get( dn.rdns.size() - i - 1 );
+            RDN ldapRdn = rdns.get( rdns.size() - i - 1 );
 
-            for ( int i = name.size() - 1; i >= 0; i-- )
+            if ( nameRdn.compareTo( ldapRdn ) != 0 )
             {
-                RDN ldapRdn = rdns.get( i + starting );
-                RDN nameRdn = null;
-
-                try
-                {
-                    nameRdn = new RDN( name.get( name.size() - i - 1 ) );
-                }
-                catch ( LdapInvalidDnException e )
-                {
-                    LOG.error( I18n.err( I18n.ERR_04204, name.toString() ), e );
-                    return false;
-                }
-
-                if ( nameRdn.compareTo( ldapRdn ) != 0 )
-                {
-                    return false;
-                }
+                return false;
             }
-
-            return true;
         }
+
+        return true;
     }
 
 
@@ -680,81 +637,86 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public boolean endsWith( Name name )
+    public boolean endsWith( DN dn )
     {
-        if ( name == null )
+        if ( dn == null )
         {
             return true;
         }
         
-        if ( name instanceof DN )
+        if ( dn.size() == 0 )
         {
-            DN nameDN = ( DN ) name;
+            return true;
+        }
 
-            if ( nameDN.size() == 0 )
-            {
-                return true;
-            }
+        if ( dn.size() > size() )
+        {
+            // The name is longer than the current DN.
+            return false;
+        }
 
-            if ( nameDN.size() > size() )
-            {
-                // The name is longer than the current DN.
-                return false;
-            }
+        // Ok, iterate through all the RDN of the name
+        for ( int i = 0; i < dn.size(); i++ )
+        {
+            RDN nameRdn = dn.rdns.get( i );
+            RDN ldapRdn = rdns.get( i );
 
-            // Ok, iterate through all the RDN of the name
-            for ( int i = 0; i < nameDN.size(); i++ )
+            if ( nameRdn.compareTo( ldapRdn ) != 0 )
             {
-                RDN nameRdn = nameDN.rdns.get( i );
-                RDN ldapRdn = rdns.get( i );
-
-                if ( nameRdn.compareTo( ldapRdn ) != 0 )
-                {
-                    return false;
-                }
+                return false;
             }
+        }
 
+        return true;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean endsWith( Name name )
+    {
+        if ( name == null )
+        {
             return true;
         }
-        else
+        
+        if ( name.size() == 0 )
+        {
+            return true;
+        }
+
+        if ( name.size() > size() )
+        {
+            // The name is longer than the current LdapDN.
+            return false;
+        }
+
+        // Ok, iterate through all the RDN of the name
+        int nameSize = name.size();
+        
+        for ( int i = name.size() - 1; i >= 0; i-- )
         {
-            if ( name.size() == 0 )
+            RDN ldapRdn = rdns.get( nameSize - i - 1 );
+            RDN nameRdn = null;
+
+            try
             {
-                return true;
+                nameRdn = new RDN( name.get( i ) );
             }
-
-            if ( name.size() > size() )
+            catch ( LdapInvalidDnException e )
             {
-                // The name is longer than the current DN.
+                LOG.error( I18n.err( I18n.ERR_04204, name.toString() ), e );
                 return false;
             }
 
-            // Ok, iterate through all the RDN of the name
-            int nameSize = name.size();
-            
-            for ( int i = name.size() - 1; i >= 0; i-- )
+            if ( nameRdn.compareTo( ldapRdn ) != 0 )
             {
-                RDN ldapRdn = rdns.get( nameSize - i - 1 );
-                RDN nameRdn = null;
-
-                try
-                {
-                    nameRdn = new RDN( name.get( i ) );
-                }
-                catch ( LdapInvalidDnException e )
-                {
-                    LOG.error( I18n.err( I18n.ERR_04204, name.toString() ), e );
-                    return false;
-                }
-
-                if ( nameRdn.compareTo( ldapRdn ) != 0 )
-                {
-                    return false;
-                }
+                return false;
             }
-
-            return true;
         }
+
+        return true;
     }
 
 
@@ -931,7 +893,7 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public Name getPrefix( int posn )
+    public DN getPrefix( int posn )
     {
         if ( rdns.size() == 0 )
         {
@@ -963,7 +925,7 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public Name getSuffix( int posn )
+    public DN getSuffix( int posn )
     {
         if ( rdns.size() == 0 )
         {
@@ -1008,7 +970,7 @@ public class DN implements Name, Externa
      *             if <tt>n</tt> is not a valid name, or if the addition of
      *             the components would violate the syntax rules of this name
      */
-    public Name addAllNormalized( int posn, Name name ) throws LdapInvalidDnException
+    public DN addAllNormalized( int posn, DN name ) throws LdapInvalidDnException
     {
         if ( name instanceof DN )
         {
@@ -1058,7 +1020,7 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public Name addAll( Name suffix ) throws LdapInvalidNameException
+    public DN addAll( DN suffix ) throws LdapInvalidDnException
     {
         addAll( rdns.size(), suffix );
         normalizeInternal();
@@ -1071,58 +1033,51 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public Name addAll( int posn, Name name ) throws LdapInvalidNameException
+    public DN addAll( int posn, Name name ) throws InvalidNameException, LdapInvalidDnException
     {
-        if ( name instanceof DN )
+        if ( ( name == null ) || ( name.size() == 0 ) )
         {
-            DN dn = (DN)name;
-            
-            if ( ( dn == null ) || ( dn.size() == 0 ) )
-            {
-                return this;
-            }
+            return this;
+        }
 
-            // Concatenate the rdns
-            rdns.addAll( size() - posn, dn.rdns );
+        for ( int i = name.size() - 1; i >= 0; i-- )
+        {
+            RDN rdn = new RDN( name.get( i ) );
+            rdns.add( size() - posn, rdn );
+        }
 
-            // Regenerate the normalized name and the original string
-            if ( this.isNormalized() && dn.isNormalized() )
-            {
-                if ( this.size() != 0 )
-                {
-                    normName = dn.getNormName() + "," + normName;
-                    bytes = StringTools.getBytesUtf8( normName );
-                    upName = dn.getName() + "," + upName;
-                }
-            }
-            else
+        normalizeInternal();
+        toUpName();
+
+        return this;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DN addAll( int posn, DN dn ) throws LdapInvalidDnException
+    {
+        if ( ( dn == null ) || ( dn.size() == 0 ) )
+        {
+            return this;
+        }
+
+        // Concatenate the rdns
+        rdns.addAll( size() - posn, dn.rdns );
+
+        // Regenerate the normalized name and the original string
+        if ( this.isNormalized() && dn.isNormalized() )
+        {
+            if ( this.size() != 0 )
             {
-                normalizeInternal();
-                toUpName();
+                normName = dn.getNormName() + "," + normName;
+                bytes = StringTools.getBytesUtf8( normName );
+                upName = dn.getName() + "," + upName;
             }
         }
         else
         {
-            if ( ( name == null ) || ( name.size() == 0 ) )
-            {
-                return this;
-            }
-
-            for ( int i = name.size() - 1; i >= 0; i-- )
-            {
-                //FIXME this try-catch block is for the time being, during removal of
-                // java.naming.Name we have to remove this
-                try
-                {
-                    RDN rdn = new RDN( name.get( i ) );
-                    rdns.add( size() - posn, rdn );
-                }
-                catch( LdapInvalidDnException le )
-                {
-                    throw new LdapInvalidNameException( le.getMessage() );
-                }
-            }
-
             normalizeInternal();
             toUpName();
         }
@@ -1134,7 +1089,7 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public Name add( String comp ) throws LdapException
+    public DN add( String comp ) throws LdapInvalidDnException
     {
         if ( comp.length() == 0 )
         {
@@ -1168,7 +1123,7 @@ public class DN implements Name, Externa
      * @param newRdn the RDN to add
      * @return the updated name (not a new one)
      */
-    public Name add( RDN newRdn )
+    public DN add( RDN newRdn )
     {
         rdns.add( 0, newRdn );
         
@@ -1186,7 +1141,7 @@ public class DN implements Name, Externa
      * @param pos The position where we want to add the Rdn
      * @return the updated name (not a new one)
      */
-    public Name add( int pos, RDN newRdn )
+    public DN add( int pos, RDN newRdn )
     {
         rdns.add( newRdn );
         
@@ -1203,7 +1158,7 @@ public class DN implements Name, Externa
      * @param newRdn the RDN to add
      * @return the updated name (not a new one)
      */
-    public Name addNormalized( RDN newRdn )
+    public DN addNormalized( RDN newRdn )
     {
         rdns.add( 0, newRdn );
         
@@ -1231,7 +1186,7 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public Name add( int posn, String comp ) throws LdapInvalidNameException
+    public DN add( int posn, String comp ) throws LdapInvalidDnException
     {
         if ( ( posn < 0 ) || ( posn > size() ) )
         {
@@ -1252,7 +1207,7 @@ public class DN implements Name, Externa
         }
         catch( LdapInvalidDnException le )
         {
-            throw new LdapInvalidNameException( le.getMessage() );
+            throw new LdapInvalidDnException( le.getMessage() );
         }
 
         normalizeInternal();
@@ -1265,7 +1220,7 @@ public class DN implements Name, Externa
     /**
      * {@inheritDoc}
      */
-    public Object remove( int posn ) throws LdapInvalidNameException
+    public Object remove( int posn ) throws LdapInvalidDnException
     {
         if ( rdns.size() == 0 )
         {
@@ -1408,12 +1363,19 @@ public class DN implements Name, Externa
 
                 if ( oidNormalizer != null )
                 {
+                    try
+                    {
                     return new AVA( 
                         atav.getUpType(), 
                         oidNormalizer.getAttributeTypeOid(), 
                         atav.getUpValue(),
-                        oidNormalizer.getNormalizer().normalize( atav.getNormValue() ),
+                            oidNormalizer.getNormalizer().normalize( atav.getNormValue() ),
                         atav.getUpName() );
+                    }
+                    catch ( LdapException le )
+                    {
+                        throw new LdapInvalidDnException( le.getMessage() );
+                    }
                 }
                 else
                 {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnParser.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnParser.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DnParser.java Tue Mar 16 10:22:36 2010
@@ -22,9 +22,6 @@ package org.apache.directory.shared.ldap
 
 import java.util.List;
 
-import javax.naming.InvalidNameException;
-import javax.naming.Name;
-
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 
 
@@ -125,13 +122,11 @@ public enum DnParser
     /**
      * Parse a String and return a DN if the String is a valid DN
      *
-     * @param dn
-     *            The DN to parse
+     * @param dn The DN to parse
      * @return A DN
-     * @throws InvalidNameException
-     *             If the String is not a valid DN
+     * @throws LdapInvalidDnException If the String is not a valid DN
      */
-    public Name parse( String dn ) throws LdapInvalidDnException
+    public DN parse( String dn ) throws LdapInvalidDnException
     {
         return new DN( dn );
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java Tue Mar 16 10:22:36 2010
@@ -22,10 +22,9 @@ package org.apache.directory.shared.ldap
 
 import java.util.List;
 
-import javax.naming.Name;
-
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.Position;
@@ -54,10 +53,14 @@ public enum FastDnParser
     }
 
 
-    /* (non-Javadoc)
-     * @see javax.naming.NameParser#parse(java.lang.String)
+    /**
+     * Parses a DN from a String
+     *
+     * @param name The DN to parse
+     * @return A valid DN
+     * @throws LdapException If the DN was invalid
      */
-    public Name parse( String name ) throws LdapInvalidDnException
+    public DN parse( String name ) throws LdapException
     {
         DN dn = new DN();
         parseDn( name, dn );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java Tue Mar 16 10:22:36 2010
@@ -35,6 +35,7 @@ import org.apache.commons.collections.ma
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -391,7 +392,7 @@ public class RDN implements Cloneable, C
      *
      * @param rdn The RDN to modify.
      * @param oidsMap The map of all existing oids and normalizer.
-     * @throws LdapInvalidDnException If the RDN is invalid.
+     * @throws LdapException If the RDN is invalid.
      */
     public RDN normalize( Map<String, OidNormalizer> oidsMap ) throws LdapInvalidDnException
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/DnComparator.java Tue Mar 16 10:22:36 2010
@@ -20,8 +20,8 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import javax.naming.Name;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.name.DN;
@@ -69,7 +69,7 @@ public class DnComparator extends LdapCo
     }
 
 
-    public DN getDn( Object obj ) throws LdapException
+    public DN getDn( Object obj ) throws LdapInvalidDnException
     {
         DN dn = null;
         
@@ -79,11 +79,6 @@ public class DnComparator extends LdapCo
             
             dn = ( dn.isNormalized() ? dn : DN.normalize( dn, schemaManager.getNormalizerMapping() ) );
         }
-        else if ( obj instanceof Name )
-        {
-            dn = new DN( ( Name ) obj );
-            dn.normalize( schemaManager.getNormalizerMapping() );
-        }
         else if ( obj instanceof String )
         {
             dn = new DN( ( String ) obj );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/UniqueMemberComparator.java Tue Mar 16 10:22:36 2010
@@ -20,8 +20,8 @@
 package org.apache.directory.shared.ldap.schema.comparators;
 
 
-import javax.naming.Name;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.name.DN;
@@ -76,7 +76,7 @@ public class UniqueMemberComparator exte
             {
                 return getDn( dnstr0 ).compareTo( getDn( dnstr1 ) );
             }
-            catch ( LdapException ne )
+            catch ( LdapInvalidDnException ne )
             {
                 return -1;
             }
@@ -164,7 +164,7 @@ public class UniqueMemberComparator exte
     }
 
 
-    public DN getDn( Object obj ) throws LdapException
+    public DN getDn( Object obj ) throws LdapInvalidDnException
     {
         DN dn = null;
 
@@ -174,11 +174,6 @@ public class UniqueMemberComparator exte
 
             dn = ( dn.isNormalized() ? dn : DN.normalize( dn, schemaManager.getNormalizerMapping() ) );
         }
-        else if ( obj instanceof Name )
-        {
-            dn = new DN( ( Name ) obj );
-            dn.normalize( schemaManager.getNormalizerMapping() );
-        }
         else if ( obj instanceof String )
         {
             dn = new DN( ( String ) obj );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java Tue Mar 16 10:22:36 2010
@@ -20,9 +20,8 @@
 
 package org.apache.directory.shared.ldap.trigger;
 
-import javax.naming.Name;
-
 import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.name.DN;
 
 
 /**
@@ -33,23 +32,23 @@ import org.apache.directory.shared.ldap.
 public class StoredProcedureSearchContextOption implements StoredProcedureOption
 {
     
-    private final Name baseObject;
+    private final DN baseObject;
     private SearchScope searchScope;
 
     
-    public StoredProcedureSearchContextOption( Name baseObject )
+    public StoredProcedureSearchContextOption( DN baseObject )
     {
         // the default search scope is "base"
         this( baseObject, SearchScope.OBJECT );
     }
     
-    public StoredProcedureSearchContextOption( Name baseObject, SearchScope searchScope )
+    public StoredProcedureSearchContextOption( DN baseObject, SearchScope searchScope )
     {
         this.baseObject = baseObject;
         this.searchScope = searchScope;
     }
 
-    public Name getBaseObject()
+    public DN getBaseObject()
     {
         return baseObject;
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java Tue Mar 16 10:22:36 2010
@@ -77,7 +77,7 @@ public class NamespaceTools
      * @param name2 the second name
      * @return true if the names are siblings, false otherwise.
      */
-    public static boolean isSibling( Name name1, Name name2 ) throws LdapException
+    public static boolean isSibling( DN name1, DN name2 ) throws LdapException
     {
         if ( name1.size() == name2.size() )
         {
@@ -110,11 +110,11 @@ public class NamespaceTools
      * 
      * @param ancestor the normalized distinguished name of the ancestor context
      * @param descendant the normalized distinguished name of the descendant context
-     * @return the relatve normalized name between the ancestor and the
+     * @return the relative normalized name between the ancestor and the
      *         descendant contexts
      * @throws javax.naming.LdapException if the contexts are not related in the ancestual sense
      */
-    public static Name getRelativeName( Name ancestor, Name descendant ) throws LdapException
+    public static DN getRelativeName( DN ancestor, DN descendant ) throws LdapException
     {
         DN rdn = null;
         

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java Tue Mar 16 10:22:36 2010
@@ -24,9 +24,10 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.naming.NamingException;
-
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.slf4j.Logger;
@@ -84,7 +85,7 @@ public class DnBranchNode<N> implements 
      * @param element The associated element to add as a tree node
      * @return The modified tree structure.
      */
-    private DnNode<N> recursivelyAddElement( DnBranchNode<N> current, DN dn, int index, N element ) throws NamingException
+    private DnNode<N> recursivelyAddElement( DnBranchNode<N> current, DN dn, int index, N element ) throws LdapException
     {
         String rdnAtIndex = dn.getRdn( index ).toString();
         
@@ -107,7 +108,7 @@ public class DnBranchNode<N> implements 
             {
                 String message = I18n.err( I18n.ERR_04334 );
                 LOG.error( message );
-                throw new NamingException( message );
+                throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, message );
             }
         
             if ( newNode == null )
@@ -347,7 +348,7 @@ public class DnBranchNode<N> implements 
      * @param element
      * @throws NamingException
      */
-    public void add( DN dn, N element ) throws NamingException
+    public void add( DN dn, N element ) throws LdapException
     {
         recursivelyAddElement( this, dn, 0, element );
     }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java Tue Mar 16 10:22:36 2010
@@ -42,7 +42,7 @@ import java.util.Map;
 import java.util.Properties;
 
 import javax.naming.CompoundName;
-import javax.naming.Name;
+import javax.naming.InvalidNameException;
 import javax.naming.ldap.LdapName;
 
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -1186,7 +1186,7 @@ public class DNTest
     public void testDnEndsWithNull() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
-        assertEquals( true, dn.endsWith( null ) );
+        assertEquals( true, dn.endsWith( (DN)null ) );
     }
 
 
@@ -1460,7 +1460,7 @@ public class DNTest
     public void testJNDITutorialExample() throws Exception
     {
         // Parse the name
-        Name name = new DN( "cn=John,ou=People,ou=Marketing" );
+        DN name = new DN( "cn=John,ou=People,ou=Marketing" );
 
         // Remove the second component from the head: ou=People
         String out = name.remove( 1 ).toString();
@@ -1482,8 +1482,8 @@ public class DNTest
     @Test
     public void testAttributeEqualsIsCaseInSensitive() throws Exception
     {
-        Name name1 = new DN( "cn=HomeDir" );
-        Name name2 = new DN( "CN=HomeDir" );
+        DN name1 = new DN( "cn=HomeDir" );
+        DN name2 = new DN( "CN=HomeDir" );
 
         assertTrue( name1.equals( name2 ) );
     }
@@ -1492,8 +1492,8 @@ public class DNTest
     @Test
     public void testAttributeTypeEqualsIsCaseInsensitive() throws Exception
     {
-        Name name1 = new DN( "cn=HomeDir+cn=WorkDir" );
-        Name name2 = new DN( "cn=HomeDir+CN=WorkDir" );
+        DN name1 = new DN( "cn=HomeDir+cn=WorkDir" );
+        DN name2 = new DN( "cn=HomeDir+CN=WorkDir" );
 
         assertTrue( name1.equals( name2 ) );
     }
@@ -1503,8 +1503,8 @@ public class DNTest
     public void testNameEqualsIsInsensitiveToAttributesOrder() throws Exception
     {
 
-        Name name1 = new DN( "cn=HomeDir+cn=WorkDir" );
-        Name name2 = new DN( "cn=WorkDir+cn=HomeDir" );
+        DN name1 = new DN( "cn=HomeDir+cn=WorkDir" );
+        DN name2 = new DN( "cn=WorkDir+cn=HomeDir" );
 
         assertTrue( name1.equals( name2 ) );
     }
@@ -1513,8 +1513,8 @@ public class DNTest
     @Test
     public void testAttributeComparisonIsCaseInSensitive() throws Exception
     {
-        Name name1 = new DN( "cn=HomeDir" );
-        Name name2 = new DN( "CN=HomeDir" );
+        DN name1 = new DN( "cn=HomeDir" );
+        DN name2 = new DN( "CN=HomeDir" );
 
         assertEquals( 0, name1.compareTo( name2 ) );
     }
@@ -1523,8 +1523,8 @@ public class DNTest
     @Test
     public void testAttributeTypeComparisonIsCaseInsensitive() throws Exception
     {
-        Name name1 = new DN( "cn=HomeDir+cn=WorkDir" );
-        Name name2 = new DN( "cn=HomeDir+CN=WorkDir" );
+        DN name1 = new DN( "cn=HomeDir+cn=WorkDir" );
+        DN name2 = new DN( "cn=HomeDir+CN=WorkDir" );
 
         assertEquals( 0, name1.compareTo( name2 ) );
     }
@@ -1534,8 +1534,8 @@ public class DNTest
     public void testNameComparisonIsInsensitiveToAttributesOrder() throws Exception
     {
 
-        Name name1 = new DN( "cn=HomeDir+cn=WorkDir" );
-        Name name2 = new DN( "cn=WorkDir+cn=HomeDir" );
+        DN name1 = new DN( "cn=HomeDir+cn=WorkDir" );
+        DN name2 = new DN( "cn=WorkDir+cn=HomeDir" );
 
         assertEquals( 0, name1.compareTo( name2 ) );
     }
@@ -1545,8 +1545,8 @@ public class DNTest
     public void testNameComparisonIsInsensitiveToAttributesOrderFailure() throws Exception
     {
 
-        Name name1 = new DN( "cn= HomeDir+cn=Workdir" );
-        Name name2 = new DN( "cn = Work+cn=HomeDir" );
+        DN name1 = new DN( "cn= HomeDir+cn=Workdir" );
+        DN name2 = new DN( "cn = Work+cn=HomeDir" );
 
         assertEquals( 1, name1.compareTo( name2 ) );
     }
@@ -1574,7 +1574,7 @@ public class DNTest
             { 'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', ( byte ) 0xc3,
                 ( byte ) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y' } );
 
-        Name name = DnParser.getNameParser().parse( dn );
+        DN name = DnParser.getNameParser().parse( dn );
 
         assertEquals( dn, ( ( DN ) name ).getName() );
         assertEquals( "cn=Emmanuel  L\u00E9charny", ((DN)name).getNormName() );
@@ -1590,17 +1590,17 @@ public class DNTest
     @Test
     public void testLdapNameString() throws Exception
     {
-        Name name = new DN( "" );
-        Name name50 = new DN();
+        DN name = new DN( "" );
+        DN name50 = new DN();
         assertEquals( name50, name );
 
-        Name name0 = new DN( "ou=Marketing,ou=East" );
-        Name copy = new DN( "ou=Marketing,ou=East" );
-        Name name1 = new DN( "cn=John,ou=Marketing,ou=East" );
-        Name name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name name3 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=West" );
-        Name name4 = new DN( "cn=Website,cn=John,ou=Marketing,ou=West" );
-        Name name5 = new DN( "cn=Airline,cn=John,ou=Marketing,ou=West" );
+        DN name0 = new DN( "ou=Marketing,ou=East" );
+        DN copy = new DN( "ou=Marketing,ou=East" );
+        DN name1 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name3 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=West" );
+        DN name4 = new DN( "cn=Website,cn=John,ou=Marketing,ou=West" );
+        DN name5 = new DN( "cn=Airline,cn=John,ou=Marketing,ou=West" );
 
         assertTrue( name0.compareTo( copy ) == 0 );
         assertTrue( name0.compareTo( name1 ) < 0 );
@@ -1623,7 +1623,7 @@ public class DNTest
     @Test
     public void testLdapName()
     {
-        Name name = new DN();
+        DN name = new DN();
         assertTrue( name.toString().equals( "" ) );
     }
 
@@ -1638,7 +1638,7 @@ public class DNTest
     public void testClone() throws Exception
     {
         String strName = "cn=HomeDir,cn=John,ou=Marketing,ou=East";
-        Name name = new DN( strName );
+        DN name = new DN( strName );
         assertEquals( name, name.clone() );
     }
 
@@ -1652,13 +1652,13 @@ public class DNTest
     @Test
     public void testCompareTo() throws Exception
     {
-        Name name0 = new DN( "ou=Marketing,ou=East" );
-        Name copy = new DN( "ou=Marketing,ou=East" );
-        Name name1 = new DN( "cn=John,ou=Marketing,ou=East" );
-        Name name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name name3 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=West" );
-        Name name4 = new DN( "cn=Website,cn=John,ou=Marketing,ou=West" );
-        Name name5 = new DN( "cn=Airline,cn=John,ou=Marketing,ou=West" );
+        DN name0 = new DN( "ou=Marketing,ou=East" );
+        DN copy = new DN( "ou=Marketing,ou=East" );
+        DN name1 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name3 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=West" );
+        DN name4 = new DN( "cn=Website,cn=John,ou=Marketing,ou=West" );
+        DN name5 = new DN( "cn=Airline,cn=John,ou=Marketing,ou=West" );
 
         assertTrue( name0.compareTo( copy ) == 0 );
         assertTrue( name0.compareTo( name1 ) < 0 );
@@ -1673,14 +1673,14 @@ public class DNTest
         assertTrue( name4.compareTo( name5 ) > 0 );
         assertTrue( name2.compareTo( name5 ) < 0 );
 
-        List<Name> list = new ArrayList<Name>();
+        List<DN> list = new ArrayList<DN>();
 
-        Comparator<Name> comparator = new Comparator<Name>()
+        Comparator<DN> comparator = new Comparator<DN>()
         {
-            public int compare( Name obj1, Name obj2 )
+            public int compare( DN obj1, DN obj2 )
             {
-                Name n1 = obj1;
-                Name n2 = obj2;
+                DN n1 = obj1;
+                DN n2 = obj2;
                 return n1.compareTo( n2 );
             }
 
@@ -1727,13 +1727,13 @@ public class DNTest
     @Test
     public void testSize() throws Exception
     {
-        Name name0 = new DN( "" );
-        Name name1 = new DN( "ou=East" );
-        Name name2 = new DN( "ou=Marketing,ou=East" );
-        Name name3 = new DN( "cn=John,ou=Marketing,ou=East" );
-        Name name4 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name name5 = new DN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
-        Name name6 = new DN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
+        DN name0 = new DN( "" );
+        DN name1 = new DN( "ou=East" );
+        DN name2 = new DN( "ou=Marketing,ou=East" );
+        DN name3 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN name4 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name5 = new DN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
+        DN name6 = new DN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
 
         assertEquals( 0, name0.size() );
         assertEquals( 1, name1.size() );
@@ -1754,13 +1754,13 @@ public class DNTest
     @Test
     public void testIsEmpty() throws Exception
     {
-        Name name0 = new DN( "" );
-        Name name1 = new DN( "ou=East" );
-        Name name2 = new DN( "ou=Marketing,ou=East" );
-        Name name3 = new DN( "cn=John,ou=Marketing,ou=East" );
-        Name name4 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name name5 = new DN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
-        Name name6 = new DN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
+        DN name0 = new DN( "" );
+        DN name1 = new DN( "ou=East" );
+        DN name2 = new DN( "ou=Marketing,ou=East" );
+        DN name3 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN name4 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name5 = new DN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
+        DN name6 = new DN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
 
         assertEquals( true, name0.isEmpty() );
         assertEquals( false, name1.isEmpty() );
@@ -1781,13 +1781,13 @@ public class DNTest
     @Test
     public void testGetAll() throws Exception
     {
-        Name name0 = new DN( "" );
-        Name name1 = new DN( "ou=East" );
-        Name name2 = new DN( "ou=Marketing,ou=East" );
-        Name name3 = new DN( "cn=John,ou=Marketing,ou=East" );
-        Name name4 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name name5 = new DN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
-        Name name6 = new DN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
+        DN name0 = new DN( "" );
+        DN name1 = new DN( "ou=East" );
+        DN name2 = new DN( "ou=Marketing,ou=East" );
+        DN name3 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN name4 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name5 = new DN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
+        DN name6 = new DN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
 
         Enumeration<String> enum0 = name0.getAll();
         assertEquals( false, enum0.hasMoreElements() );
@@ -2004,7 +2004,7 @@ public class DNTest
     @Test
     public void testGet() throws Exception
     {
-        Name name = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
         assertEquals( "cn=HomeDir", name.get( 3 ) );
         assertEquals( "cn=John", name.get( 2 ) );
         assertEquals( "ou=Marketing", name.get( 1 ) );
@@ -2034,7 +2034,7 @@ public class DNTest
     @Test
     public void testGetXSuffix() throws Exception
     {
-        Name name = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
         assertEquals( "", name.getSuffix( 4 ).toString() );
         assertEquals( "cn=HomeDir", name.getSuffix( 3 ).toString() );
         assertEquals( "cn=HomeDir,cn=John", name.getSuffix( 2 ).toString() );
@@ -2052,7 +2052,7 @@ public class DNTest
     @Test
     public void testGetPrefix() throws Exception
     {
-        Name name = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
 
         assertEquals( "cn=HomeDir,cn=John,ou=Marketing,ou=East", name.getPrefix( 4 ).toString() );
         assertEquals( "cn=John,ou=Marketing,ou=East", name.getPrefix( 3 ).toString() );
@@ -2071,16 +2071,16 @@ public class DNTest
     @Test
     public void testStartsWith() throws Exception
     {
-        Name n0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name n1 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name n2 = new DN( "cn=John,ou=Marketing,ou=East" );
-        Name n3 = new DN( "ou=Marketing,ou=East" );
-        Name n4 = new DN( "ou=East" );
-        Name n5 = new DN( "" );
-
-        Name n6 = new DN( "cn=HomeDir" );
-        Name n7 = new DN( "cn=HomeDir,cn=John" );
-        Name n8 = new DN( "cn=HomeDir,cn=John,ou=Marketing" );
+        DN n0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN n1 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN n2 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN n3 = new DN( "ou=Marketing,ou=East" );
+        DN n4 = new DN( "ou=East" );
+        DN n5 = new DN( "" );
+
+        DN n6 = new DN( "cn=HomeDir" );
+        DN n7 = new DN( "cn=HomeDir,cn=John" );
+        DN n8 = new DN( "cn=HomeDir,cn=John,ou=Marketing" );
 
         // Check with DN
         assertTrue( n0.startsWith( n1 ) );
@@ -2093,10 +2093,10 @@ public class DNTest
         assertTrue( !n0.startsWith( n7 ) );
         assertTrue( !n0.startsWith( n8 ) );
         
-        Name nn0 = new DN( "cn=zero" );
-        Name nn10 = new DN( "cn=one,cn=zero" );
-        Name nn210 = new DN( "cn=two,cn=one,cn=zero" );
-        Name nn3210 = new DN( "cn=three,cn=two,cn=one,cn=zero" );
+        DN nn0 = new DN( "cn=zero" );
+        DN nn10 = new DN( "cn=one,cn=zero" );
+        DN nn210 = new DN( "cn=two,cn=one,cn=zero" );
+        DN nn3210 = new DN( "cn=three,cn=two,cn=one,cn=zero" );
         
         assertTrue( nn0.startsWith( nn0 ) );
         assertTrue( nn10.startsWith( nn0 ) );
@@ -2112,36 +2112,14 @@ public class DNTest
 
         assertTrue( nn3210.startsWith( nn3210 ) );
         
-        // Check with LdapName
-        Name name0 = new LdapName( "cn=zero" );
-        Name name10 = new LdapName( "cn=one,cn=zero" );
-        Name name210 = new LdapName( "cn=two,cn=one,cn=zero" );
-        Name name3210 = new LdapName( "cn=three,cn=two,cn=one,cn=zero" );
-        
-        // Check with Name
-        assertTrue( nn0.startsWith( name0 ) );
-        assertTrue( nn10.startsWith( name0 ) );
-        assertTrue( nn210.startsWith( name0 ) );
-        assertTrue( nn3210.startsWith( name0 ) );
-
-        assertTrue( nn10.startsWith( name10 ) );
-        assertTrue( nn210.startsWith( name10 ) );
-        assertTrue( nn3210.startsWith( name10 ) );
-
-        assertTrue( nn210.startsWith( name210 ) );
-        assertTrue( nn3210.startsWith( name210 ) );
-
-        assertTrue( nn3210.startsWith( name3210 ) );
-        
-
         assertTrue( "Starting DN fails with ADS DN", 
             new DN( "ou=foo,dc=apache,dc=org" ).startsWith( new DN( "dc=apache,dc=org" ) ) );
         
         assertTrue( "Starting DN fails with Java LdapName", 
-            new DN( "ou=foo,dc=apache,dc=org" ).startsWith( new LdapName( "dc=apache,dc=org" ) ) );
+            new DN( "ou=foo,dc=apache,dc=org" ).startsWith( new DN( "dc=apache,dc=org" ) ) );
 
         assertTrue( "Starting DN fails with Java LdapName", 
-            new DN( "dc=apache,dc=org" ).startsWith( new LdapName( "dc=apache,dc=org" ) ) );
+            new DN( "dc=apache,dc=org" ).startsWith( new DN( "dc=apache,dc=org" ) ) );
     }
 
 
@@ -2154,16 +2132,16 @@ public class DNTest
     @Test
     public void testEndsWith() throws Exception
     {
-        Name name0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name name1 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        Name name2 = new DN( "cn=John,ou=Marketing,ou=East" );
-        Name name3 = new DN( "ou=Marketing,ou=East" );
-        Name name4 = new DN( "ou=East" );
-        Name name5 = new DN( "" );
-
-        Name name6 = new DN( "cn=HomeDir" );
-        Name name7 = new DN( "cn=HomeDir,cn=John" );
-        Name name8 = new DN( "cn=HomeDir,cn=John,ou=Marketing" );
+        DN name0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name1 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name2 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN name3 = new DN( "ou=Marketing,ou=East" );
+        DN name4 = new DN( "ou=East" );
+        DN name5 = new DN( "" );
+
+        DN name6 = new DN( "cn=HomeDir" );
+        DN name7 = new DN( "cn=HomeDir,cn=John" );
+        DN name8 = new DN( "cn=HomeDir,cn=John,ou=Marketing" );
 
         assertTrue( name0.endsWith( name1 ) );
         assertTrue( !name0.endsWith( name2 ) );
@@ -2178,7 +2156,7 @@ public class DNTest
 
 
     /**
-     * Class to test for Name addAll(Name)
+     * Class to test for DN addAll(DN)
      *
      * @throws Exception
      *             when anything goes wrong
@@ -2186,14 +2164,14 @@ public class DNTest
     @Test
     public void testAddAllName0() throws Exception
     {
-        Name name = new DN();
-        Name name0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name = new DN();
+        DN name0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
         assertTrue( name0.equals( name.addAll( name0 ) ) );
     }
 
 
     /**
-     * Class to test for Name addAll(Name)
+     * Class to test for DN addAll(DN)
      *
      * @throws Exception
      *             when anything goes wrong
@@ -2201,15 +2179,15 @@ public class DNTest
     @Test
     public void testAddAllNameExisting0() throws Exception
     {
-        Name name1 = new DN( "ou=Marketing,ou=East" );
-        Name name2 = new DN( "cn=HomeDir,cn=John" );
-        Name nameAdded = new DN( "cn=HomeDir,cn=John, ou=Marketing,ou=East" );
+        DN name1 = new DN( "ou=Marketing,ou=East" );
+        DN name2 = new DN( "cn=HomeDir,cn=John" );
+        DN nameAdded = new DN( "cn=HomeDir,cn=John, ou=Marketing,ou=East" );
         assertTrue( nameAdded.equals( name1.addAll( name2 ) ) );
     }
 
 
     /**
-     * Class to test for Name addAll(Name)
+     * Class to test for DN addAll(DN)
      *
      * @throws Exception
      *             when anything goes wrong
@@ -2217,10 +2195,10 @@ public class DNTest
     @Test
     public void testAddAllName1() throws Exception
     {
-        Name name = new DN();
-        Name name0 = new DN( "ou=Marketing,ou=East" );
-        Name name1 = new DN( "cn=HomeDir,cn=John" );
-        Name name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name = new DN();
+        DN name0 = new DN( "ou=Marketing,ou=East" );
+        DN name1 = new DN( "cn=HomeDir,cn=John" );
+        DN name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
 
         assertTrue( name0.equals( name.addAll( name0 ) ) );
         assertTrue( name2.equals( name.addAll( name1 ) ) );
@@ -2228,7 +2206,7 @@ public class DNTest
 
 
     /**
-     * Class to test for Name addAll(int, Name)
+     * Class to test for DN addAll(int, DN)
      *
      * @throws Exception
      *             when something goes wrong
@@ -2236,10 +2214,10 @@ public class DNTest
     @Test
     public void testAddAllintName0() throws Exception
     {
-        Name name = new DN();
-        Name name0 = new DN( "ou=Marketing,ou=East" );
-        Name name1 = new DN( "cn=HomeDir,cn=John" );
-        Name name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name = new DN();
+        DN name0 = new DN( "ou=Marketing,ou=East" );
+        DN name1 = new DN( "cn=HomeDir,cn=John" );
+        DN name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
 
         assertTrue( name0.equals( name.addAll( name0 ) ) );
         assertTrue( name2.equals( name.addAll( 2, name1 ) ) );
@@ -2247,7 +2225,7 @@ public class DNTest
 
 
     /**
-     * Class to test for Name addAll(int, Name)
+     * Class to test for DN addAll(int, DN)
      *
      * @throws Exception
      *             when something goes wrong
@@ -2255,28 +2233,28 @@ public class DNTest
     @Test
     public void testAddAllintName1() throws Exception
     {
-        Name name = new DN();
-        Name name0 = new DN( "cn=HomeDir,ou=Marketing,ou=East" );
-        Name name1 = new DN( "cn=John" );
-        Name name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name = new DN();
+        DN name0 = new DN( "cn=HomeDir,ou=Marketing,ou=East" );
+        DN name1 = new DN( "cn=John" );
+        DN name2 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
 
         assertTrue( name0.equals( name.addAll( name0 ) ) );
         assertTrue( name2.equals( name.addAll( 2, name1 ) ) );
 
-        Name name3 = new DN( "cn=Airport" );
-        Name name4 = new DN( "cn=Airport,cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name3 = new DN( "cn=Airport" );
+        DN name4 = new DN( "cn=Airport,cn=HomeDir,cn=John,ou=Marketing,ou=East" );
 
         assertTrue( name4.equals( name.addAll( 4, name3 ) ) );
 
-        Name name5 = new DN( "cn=ABC123" );
-        Name name6 = new DN( "cn=Airport,cn=HomeDir,cn=ABC123,cn=John,ou=Marketing,ou=East" );
+        DN name5 = new DN( "cn=ABC123" );
+        DN name6 = new DN( "cn=Airport,cn=HomeDir,cn=ABC123,cn=John,ou=Marketing,ou=East" );
 
         assertTrue( name6.equals( name.addAll( 3, name5 ) ) );
     }
 
 
     /**
-     * Class to test for Name add(String)
+     * Class to test for DN add(String)
      *
      * @throws Exception
      *             when something goes wrong
@@ -2284,22 +2262,22 @@ public class DNTest
     @Test
     public void testAddString() throws Exception
     {
-        Name name = new DN();
+        DN name = new DN();
         assertEquals( name, new DN( "" ) );
 
-        Name name4 = new DN( "ou=East" );
+        DN name4 = new DN( "ou=East" );
         name.add( "ou=East" );
         assertEquals( name4, name );
 
-        Name name3 = new DN( "ou=Marketing,ou=East" );
+        DN name3 = new DN( "ou=Marketing,ou=East" );
         name.add( "ou=Marketing" );
         assertEquals( name3, name );
 
-        Name name2 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN name2 = new DN( "cn=John,ou=Marketing,ou=East" );
         name.add( "cn=John" );
         assertEquals( name2, name );
 
-        Name name0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
         name.add( "cn=HomeDir" );
         assertEquals( name0, name );
     }
@@ -2314,34 +2292,34 @@ public class DNTest
     @Test
     public void testAddintString() throws Exception
     {
-        Name name = new DN();
+        DN name = new DN();
         assertEquals( name, new DN( "" ) );
 
-        Name name4 = new DN( "ou=East" );
+        DN name4 = new DN( "ou=East" );
         name.add( "ou=East" );
         assertEquals( name4, name );
 
-        Name name3 = new DN( "ou=Marketing,ou=East" );
+        DN name3 = new DN( "ou=Marketing,ou=East" );
         name.add( 1, "ou=Marketing" );
         assertEquals( name3, name );
 
-        Name name2 = new DN( "cn=John,ou=Marketing,ou=East" );
+        DN name2 = new DN( "cn=John,ou=Marketing,ou=East" );
         name.add( 2, "cn=John" );
         assertEquals( name2, name );
 
-        Name name0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
+        DN name0 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
         name.add( 3, "cn=HomeDir" );
         assertEquals( name0, name );
 
-        Name name5 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East,o=LL " + "Bean Inc." );
+        DN name5 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East,o=LL " + "Bean Inc." );
         name.add( 0, "o=LL Bean Inc." );
         assertEquals( name5, name );
 
-        Name name6 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East,c=US,o=LL " + "Bean Inc." );
+        DN name6 = new DN( "cn=HomeDir,cn=John,ou=Marketing,ou=East,c=US,o=LL " + "Bean Inc." );
         name.add( 1, "c=US" );
         assertEquals( name6, name );
 
-        Name name7 = new DN( "cn=HomeDir,cn=John,ou=Advertising,ou=Marketing," + "ou=East,c=US,o=LL " + "Bean Inc." );
+        DN name7 = new DN( "cn=HomeDir,cn=John,ou=Advertising,ou=Marketing," + "ou=East,c=US,o=LL " + "Bean Inc." );
         name.add( 4, "ou=Advertising" );
         assertEquals( name7, name );
     }
@@ -2356,16 +2334,16 @@ public class DNTest
     @Test
     public void testRemove() throws Exception
     {
-        Name name = new DN();
+        DN name = new DN();
         assertEquals( new DN( "" ), name );
 
-        Name name3 = new DN( "ou=Marketing" );
+        DN name3 = new DN( "ou=Marketing" );
         name.add( "ou=East" );
         name.add( 1, "ou=Marketing" );
         name.remove( 0 );
         assertEquals( name3, name );
 
-        Name name2 = new DN( "cn=HomeDir,ou=Marketing,ou=East" );
+        DN name2 = new DN( "cn=HomeDir,ou=Marketing,ou=East" );
         name.add( 0, "ou=East" );
         name.add( 2, "cn=John" );
         name.add( "cn=HomeDir" );
@@ -2373,11 +2351,11 @@ public class DNTest
         assertEquals( name2, name );
 
         name.remove( 1 );
-        Name name1 = new DN( "cn=HomeDir,ou=East" );
+        DN name1 = new DN( "cn=HomeDir,ou=East" );
         assertEquals( name1, name );
 
         name.remove( 1 );
-        Name name0 = new DN( "ou=East" );
+        DN name0 = new DN( "ou=East" );
         assertEquals( name0, name );
 
         name.remove( 0 );
@@ -2394,7 +2372,7 @@ public class DNTest
     @Test
     public void testToString() throws Exception
     {
-        Name name = new DN();
+        DN name = new DN();
         assertEquals( "", name.toString() );
 
         name.add( "ou=East" );
@@ -2435,7 +2413,7 @@ public class DNTest
             { 'c', 'n', '=', 0x4A, ( byte ) 0xC3, ( byte ) 0xA9, 0x72, ( byte ) 0xC3, ( byte ) 0xB4, 0x6D, 0x65 },
             "UTF-8" );
 
-        Name name = new DN( cn );
+        DN name = new DN( cn );
 
         assertEquals( "cn=J\u00e9r\u00f4me", name.toString() );
     }
@@ -2449,7 +2427,7 @@ public class DNTest
                 ( byte ) 0xC3, ( byte ) 0x9F, ( byte ) 0xC3, ( byte ) 0xA4, ( byte ) 0xC3, ( byte ) 0xB6,
                 ( byte ) 0xC3, ( byte ) 0xBC }, "UTF-8" );
 
-        Name name = new DN( cn );
+        DN name = new DN( cn );
 
         assertEquals( "cn=\u00C4\u00D6\u00DC\u00DF\u00E4\u00F6\u00FC", name.toString() );
     }
@@ -2464,14 +2442,14 @@ public class DNTest
                 ( byte ) 0xC3, ( byte ) 0x9C, ( byte ) 0xC3, ( byte ) 0xBC, ( byte ) 0xC4, ( byte ) 0x9E,
                 ( byte ) 0xC4, ( byte ) 0x9F }, "UTF-8" );
 
-        Name name = new DN( cn );
+        DN name = new DN( cn );
 
         assertEquals( "cn=\u0130\u0131\u015E\u015F\u00D6\u00F6\u00DC\u00FC\u011E\u011F", name.toString() );
     }
 
 
     /**
-     * Class to test for toOid( Name, Map)
+     * Class to test for toOid( DN, Map)
      */
     @Test
     public void testLdapNameToName() throws Exception
@@ -2480,7 +2458,7 @@ public class DNTest
 
         assertTrue( name.getName().equals( "ou= Some   People   ,dc = eXample,dc= cOm" ) );
 
-        Name result = DN.normalize( name, oids );
+        DN result = DN.normalize( name, oids );
 
         assertTrue( ((DN)result).getNormName().equals( "ou=some people,dc=example,dc=com" ) );
     }
@@ -2514,20 +2492,20 @@ public class DNTest
 
 
     /**
-     * Class to test for toOid( Name, Map) with a NULL dn
+     * Class to test for toOid( DN, Map) with a NULL dn
      */
     @Test
     public void testLdapNameToNameEmpty() throws Exception
     {
         DN name = new DN();
 
-        Name result = DN.normalize( name, oids );
+        DN result = DN.normalize( name, oids );
         assertTrue( result.toString().equals( "" ) );
     }
 
 
     /**
-     * Class to test for toOid( Name, Map) with a multiple NameComponent
+     * Class to test for toOid( DN, Map) with a multiple NameComponent
      */
     @Test
     public void testLdapNameToNameMultiNC() throws Exception
@@ -2535,7 +2513,7 @@ public class DNTest
         DN name = new DN(
             "2.5.4.11= Some   People   + 0.9.2342.19200300.100.1.25=  And   Some anImAls,0.9.2342.19200300.100.1.25 = eXample,dc= cOm" );
 
-        Name result = DN.normalize( name, oidOids );
+        DN result = DN.normalize( name, oidOids );
 
         assertEquals(
             ((DN)result).getNormName(),
@@ -2548,7 +2526,7 @@ public class DNTest
 
 
     /**
-     * Class to test for toOid( Name, Map) with a multiple NameComponent
+     * Class to test for toOid( DN, Map) with a multiple NameComponent
      */
     @Test
     public void testLdapNameToNameAliasMultiNC() throws Exception
@@ -2575,12 +2553,12 @@ public class DNTest
     @Test
     public void testLdapNameHashCode() throws Exception
     {
-        Name name1 = DN
+        DN name1 = DN
             .normalize(
                 "2.5.4.11= Some   People   + domainComponent=  And   Some anImAls,DomainComponent = eXample,0.9.2342.19200300.100.1.25= cOm",
                 oids );
 
-        Name name2 = DN
+        DN name2 = DN
             .normalize(
                 "2.5.4.11=some people+domainComponent=and some animals,DomainComponent=example,0.9.2342.19200300.100.1.25=com",
                 oids );
@@ -2593,10 +2571,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testName() throws LdapException
+    public void testName() throws LdapException, InvalidNameException
     {
-        Name jName = new javax.naming.ldap.LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new javax.naming.ldap.LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
         assertEquals( jName.toString(), "cn=four,cn=three,cn=two,cn=one" );
         assertEquals( aName.toString(), "cn=four,cn=three,cn=two,cn=one" );
         assertEquals( jName.toString(), aName.toString() );
@@ -2607,10 +2585,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testGetPrefixName() throws LdapException
+    public void testGetPrefixName() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertEquals( jName.getPrefix( 0 ).toString(), aName.getPrefix( 0 ).toString() );
         assertEquals( jName.getPrefix( 1 ).toString(), aName.getPrefix( 1 ).toString() );
@@ -2624,10 +2602,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testGetSuffix() throws LdapException
+    public void testGetSuffix() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertEquals( jName.getSuffix( 0 ).toString(), aName.getSuffix( 0 ).toString() );
         assertEquals( jName.getSuffix( 1 ).toString(), aName.getSuffix( 1 ).toString() );
@@ -2641,10 +2619,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testAddStringName() throws LdapException
+    public void testAddStringName() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertSame( jName, jName.add( "cn=five" ) );
         assertSame( aName, aName.add( "cn=five" ) );
@@ -2656,10 +2634,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testAddIntString() throws LdapException
+    public void testAddIntString() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertSame( jName, jName.add( 0, "cn=zero" ) );
         assertSame( aName, aName.add( 0, "cn=zero" ) );
@@ -2679,10 +2657,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testAddAllName() throws LdapException
+    public void testAddAllName() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertSame( jName, jName.addAll( new LdapName( "cn=seven,cn=six" ) ) );
         assertSame( aName, aName.addAll( new DN( "cn=seven,cn=six" ) ) );
@@ -2694,10 +2672,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testAddAllIntName() throws LdapException
+    public void testAddAllIntName() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertSame( jName, jName.addAll( 0, new LdapName( "cn=zero,cn=zero.5" ) ) );
         assertSame( aName, aName.addAll( 0, new DN( "cn=zero,cn=zero.5" ) ) );
@@ -2717,10 +2695,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testStartsWithName() throws LdapException
+    public void testStartsWithName() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertEquals( jName.startsWith( new LdapName( "cn=seven,cn=six,cn=five" ) ), aName.startsWith( new DN(
             "cn=seven,cn=six,cn=five" ) ) );
@@ -2733,20 +2711,20 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testEndsWithName() throws LdapException
+    public void testEndsWithName() throws LdapException, InvalidNameException
     {
-        Name name0 = new LdapName( "cn=zero" );
-        Name name10 = new LdapName( "cn=one,cn=zero" );
-        Name name210 = new LdapName( "cn=two,cn=one,cn=zero" );
-        Name name3210 = new LdapName( "cn=three,cn=two,cn=one,cn=zero" );
-        Name name321 =  new LdapName( "cn=three,cn=two,cn=one" );
-        Name name32 =  new LdapName( "cn=three,cn=two" );
-        Name name3 =  new LdapName( "cn=three" );
-        Name name21 =  new LdapName( "cn=two,cn=one" );
-        Name name2 =  new LdapName( "cn=two" );
-        Name name1 =  new LdapName( "cn=one" );
+        LdapName name0 = new LdapName( "cn=zero" );
+        LdapName name10 = new LdapName( "cn=one,cn=zero" );
+        LdapName name210 = new LdapName( "cn=two,cn=one,cn=zero" );
+        LdapName name3210 = new LdapName( "cn=three,cn=two,cn=one,cn=zero" );
+        LdapName name321 =  new LdapName( "cn=three,cn=two,cn=one" );
+        LdapName name32 =  new LdapName( "cn=three,cn=two" );
+        LdapName name3 =  new LdapName( "cn=three" );
+        LdapName name21 =  new LdapName( "cn=two,cn=one" );
+        LdapName name2 =  new LdapName( "cn=two" );
+        LdapName name1 =  new LdapName( "cn=one" );
         
-        // Check with Name
+        // Check with DN
         assertTrue( name0.startsWith( name0 ) );
         assertTrue( name10.startsWith( name0 ) );
         assertTrue( name210.startsWith( name0 ) );
@@ -2776,16 +2754,16 @@ public class DNTest
         assertTrue( name0.endsWith( name0 ) );
         
         // Check with DN
-        Name n0 = new DN( "cn=zero" );
-        Name n10 = new DN( "cn=one,cn=zero" );
-        Name n210 = new DN( "cn=two,cn=one,cn=zero" );
-        Name n3210 = new DN( "cn=three,cn=two,cn=one,cn=zero" );
-        Name n321 =  new DN( "cn=three,cn=two,cn=one" );
-        Name n32 =  new DN( "cn=three,cn=two" );
-        Name n3 =  new DN( "cn=three" );
-        Name n21 =  new DN( "cn=two,cn=one" );
-        Name n2 =  new DN( "cn=two" );
-        Name n1 =  new DN( "cn=one" );
+        DN n0 = new DN( "cn=zero" );
+        DN n10 = new DN( "cn=one,cn=zero" );
+        DN n210 = new DN( "cn=two,cn=one,cn=zero" );
+        DN n3210 = new DN( "cn=three,cn=two,cn=one,cn=zero" );
+        DN n321 =  new DN( "cn=three,cn=two,cn=one" );
+        DN n32 =  new DN( "cn=three,cn=two" );
+        DN n3 =  new DN( "cn=three" );
+        DN n21 =  new DN( "cn=two,cn=one" );
+        DN n2 =  new DN( "cn=two" );
+        DN n1 =  new DN( "cn=one" );
         
         assertTrue( n3210.endsWith( n3 ) );
         assertTrue( n3210.endsWith( n32 ) );
@@ -2801,7 +2779,7 @@ public class DNTest
 
         assertTrue( n0.endsWith( n0 ) );
 
-        // Check with DN/Name now
+        // Check with DN/DN now
         assertTrue( n3210.endsWith( name3 ) );
         assertTrue( n3210.endsWith( name32 ) );
         assertTrue( n3210.endsWith( name321 ) );
@@ -2817,8 +2795,8 @@ public class DNTest
         assertTrue( n0.endsWith( name0 ) );
         
         
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertEquals( jName.endsWith( new LdapName( "cn=seven,cn=six,cn=five" ) ), aName.endsWith( new DN(
             "cn=seven,cn=six,cn=five" ) ) );
@@ -2835,10 +2813,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testRemoveName() throws LdapException
+    public void testRemoveName() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         assertEquals( jName.remove( 0 ).toString(), aName.remove( 0 ).toString() );
         assertEquals( jName.toString(), aName.toString() );
@@ -2852,10 +2830,10 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testGetAllName() throws LdapException
+    public void testGetAllName() throws LdapException, InvalidNameException
     {
-        Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
-        Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
+        LdapName jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
+        DN aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
 
         Enumeration<String> j = jName.getAll();
         Enumeration<String> a = aName.getAll();
@@ -2872,10 +2850,10 @@ public class DNTest
      * @throws LdapException
      */
     @Test
-    public void testDoubleQuoteInNameDIRSERVER_642() throws LdapException
+    public void testDoubleQuoteInNameDIRSERVER_642() throws LdapException, InvalidNameException
     {
-        Name name1 = new DN( "cn=\"Kylie Minogue\",dc=example,dc=com" );
-        Name name2 = new LdapName( "cn=\"Kylie Minogue\",dc=example,dc=com" );
+        DN name1 = new DN( "cn=\"Kylie Minogue\",dc=example,dc=com" );
+        LdapName name2 = new LdapName( "cn=\"Kylie Minogue\",dc=example,dc=com" );
 
         Enumeration<String> j = name1.getAll();
         Enumeration<String> a = name2.getAll();
@@ -3075,7 +3053,7 @@ public class DNTest
 
 
     @Test
-    public void testNameAddAll() throws LdapException
+    public void testNameAddAll() throws LdapException, InvalidNameException
     {
         Properties props = new Properties();
         props.setProperty( "jndi.syntax.direction", "right_to_left" );
@@ -3083,7 +3061,7 @@ public class DNTest
         props.setProperty( "jndi.syntax.ignorecase", "true" );
         props.setProperty( "jndi.syntax.trimblanks", "true" );
 
-        Name name = new CompoundName( "cn=blah,dc=example,dc=com", props );
+        CompoundName name = new CompoundName( "cn=blah,dc=example,dc=com", props );
         DN dn = new DN();
         dn.addAll( 0, name );
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java Tue Mar 16 10:22:36 2010
@@ -20,8 +20,6 @@
 package org.apache.directory.shared.ldap.name;
 
 
-import javax.naming.Name;
-
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -362,7 +360,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameEmpty = parser.parse( "" );
+        DN nameEmpty = parser.parse( "" );
 
         assertNotNull( nameEmpty );
     }
@@ -378,7 +376,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameNull = parser.parse( null );
+        DN nameNull = parser.parse( null );
 
         assertEquals( "Null DN are legal : ", "", nameNull.toString() );
     }
@@ -394,7 +392,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameRFC1779_1 = parser
+        DN nameRFC1779_1 = parser
             .parse( "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US" );
 
         assertEquals( "RFC1779_1 : ",
@@ -415,7 +413,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameRFC2253_1 = parser.parse( "CN=Steve Kille,O=Isode limited,C=GB" );
+        DN nameRFC2253_1 = parser.parse( "CN=Steve Kille,O=Isode limited,C=GB" );
 
         assertEquals( "RFC2253_1 : ", "CN=Steve Kille,O=Isode limited,C=GB", ( ( DN ) nameRFC2253_1 ).getName() );
     }
@@ -431,7 +429,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameRFC2253_2 = parser.parse( "CN = Sales + CN =   J. Smith , O = Widget Inc. , C = US" );
+        DN nameRFC2253_2 = parser.parse( "CN = Sales + CN =   J. Smith , O = Widget Inc. , C = US" );
 
         assertEquals( "RFC2253_2 : ", "CN = Sales + CN =   J. Smith , O = Widget Inc. , C = US",
             ( ( DN ) nameRFC2253_2 ).getName() );
@@ -449,7 +447,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameRFC2253_3 = parser.parse( "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB" );
+        DN nameRFC2253_3 = parser.parse( "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB" );
 
         assertEquals( "RFC2253_3 : ", "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB", ( ( DN ) nameRFC2253_3 )
             .getName() );
@@ -467,7 +465,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameRFC2253_4 = parser.parse( "CN=Before\\0DAfter,O=Test,C=GB" );
+        DN nameRFC2253_4 = parser.parse( "CN=Before\\0DAfter,O=Test,C=GB" );
         assertEquals( "RFC2253_4 : ", "CN=Before\\0DAfter,O=Test,C=GB", ( ( DN ) nameRFC2253_4 ).getName() );
     }
 
@@ -482,7 +480,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameRFC2253_5 = parser.parse( "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB" );
+        DN nameRFC2253_5 = parser.parse( "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB" );
 
         assertEquals( "RFC2253_5 : ", "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB", ( ( DN ) nameRFC2253_5 )
             .getName() );
@@ -499,7 +497,7 @@ public class DnParserTest
     {
         DnParser parser = DnParser.getNameParser();
 
-        Name nameRFC2253_6 = parser.parse( "SN=Lu\\C4\\8Di\\C4\\87" );
+        DN nameRFC2253_6 = parser.parse( "SN=Lu\\C4\\8Di\\C4\\87" );
 
         assertEquals( "RFC2253_6 : ", "SN=Lu\\C4\\8Di\\C4\\87", ( ( DN ) nameRFC2253_6 ).getName() );
     }
@@ -551,7 +549,7 @@ public class DnParserTest
         // '\' should be escaped as stated in RFC 2253
         String path = "windowsFilePath=C:\\\\cygwin";
         DnParser parser = DnParser.getNameParser();
-        Name result = parser.parse( path );
+        DN result = parser.parse( path );
         assertEquals( path, ( ( DN ) result ).getName() );
         assertEquals( "windowsfilepath=C:\\\\cygwin", ((DN)result).getNormName() );
     }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java?rev=923667&r1=923666&r2=923667&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java Tue Mar 16 10:22:36 2010
@@ -20,8 +20,6 @@
 package org.apache.directory.shared.ldap.name;
 
 
-import javax.naming.Name;
-
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
@@ -485,7 +483,7 @@ public class FastDnParserTest
     {
         FastDnParser parser = FastDnParser.getNameParser();
 
-        Name nameEmpty = parser.parse( "" );
+        DN nameEmpty = parser.parse( "" );
 
         assertNotNull( nameEmpty );
     }
@@ -502,7 +500,7 @@ public class FastDnParserTest
     {
         FastDnParser parser = FastDnParser.getNameParser();
 
-        Name nameNull = parser.parse( null );
+        DN nameNull = parser.parse( null );
 
         assertEquals( "Null DN are legal : ", "", nameNull.toString() );
     }
@@ -519,7 +517,7 @@ public class FastDnParserTest
     {
         FastDnParser parser = FastDnParser.getNameParser();
 
-        Name nameRFC1779_1 = parser
+        DN nameRFC1779_1 = parser
             .parse( "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US" );
 
         assertEquals( "RFC1779_1 : ",
@@ -541,7 +539,7 @@ public class FastDnParserTest
     {
         FastDnParser parser = FastDnParser.getNameParser();
 
-        Name nameRFC2253_1 = parser.parse( "CN=Steve Kille,O=Isode limited,C=GB" );
+        DN nameRFC2253_1 = parser.parse( "CN=Steve Kille,O=Isode limited,C=GB" );
 
         assertEquals( "RFC2253_1 : ", "CN=Steve Kille,O=Isode limited,C=GB", ( ( DN ) nameRFC2253_1 ).getName() );
     }



Mime
View raw message