directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414018 [6/8] - in /directory/branches/apacheds/1.0: ./ core-plugin/ core-shared/ core-unit/ core-unit/src/main/java/org/apache/directory/server/core/unit/ core-unit/src/test/java/org/apache/directory/server/core/ core-unit/src/test/java/or...
Date Wed, 14 Jun 2006 01:36:47 GMT
Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java Tue Jun 13 18:36:40 2006
@@ -27,7 +27,6 @@
 import java.util.Map;
 
 import javax.naming.Context;
-import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -38,6 +37,7 @@
 import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.ServerUtils;
 import org.apache.directory.server.core.configuration.DirectoryPartitionConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.enumeration.ReferralHandlingEnumeration;
@@ -52,7 +52,8 @@
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
 import org.apache.directory.server.core.schema.AttributeTypeRegistry;
-import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
+import org.apache.directory.server.core.schema.OidRegistry;
+
 import org.apache.directory.shared.ldap.codec.util.LdapURL;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
@@ -62,8 +63,8 @@
 import org.apache.directory.shared.ldap.filter.LeafNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.name.DnParser;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -92,9 +93,11 @@
 
     private ReferralLut lut = new ReferralLut();
     private DirectoryPartitionNexus nexus;
-    private DnParser parser;
     private Hashtable env;
+    private AttributeTypeRegistry attrRegistry;
+    private OidRegistry oidRegistry;
 
+    
     static
     {
         /*
@@ -158,20 +161,20 @@
     public void init( DirectoryServiceConfiguration dsConfig, InterceptorConfiguration cfg ) throws NamingException
     {
         nexus = dsConfig.getPartitionNexus();
-        AttributeTypeRegistry atr = dsConfig.getGlobalRegistries().getAttributeTypeRegistry();
-        parser = new DnParser( new ConcreteNameComponentNormalizer( atr ) );
+        attrRegistry = dsConfig.getGlobalRegistries().getAttributeTypeRegistry();
+        oidRegistry = dsConfig.getGlobalRegistries().getOidRegistry();
         env = dsConfig.getEnvironment();
 
-        Iterator suffixes = nexus.listSuffixes( true );
+        Iterator suffixes = nexus.listSuffixes();
         while ( suffixes.hasNext() )
         {
-            Name suffix = new LdapName( ( String ) suffixes.next() );
+            LdapDN suffix = new LdapDN( ( String ) suffixes.next() );
             addReferrals( nexus.search( suffix, env, getReferralFilter(), getControls() ), suffix );
         }
     }
 
 
-    public void doReferralException( Name farthest, Name targetUpdn, Attribute refs ) throws NamingException
+    public void doReferralException( LdapDN farthest, LdapDN targetUpdn, Attribute refs ) throws NamingException
     {
         // handle referral here
         List list = new ArrayList( refs.size() );
@@ -197,7 +200,8 @@
                 log.error( "Bad URL (" + val + ") for ref in " + farthest + ".  Reference will be ignored." );
             }
 
-            Name urlDn = parser.parse( ldapUrl.getDn().toString() );
+            LdapDN urlDn = new LdapDN( ldapUrl.getDn().toNormName() );
+            urlDn.normalize();
             if ( urlDn.equals( farthest ) )
             {
                 // according to the protocol there is no need for the dn since it is the same as this request
@@ -220,7 +224,7 @@
              * name past the farthest referral DN which the target name extends.
              */
             int diff = targetUpdn.size() - farthest.size();
-            Name extra = new LdapName();
+            LdapDN extra = new LdapDN();
             for ( int jj = 0; jj < diff; jj++ )
             {
                 extra.add( targetUpdn.get( farthest.size() + jj ) );
@@ -236,7 +240,7 @@
                 buf.append( ldapUrl.getPort() );
             }
             buf.append( "/" );
-            buf.append( urlDn );
+            buf.append( urlDn.toUpName() );
             list.add( buf.toString() );
         }
         LdapReferralException lre = new LdapReferralException( list );
@@ -244,7 +248,7 @@
     }
 
 
-    public void add( NextInterceptor next, String upName, Name normName, Attributes entry ) throws NamingException
+    public void add(NextInterceptor next, LdapDN normName, Attributes entry) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -253,7 +257,7 @@
         // handle a normal add without following referrals
         if ( refval == null || refval.equals( IGNORE ) )
         {
-            next.add( upName, normName, entry );
+            next.add(normName, entry );
             if ( isReferral( entry ) )
             {
                 lut.referralAdded( normName );
@@ -263,10 +267,10 @@
 
         if ( refval.equals( THROW ) )
         {
-            Name farthest = lut.getFarthestReferralAncestor( normName );
+            LdapDN farthest = lut.getFarthestReferralAncestor( normName );
             if ( farthest == null )
             {
-                next.add( upName, normName, entry );
+                next.add(normName, entry );
                 if ( isReferral( entry ) )
                 {
                     lut.referralAdded( normName );
@@ -275,8 +279,9 @@
             }
 
             Attributes referral = invocation.getProxy().lookup( farthest, DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
-            Attribute refs = referral.get( REF_ATTR );
-            doReferralException( farthest, new LdapName( upName ), refs );
+            AttributeType refsType = attrRegistry.lookup( oidRegistry.getOid( REF_ATTR ) );
+            Attribute refs = ServerUtils.getAttribute( refsType, referral );
+            doReferralException( farthest, new LdapDN( normName.toUpName() ), refs );
         }
         else if ( refval.equals( FOLLOW ) )
         {
@@ -290,7 +295,7 @@
     }
 
 
-    public boolean compare( NextInterceptor next, Name normName, String oid, Object value ) throws NamingException
+    public boolean compare( NextInterceptor next, LdapDN normName, String oid, Object value ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -304,7 +309,7 @@
 
         if ( refval.equals( THROW ) )
         {
-            Name farthest = lut.getFarthestReferralAncestor( normName );
+            LdapDN farthest = lut.getFarthestReferralAncestor( normName );
             if ( farthest == null )
             {
                 return next.compare( normName, oid, value );
@@ -312,7 +317,7 @@
 
             Attributes referral = invocation.getProxy().lookup( farthest, DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
             Attribute refs = referral.get( REF_ATTR );
-            doReferralException( farthest, normName, refs );
+            doReferralException( farthest, new LdapDN( normName.toUpName() ), refs );
 
             // we really can't get here since doReferralException will throw an exception
             return false;
@@ -329,7 +334,7 @@
     }
 
 
-    public void delete( NextInterceptor next, Name normName ) throws NamingException
+    public void delete( NextInterceptor next, LdapDN normName ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -348,7 +353,7 @@
 
         if ( refval.equals( THROW ) )
         {
-            Name farthest = lut.getFarthestReferralAncestor( normName );
+            LdapDN farthest = lut.getFarthestReferralAncestor( normName );
             if ( farthest == null )
             {
                 next.delete( normName );
@@ -361,7 +366,7 @@
 
             Attributes referral = invocation.getProxy().lookup( farthest, DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
             Attribute refs = referral.get( REF_ATTR );
-            doReferralException( farthest, normName, refs );
+            doReferralException( farthest, new LdapDN( normName.toUpName() ), refs );
         }
         else if ( refval.equals( FOLLOW ) )
         {
@@ -390,12 +395,12 @@
      * -----------------------------------------------------------------------
      */
 
-    public void move( NextInterceptor next, Name oldName, Name newParent ) throws NamingException
+    public void move( NextInterceptor next, LdapDN oldName, LdapDN newParent ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
-        Name newName = ( Name ) newParent.clone();
+        LdapDN newName = ( LdapDN ) newParent.clone();
         newName.add( oldName.get( oldName.size() - 1 ) );
 
         // handle a normal modify without following referrals
@@ -411,8 +416,8 @@
 
         if ( refval.equals( THROW ) )
         {
-            Name farthestSrc = lut.getFarthestReferralAncestor( oldName );
-            Name farthestDst = lut.getFarthestReferralAncestor( newName ); // note will not return newName so safe
+            LdapDN farthestSrc = lut.getFarthestReferralAncestor( oldName );
+            LdapDN farthestDst = lut.getFarthestReferralAncestor( newName ); // note will not return newName so safe
             if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
             {
                 next.move( oldName, newParent );
@@ -427,7 +432,7 @@
                 Attributes referral = invocation.getProxy().lookup( farthestSrc,
                     DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
                 Attribute refs = referral.get( REF_ATTR );
-                doReferralException( farthestSrc, oldName, refs );
+                doReferralException( farthestSrc, new LdapDN( oldName.toUpName() ), refs );
             }
             else if ( farthestDst != null )
             {
@@ -456,13 +461,13 @@
     }
 
 
-    public void move( NextInterceptor next, Name oldName, Name newParent, String newRdn, boolean deleteOldRdn )
+    public void move( NextInterceptor next, LdapDN oldName, LdapDN newParent, String newRdn, boolean deleteOldRdn )
         throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
-        Name newName = ( Name ) newParent.clone();
+        LdapDN newName = ( LdapDN ) newParent.clone();
         newName.add( newRdn );
 
         // handle a normal modify without following referrals
@@ -478,8 +483,8 @@
 
         if ( refval.equals( THROW ) )
         {
-            Name farthestSrc = lut.getFarthestReferralAncestor( oldName );
-            Name farthestDst = lut.getFarthestReferralAncestor( newName ); // safe to use - does not return newName
+            LdapDN farthestSrc = lut.getFarthestReferralAncestor( oldName );
+            LdapDN farthestDst = lut.getFarthestReferralAncestor( newName ); // safe to use - does not return newName
             if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
             {
                 next.move( oldName, newParent, newRdn, deleteOldRdn );
@@ -494,7 +499,7 @@
                 Attributes referral = invocation.getProxy().lookup( farthestSrc,
                     DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
                 Attribute refs = referral.get( REF_ATTR );
-                doReferralException( farthestSrc, oldName, refs );
+                doReferralException( farthestSrc, new LdapDN( oldName.toUpName() ), refs );
             }
             else if ( farthestDst != null )
             {
@@ -523,15 +528,18 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, Name oldName, String newRdn, boolean deleteOldRdn )
+    public void modifyRn( NextInterceptor next, LdapDN oldName, String newRdn, boolean deleteOldRdn )
         throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
-        Name newName = ( Name ) oldName.clone();
+        LdapDN newName = ( LdapDN ) oldName.clone();
         newName.remove( oldName.size() - 1 );
-        newName.add( parser.parse( newRdn ).toString() );
+
+        LdapDN newRdnName = new LdapDN( newRdn );
+        newRdnName.normalize();
+        newName.add( newRdnName.toNormName() );
 
         // handle a normal modify without following referrals
         if ( refval == null || refval.equals( IGNORE ) )
@@ -546,8 +554,8 @@
 
         if ( refval.equals( THROW ) )
         {
-            Name farthestSrc = lut.getFarthestReferralAncestor( oldName );
-            Name farthestDst = lut.getFarthestReferralAncestor( newName );
+            LdapDN farthestSrc = lut.getFarthestReferralAncestor( oldName );
+            LdapDN farthestDst = lut.getFarthestReferralAncestor( newName );
             if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
             {
                 next.modifyRn( oldName, newRdn, deleteOldRdn );
@@ -562,7 +570,7 @@
                 Attributes referral = invocation.getProxy().lookup( farthestSrc,
                     DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
                 Attribute refs = referral.get( REF_ATTR );
-                doReferralException( farthestSrc, oldName, refs );
+                doReferralException( farthestSrc, new LdapDN( oldName.toUpName() ), refs );
             }
             else if ( farthestDst != null )
             {
@@ -591,7 +599,7 @@
     }
 
 
-    private void checkModify( Name name, int modOp, Attributes mods ) throws NamingException
+    private void checkModify( LdapDN name, int modOp, Attributes mods ) throws NamingException
     {
         // -------------------------------------------------------------------
         // Check and update lut if we change the objectClass 
@@ -649,7 +657,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, int modOp, Attributes mods ) throws NamingException
+    public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -665,7 +673,7 @@
 
         if ( refval.equals( THROW ) )
         {
-            Name farthest = lut.getFarthestReferralAncestor( name );
+            LdapDN farthest = lut.getFarthestReferralAncestor( name );
             if ( farthest == null )
             {
                 next.modify( name, modOp, mods );
@@ -675,7 +683,7 @@
 
             Attributes referral = invocation.getProxy().lookup( farthest, DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
             Attribute refs = referral.get( REF_ATTR );
-            doReferralException( farthest, name, refs );
+            doReferralException( farthest, new LdapDN( name.toUpName() ), refs );
         }
         else if ( refval.equals( FOLLOW ) )
         {
@@ -689,7 +697,7 @@
     }
 
 
-    private void checkModify( Name name, ModificationItem[] mods ) throws NamingException
+    private void checkModify( LdapDN name, ModificationItem[] mods ) throws NamingException
     {
         boolean isTargetReferral = lut.isReferral( name );
 
@@ -753,7 +761,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, ModificationItem[] mods ) throws NamingException
+    public void modify( NextInterceptor next, LdapDN name, ModificationItem[] mods ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -769,7 +777,7 @@
 
         if ( refval.equals( THROW ) )
         {
-            Name farthest = lut.getFarthestReferralAncestor( name );
+            LdapDN farthest = lut.getFarthestReferralAncestor( name );
             if ( farthest == null )
             {
                 next.modify( name, mods );
@@ -779,7 +787,7 @@
 
             Attributes referral = invocation.getProxy().lookup( farthest, DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
             Attribute refs = referral.get( REF_ATTR );
-            doReferralException( farthest, name, refs );
+            doReferralException( farthest, new LdapDN( name.toUpName() ), refs );
         }
         else if ( refval.equals( FOLLOW ) )
         {
@@ -814,7 +822,7 @@
 
         // add referrals immediately after adding the new partition
         DirectoryPartition partition = cfg.getContextPartition();
-        Name suffix = partition.getSuffix( true );
+        LdapDN suffix = partition.getSuffix();
         Invocation invocation = InvocationStack.getInstance().peek();
         NamingEnumeration list = invocation.getProxy().search( suffix, env, getReferralFilter(), getControls(),
             SEARCH_BYPASS );
@@ -822,7 +830,7 @@
     }
 
 
-    public void removeContextPartition( NextInterceptor next, Name suffix ) throws NamingException
+    public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
     {
         // remove referrals immediately before removing the partition
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -834,45 +842,52 @@
     }
 
 
-    private void addReferrals( NamingEnumeration referrals, Name base ) throws NamingException
+    private void addReferrals( NamingEnumeration referrals, LdapDN base ) throws NamingException
     {
         while ( referrals.hasMore() )
         {
             SearchResult r = ( SearchResult ) referrals.next();
-            Name referral = null;
+            LdapDN referral = null;
+            LdapDN result = new LdapDN( r.getName() );
+            //result = LdapDN.normalize( result, registry.getNormalizerMapping() );
+            result.normalize();
+            
             if ( r.isRelative() )
             {
-                referral = ( Name ) base.clone();
-                referral.addAll( parser.parse( r.getName() ) );
+                referral = ( LdapDN ) base.clone();
+                referral.addAll( result );
             }
             else
             {
-                referral = parser.parse( r.getName() );
+                referral = result;
             }
         }
     }
 
 
-    private void deleteReferrals( NamingEnumeration referrals, Name base ) throws NamingException
+    private void deleteReferrals( NamingEnumeration referrals, LdapDN base ) throws NamingException
     {
         while ( referrals.hasMore() )
         {
             SearchResult r = ( SearchResult ) referrals.next();
-            Name referral = null;
+            LdapDN referral = null;
+            LdapDN result = new LdapDN( r.getName() );
+            result.normalize();
+
             if ( r.isRelative() )
             {
-                referral = ( Name ) base.clone();
-                referral.addAll( parser.parse( r.getName() ) );
+                referral = ( LdapDN ) base.clone();
+                referral.addAll( result );
             }
             else
             {
-                referral = parser.parse( r.getName() );
+                referral = result;
             }
         }
     }
 
 
-    public NamingEnumeration search( NextInterceptor next, Name base, Map env, ExprNode filter, SearchControls controls )
+    public NamingEnumeration search( NextInterceptor next, LdapDN base, Map env, ExprNode filter, SearchControls controls )
         throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -899,7 +914,7 @@
                 doReferralExceptionOnSearchBase( base, refs, controls.getSearchScope() );
             }
 
-            Name farthest = lut.getFarthestReferralAncestor( base );
+            LdapDN farthest = lut.getFarthestReferralAncestor( base );
             if ( farthest == null )
             {
                 return next.search( base, env, filter, controls );
@@ -907,7 +922,7 @@
 
             Attributes referral = invocation.getProxy().lookup( farthest, DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
             Attribute refs = referral.get( REF_ATTR );
-            doReferralExceptionOnSearchBase( farthest, base, refs, controls.getSearchScope() );
+            doReferralExceptionOnSearchBase( farthest, new LdapDN( base.toUpName() ), refs, controls.getSearchScope() );
             throw new IllegalStateException( "Should never get here: shutting up compiler" );
         }
         if ( refval.equals( THROW ) )
@@ -919,17 +934,17 @@
                 doReferralExceptionOnSearchBase( base, refs, controls.getSearchScope() );
             }
 
-            Name farthest = lut.getFarthestReferralAncestor( base );
+            LdapDN farthest = lut.getFarthestReferralAncestor( base );
             if ( farthest == null )
             {
                 SearchResultFilteringEnumeration srfe = ( SearchResultFilteringEnumeration ) next.search( base, env,
                     filter, controls );
-                return new ReferralHandlingEnumeration( srfe, lut, parser, nexus, controls.getSearchScope(), true );
+                return new ReferralHandlingEnumeration( srfe, lut, attrRegistry, nexus, controls.getSearchScope(), true );
             }
 
             Attributes referral = invocation.getProxy().lookup( farthest, DirectoryPartitionNexusProxy.LOOKUP_BYPASS );
             Attribute refs = referral.get( REF_ATTR );
-            doReferralExceptionOnSearchBase( farthest, base, refs, controls.getSearchScope() );
+            doReferralExceptionOnSearchBase( farthest, new LdapDN( base.toUpName() ), refs, controls.getSearchScope() );
             throw new IllegalStateException( "Should never get here: shutting up compiler" );
         }
         else if ( refval.equals( FOLLOW ) )
@@ -953,7 +968,7 @@
     }
 
 
-    public void doReferralExceptionOnSearchBase( Name base, Attribute refs, int scope ) throws NamingException
+    public void doReferralExceptionOnSearchBase( LdapDN base, Attribute refs, int scope ) throws NamingException
     {
         // handle referral here
         List list = new ArrayList( refs.size() );
@@ -1013,7 +1028,7 @@
     }
 
 
-    public void doReferralExceptionOnSearchBase( Name farthest, Name targetUpdn, Attribute refs, int scope )
+    public void doReferralExceptionOnSearchBase( LdapDN farthest, LdapDN targetUpdn, Attribute refs, int scope )
         throws NamingException
     {
         // handle referral here
@@ -1040,9 +1055,10 @@
                 log.error( "Bad URL (" + val + ") for ref in " + farthest + ".  Reference will be ignored." );
             }
 
-            Name urlDn = parser.parse( ldapUrl.getDn().toString() );
+            LdapDN urlDn = new LdapDN( ldapUrl.getDn().toNormName() );
+            urlDn.normalize();
             int diff = targetUpdn.size() - farthest.size();
-            Name extra = new LdapName();
+            LdapDN extra = new LdapDN();
             for ( int jj = 0; jj < diff; jj++ )
             {
                 extra.add( targetUpdn.get( farthest.size() + jj ) );
@@ -1058,7 +1074,7 @@
                 buf.append( ldapUrl.getPort() );
             }
             buf.append( "/" );
-            buf.append( urlDn );
+            buf.append( urlDn.toUpName() );
             buf.append( "??" );
 
             switch ( scope )
@@ -1089,7 +1105,10 @@
             return true;
         }
 
-        if ( lut.isReferral( parser.parse( name ) ) )
+        LdapDN dn = new LdapDN( name );
+        dn.normalize();
+
+        if ( lut.isReferral( dn ) )
         {
             return true;
         }

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeRegistry.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeRegistry.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeRegistry.java Tue Jun 13 18:36:40 2006
@@ -18,6 +18,7 @@
 
 
 import java.util.Iterator;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -80,4 +81,11 @@
      * @return an iterator over all AttributeTypes in registry
      */
     Iterator list();
+    
+    
+    /**
+     * Gets an oid/name to normalizer mapping used to normalize distinguished 
+     * names.
+     */
+    Map getNormalizerMapping() throws NamingException; 
 }

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java Tue Jun 13 18:36:40 2006
@@ -35,7 +35,9 @@
 public class ConcreteNameComponentNormalizer implements NameComponentNormalizer
 {
     /** the at registry used to dynamically resolve Normalizers */
-    private final AttributeTypeRegistry registry;
+    private final AttributeTypeRegistry attributeRegistry;
+    /** the oid registry used to dynamically resolve aliases to OIDs */
+    private final OidRegistry oidRegistry;
 
 
     /**
@@ -45,9 +47,10 @@
      *
      * @param registry the at registry used to dynamically resolve Normalizers
      */
-    public ConcreteNameComponentNormalizer(AttributeTypeRegistry registry)
+    public ConcreteNameComponentNormalizer( AttributeTypeRegistry registry, OidRegistry oidRegistry )
     {
-        this.registry = registry;
+        this.attributeRegistry = registry;
+        this.oidRegistry = oidRegistry;
     }
 
 
@@ -100,7 +103,7 @@
      */
     private Normalizer lookup( String id ) throws NamingException
     {
-        AttributeType type = registry.lookup( id );
+        AttributeType type = attributeRegistry.lookup( id );
         return type.getEquality().getNormalizer();
     }
 
@@ -110,6 +113,12 @@
      */
     public boolean isDefined( String id )
     {
-        return registry.hasAttributeType( id );
+        return attributeRegistry.hasAttributeType( id );
+    }
+
+
+    public String normalizeName( String attributeName ) throws NamingException
+    {
+        return oidRegistry.getOid( attributeName );
     }
 }

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/GlobalAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/GlobalAttributeTypeRegistry.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/GlobalAttributeTypeRegistry.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/GlobalAttributeTypeRegistry.java Tue Jun 13 18:36:40 2006
@@ -17,6 +17,7 @@
 package org.apache.directory.server.core.schema;
 
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -25,6 +26,8 @@
 
 import org.apache.directory.server.core.schema.bootstrap.BootstrapAttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.JoinIterator;
 
 
@@ -46,6 +49,8 @@
     private AttributeTypeRegistryMonitor monitor;
     /** the underlying bootstrap registry to delegate on misses to */
     private BootstrapAttributeTypeRegistry bootstrap;
+    /** cached normalizer mapping */
+    private transient Map mapping;
 
 
     // ------------------------------------------------------------------------
@@ -113,6 +118,24 @@
         oidToSchema.put( attributeType.getOid(), schema );
         byOid.put( attributeType.getOid(), attributeType );
         monitor.registered( attributeType );
+        
+        // update the cached normalizer mapping
+        if ( mapping == null )
+        {
+            Map bootstrapMapping = bootstrap.getNormalizerMapping();
+            mapping = new HashMap( bootstrapMapping.size() );
+            mapping.putAll( bootstrapMapping );
+        }
+        
+        Normalizer normalizer = attributeType.getEquality().getNormalizer();
+        OidNormalizer oidNormalizer = new OidNormalizer( attributeType.getOid(), normalizer );
+        mapping.put( attributeType.getOid(), oidNormalizer );
+        String[] aliases = attributeType.getNames();
+        for ( int jj = 0; jj < aliases.length; jj++ )
+        {
+            mapping.put( aliases[jj], oidNormalizer );
+            mapping.put( aliases[jj].toLowerCase(), oidNormalizer );
+        }
     }
 
 
@@ -179,5 +202,29 @@
     {
         return new JoinIterator( new Iterator[]
             { byOid.values().iterator(), bootstrap.list() } );
+    }
+    
+    
+    public Map getNormalizerMapping() throws NamingException
+    {
+        if ( mapping == null )
+        {
+            Map bootstrapMapping = bootstrap.getNormalizerMapping();
+            mapping = new HashMap( ( byOid.size() << 1 ) + bootstrapMapping.size() );
+            mapping.putAll( bootstrapMapping );
+            for ( Iterator ii = byOid.values().iterator(); ii.hasNext(); /**/ )
+            {
+                AttributeType type = ( AttributeType ) ii.next();
+                OidNormalizer oidNormalizer = new OidNormalizer( type.getOid(), type.getEquality().getNormalizer() );
+                mapping.put( type.getOid(), oidNormalizer );
+                String[] aliases = type.getNames();
+                for ( int jj = 0; jj < aliases.length; jj++ )
+                {
+                    mapping.put( aliases[jj], oidNormalizer );
+                    mapping.put( aliases[jj].toLowerCase(), oidNormalizer );
+                }
+            }
+        }
+        return Collections.unmodifiableMap( mapping );
     }
 }

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java Tue Jun 13 18:36:40 2006
@@ -477,7 +477,8 @@
      * @param attribute the attribute being modified
      * @throws NamingException if the modify operation is removing an Rdn attribute
      */
-    public static void preventRdnChangeOnModifyRemove( Name name, int mod, Attribute attribute ) throws NamingException
+    public static void preventRdnChangeOnModifyRemove( Name name, int mod, Attribute attribute, 
+        OidRegistry oidRegistry ) throws NamingException
     {
         if ( mod != DirContext.REMOVE_ATTRIBUTE )
         {
@@ -487,7 +488,7 @@
         Set rdnAttributes = getRdnAttributes( name );
         String id = attribute.getID();
 
-        if ( !rdnAttributes.contains( id ) )
+        if ( !rdnAttributes.contains( oidRegistry.getOid( id ) ) )
         {
             return;
         }

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Tue Jun 13 18:36:40 2006
@@ -24,7 +24,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.*;
@@ -49,7 +48,7 @@
 import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.DITContentRule;
 import org.apache.directory.shared.ldap.schema.DITStructureRule;
@@ -135,7 +134,7 @@
 
         // stuff for dealing with subentries (garbage for now)
         String subschemaSubentry = ( String ) nexus.getRootDSE().get( "subschemaSubentry" ).get();
-        subschemaSubentryDn = new LdapName( subschemaSubentry ).toString().toLowerCase();
+        subschemaSubentryDn = new LdapDN( subschemaSubentry ).toString().toLowerCase();
     }
 
 
@@ -153,7 +152,7 @@
     }
 
 
-    public NamingEnumeration list( NextInterceptor nextInterceptor, Name base ) throws NamingException
+    public NamingEnumeration list( NextInterceptor nextInterceptor, LdapDN base ) throws NamingException
     {
         NamingEnumeration e = nextInterceptor.list( base );
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -161,7 +160,7 @@
     }
 
 
-    public NamingEnumeration search( NextInterceptor nextInterceptor, Name base, Map env, ExprNode filter,
+    public NamingEnumeration search( NextInterceptor nextInterceptor, LdapDN base, Map env, ExprNode filter,
         SearchControls searchCtls ) throws NamingException
     {
         // check to make sure the DN searched for is a subentry
@@ -394,7 +393,7 @@
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, Name name ) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
         Attributes result = nextInterceptor.lookup( name );
         filterBinaryAttributes( result );
@@ -403,7 +402,7 @@
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, Name name, String[] attrIds ) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
     {
         Attributes result = nextInterceptor.lookup( name, attrIds );
         if ( result == null )
@@ -573,7 +572,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, int modOp, Attributes mods ) throws NamingException
+    public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
     {
         Attributes entry = nexus.lookup( name );
         Attribute objectClass = getResultantObjectClasses( modOp, mods.get( "objectClass" ), entry.get( "objectClass" ) );
@@ -669,7 +668,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, ModificationItem[] mods ) throws NamingException
+    public void modify( NextInterceptor next, LdapDN name, ModificationItem[] mods ) throws NamingException
     {
         Attributes entry = nexus.lookup( name );
         Set modset = new HashSet();
@@ -733,7 +732,8 @@
                 {
                     throw new LdapSchemaViolationException( ResultCodeEnum.OBJECTCLASSVIOLATION );
                 }
-                SchemaChecker.preventRdnChangeOnModifyRemove( name, modOp, change );
+                SchemaChecker.preventRdnChangeOnModifyRemove( name, modOp, change, 
+                    this.globalRegistries.getOidRegistry() ); 
                 SchemaChecker
                     .preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, modOp, change, objectClass );
             }
@@ -907,7 +907,7 @@
     /**
      * Check that all the attributes exist in the schema for this entry.
      */
-    public void add( NextInterceptor next, String upName, Name normName, Attributes attrs ) throws NamingException
+    public void add(NextInterceptor next, LdapDN normName, Attributes attrs) throws NamingException
     {
         AttributeTypeRegistry atRegistry = this.globalRegistries.getAttributeTypeRegistry();
         NamingEnumeration attrEnum = attrs.getIDs();
@@ -921,6 +921,6 @@
         }
 
         alterObjectClasses( attrs.get( "objectClass" ), this.globalRegistries.getObjectClassRegistry() );
-        next.add( upName, normName, attrs );
+        next.add(normName, attrs );
     }
 }

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java Tue Jun 13 18:36:40 2006
@@ -17,6 +17,7 @@
 package org.apache.directory.server.core.schema.bootstrap;
 
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -28,6 +29,11 @@
 import org.apache.directory.server.core.schema.AttributeTypeRegistryMonitorAdapter;
 import org.apache.directory.server.core.schema.OidRegistry;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -38,6 +44,8 @@
  */
 public class BootstrapAttributeTypeRegistry implements AttributeTypeRegistry
 {
+    private static final Logger log = LoggerFactory.getLogger( BootstrapAttributeTypeRegistry.class );
+
     /** maps an OID to an AttributeType */
     private final Map byOid;
     /** maps an OID to a schema name*/
@@ -46,7 +54,9 @@
     private final OidRegistry oidRegistry;
     /** monitor notified via callback events */
     private AttributeTypeRegistryMonitor monitor;
-
+    /** cached normalizer mapping */
+    private transient Map mapping;
+    
 
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
@@ -151,5 +161,40 @@
     public Iterator list()
     {
         return byOid.values().iterator();
+    }
+    
+    
+    public Map getNormalizerMapping() throws NamingException
+    {
+        if ( mapping == null )
+        {
+            mapping = new HashMap( byOid.size() << 1 );
+            for ( Iterator ii = byOid.values().iterator(); ii.hasNext(); /**/ )
+            {
+                AttributeType type = ( AttributeType ) ii.next();
+                MatchingRule matchingRule = type.getEquality();
+                OidNormalizer oidNormalizer = null;
+                
+                if ( matchingRule == null )
+                {
+                    log.warn( "Attribute " + type.getName() + " does not have normalizer : using NoopNormalizer" );
+                    oidNormalizer = new OidNormalizer( type.getOid(), new NoOpNormalizer() );
+                }
+                else
+                {
+                    oidNormalizer = new OidNormalizer( type.getOid(), matchingRule.getNormalizer() );
+                }
+                
+                mapping.put( type.getOid(), oidNormalizer );
+                String[] aliases = type.getNames();
+                for ( int jj = 0; jj < aliases.length; jj++ )
+                {
+                    mapping.put( aliases[jj], oidNormalizer );
+                    mapping.put( aliases[jj].toLowerCase(), oidNormalizer );
+                }
+            }
+        }
+        
+        return Collections.unmodifiableMap( mapping );
     }
 }

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/SystemComparatorProducer.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/SystemComparatorProducer.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/SystemComparatorProducer.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/SystemComparatorProducer.java Tue Jun 13 18:36:40 2006
@@ -21,13 +21,12 @@
 
 import javax.naming.NamingException;
 
-import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
+import org.apache.directory.server.core.schema.DnComparator;
 import org.apache.directory.server.core.schema.bootstrap.ProducerTypeEnum;
 import org.apache.directory.shared.ldap.schema.CachingNormalizer;
 import org.apache.directory.shared.ldap.schema.ComparableComparator;
 import org.apache.directory.shared.ldap.schema.DeepTrimNormalizer;
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
-import org.apache.directory.shared.ldap.schema.DnComparator;
 import org.apache.directory.shared.ldap.schema.NormalizingComparator;
 import org.apache.directory.shared.ldap.schema.ObjectIdentifierComparator;
 
@@ -63,7 +62,7 @@
          ( 2.5.13.1 NAME 'distinguishedNameMatch'
          SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
          */
-        comparator = new DnComparator( new ConcreteNameComponentNormalizer( registries.getAttributeTypeRegistry() ) );
+        comparator = new DnComparator( registries.getAttributeTypeRegistry() );
         cb.schemaObjectProduced( this, "2.5.13.1", comparator );
 
         /*

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/SystemNormalizerProducer.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/SystemNormalizerProducer.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/SystemNormalizerProducer.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/SystemNormalizerProducer.java Tue Jun 13 18:36:40 2006
@@ -19,12 +19,11 @@
 
 import javax.naming.NamingException;
 
-import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
+import org.apache.directory.server.core.schema.DnNormalizer;
 import org.apache.directory.server.core.schema.bootstrap.ProducerTypeEnum;
 import org.apache.directory.shared.ldap.schema.CachingNormalizer;
 import org.apache.directory.shared.ldap.schema.DeepTrimNormalizer;
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
-import org.apache.directory.shared.ldap.schema.DnNormalizer;
 import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.ObjectIdentifierNormalizer;
@@ -56,8 +55,7 @@
          ( 2.5.13.1 NAME 'distinguishedNameMatch'
          SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
          */
-        normalizer = new CachingNormalizer( new DnNormalizer( new ConcreteNameComponentNormalizer( registries
-            .getAttributeTypeRegistry() ) ) );
+        normalizer = new CachingNormalizer( new DnNormalizer( registries.getAttributeTypeRegistry() ) );
         cb.schemaObjectProduced( this, "2.5.13.1", normalizer );
 
         /*

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java Tue Jun 13 18:36:40 2006
@@ -18,6 +18,7 @@
 
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.ServerUtils;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
@@ -26,7 +27,9 @@
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
-import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
+import org.apache.directory.server.core.schema.AttributeTypeRegistry;
+import org.apache.directory.server.core.schema.OidRegistry;
+
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
@@ -38,8 +41,9 @@
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.SubentriesControl;
-import org.apache.directory.shared.ldap.name.DnParser;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
 
@@ -94,10 +98,15 @@
     /** the hash mapping the DN of a subentry to its SubtreeSpecification */
     private final Map subtrees = new HashMap();
     private DirectoryServiceConfiguration factoryCfg;
-    private DnParser dnParser;
     private SubtreeSpecificationParser ssParser;
     private SubtreeEvaluator evaluator;
     private DirectoryPartitionNexus nexus;
+    private AttributeTypeRegistry attrRegistry;
+    private OidRegistry oidRegistry;
+    
+    
+    private AttributeType objectClassType;
+    private AttributeType administrativeRoleType;
 
 
     public void init( DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration cfg ) throws NamingException
@@ -105,14 +114,24 @@
         super.init( factoryCfg, cfg );
         this.nexus = factoryCfg.getPartitionNexus();
         this.factoryCfg = factoryCfg;
-        ConcreteNameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( factoryCfg.getGlobalRegistries()
-            .getAttributeTypeRegistry() );
-        ssParser = new SubtreeSpecificationParser( ncn );
-        dnParser = new DnParser( ncn );
+        this.attrRegistry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
+        this.oidRegistry = factoryCfg.getGlobalRegistries().getOidRegistry();
+        
+        // setup various attribute type values
+        objectClassType = attrRegistry.lookup( oidRegistry.getOid( "objectClass" ) );
+        administrativeRoleType = attrRegistry.lookup( oidRegistry.getOid( "administrativeRole" ) );
+        
+        ssParser = new SubtreeSpecificationParser( new NormalizerMappingResolver()
+        {
+            public Map getNormalizerMapping() throws NamingException
+            {
+                return attrRegistry.getNormalizerMapping();
+            }
+        });
         evaluator = new SubtreeEvaluator( factoryCfg.getGlobalRegistries().getOidRegistry() );
 
         // prepare to find all subentries in all namingContexts
-        Iterator suffixes = this.nexus.listSuffixes( true );
+        Iterator suffixes = this.nexus.listSuffixes();
         ExprNode filter = new SimpleNode( "objectclass", "subentry", LeafNode.EQUALITY );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -122,7 +141,9 @@
         // search each namingContext for subentries
         while ( suffixes.hasNext() )
         {
-            Name suffix = dnParser.parse( ( String ) suffixes.next() );
+            LdapDN suffix = new LdapDN( ( String ) suffixes.next() );
+            //suffix = LdapDN.normalize( suffix, registry.getNormalizerMapping() );
+            suffix.normalize();
             NamingEnumeration subentries = nexus.search( suffix, factoryCfg.getEnvironment(), filter, controls );
             while ( subentries.hasMore() )
             {
@@ -142,7 +163,10 @@
                     continue;
                 }
 
-                subtrees.put( dnParser.parse( dn ).toString(), ss );
+                LdapDN dnName = new LdapDN( dn );
+                //dnName = LdapDN.normalize( dnName, registry.getNormalizerMapping() );
+                dnName.normalize();
+                subtrees.put( dnName.toString(), ss );
             }
         }
     }
@@ -152,7 +176,7 @@
     // Methods/Code dealing with Subentry Visibility
     // -----------------------------------------------------------------------
 
-    public NamingEnumeration list( NextInterceptor nextInterceptor, Name base ) throws NamingException
+    public NamingEnumeration list( NextInterceptor nextInterceptor, LdapDN base ) throws NamingException
     {
         NamingEnumeration e = nextInterceptor.list( base );
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -167,7 +191,7 @@
     }
 
 
-    public NamingEnumeration search( NextInterceptor nextInterceptor, Name base, Map env, ExprNode filter,
+    public NamingEnumeration search( NextInterceptor nextInterceptor, LdapDN base, Map env, ExprNode filter,
         SearchControls searchCtls ) throws NamingException
     {
         NamingEnumeration e = nextInterceptor.search( base, env, filter, searchCtls );
@@ -245,10 +269,10 @@
         while ( list.hasNext() )
         {
             String subentryDnStr = ( String ) list.next();
-            Name subentryDn = new LdapName( subentryDnStr );
-            Name apDn = ( Name ) subentryDn.clone();
+            LdapDN subentryDn = new LdapDN( subentryDnStr );
+            LdapDN apDn = ( LdapDN ) subentryDn.clone();
             apDn.remove( apDn.size() - 1 );
-            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDn );
+            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDnStr );
 
             if ( evaluator.evaluate( ss, apDn, dn, objectClasses ) )
             {
@@ -314,14 +338,14 @@
     }
 
 
-    public void add( NextInterceptor next, String upName, Name normName, Attributes entry ) throws NamingException
+    public void add( NextInterceptor next, LdapDN normName, Attributes entry ) throws NamingException
     {
         Attribute objectClasses = entry.get( "objectClass" );
 
         if ( objectClasses.contains( "subentry" ) )
         {
             // get the name of the administrative point and its administrativeRole attributes
-            Name apName = ( Name ) normName.clone();
+            LdapDN apName = ( LdapDN ) normName.clone();
             apName.remove( normName.size() - 1 );
             Attributes ap = nexus.lookup( apName );
             Attribute administrativeRole = ap.get( "administrativeRole" );
@@ -360,12 +384,12 @@
             }
             catch ( Exception e )
             {
-                String msg = "Failed while parsing subtreeSpecification for " + upName;
+                String msg = "Failed while parsing subtreeSpecification for " + normName.toUpName();
                 log.warn( msg );
                 throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALIDATTRIBUTESYNTAX );
             }
             subtrees.put( normName.toString(), ss );
-            next.add( upName, normName, entry );
+            next.add(normName, entry );
 
             /* ----------------------------------------------------------------
              * Find the baseDn for the subentry and use that to search the tree
@@ -375,10 +399,10 @@
              * operational attributes calculated above.
              * ----------------------------------------------------------------
              */
-            Name baseDn = ( Name ) apName.clone();
+            LdapDN baseDn = ( LdapDN ) apName.clone();
             baseDn.addAll( ss.getBase() );
 
-            ExprNode filter = new PresenceNode( "objectclass" );
+            ExprNode filter = new PresenceNode( "2.5.4.0" ); // (objectClass=*)
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -389,7 +413,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) ) )
                 {
@@ -403,10 +428,10 @@
             while ( list.hasNext() )
             {
                 String subentryDnStr = ( String ) list.next();
-                Name subentryDn = new LdapName( subentryDnStr );
-                Name apDn = ( Name ) subentryDn.clone();
+                LdapDN subentryDn = new LdapDN( subentryDnStr );
+                LdapDN apDn = ( LdapDN ) subentryDn.clone();
                 apDn.remove( apDn.size() - 1 );
-                SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDn );
+                SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDn.toNormName() );
 
                 if ( evaluator.evaluate( ss, apDn, normName, objectClasses ) )
                 {
@@ -472,7 +497,7 @@
                 }
             }
 
-            next.add( upName, normName, entry );
+            next.add(normName, entry );
         }
     }
 
@@ -481,15 +506,14 @@
     // Methods dealing subentry deletion
     // -----------------------------------------------------------------------
 
-    public void delete( NextInterceptor next, Name name ) throws NamingException
+    public void delete( NextInterceptor next, LdapDN name ) throws NamingException
     {
         Attributes entry = nexus.lookup( name );
-        Attribute objectClasses = entry.get( "objectClass" );
+        Attribute objectClasses = ServerUtils.getAttribute( objectClassType, entry );
 
         if ( objectClasses.contains( "subentry" ) )
         {
-            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( name.toString() );
-            subtrees.remove( ss );
+            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.remove( name.toNormName() );
             next.delete( name );
 
             /* ----------------------------------------------------------------
@@ -500,12 +524,12 @@
              * attributes we remove from the entry in a modify operation.
              * ----------------------------------------------------------------
              */
-            Name apName = ( Name ) name.clone();
+            LdapDN apName = ( LdapDN ) name.clone();
             apName.remove( name.size() - 1 );
-            Name baseDn = ( Name ) apName.clone();
+            LdapDN baseDn = ( LdapDN ) apName.clone();
             baseDn.addAll( ss.getBase() );
 
-            ExprNode filter = new PresenceNode( "objectclass" );
+            ExprNode filter = new PresenceNode( oidRegistry.getOid( "objectclass" ) );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -516,9 +540,10 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
-                if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) ) )
+                if ( evaluator.evaluate( ss, apName, dn, ServerUtils.getAttribute( objectClassType, candidate ) ) )
                 {
                     nexus.modify( dn, getOperationalModsForRemove( name, candidate ) );
                 }
@@ -544,7 +569,7 @@
      * are, false otherwise
      * @throws NamingException if there are errors while searching the directory
      */
-    private boolean hasAdministrativeDescendant( Name name ) throws NamingException
+    private boolean hasAdministrativeDescendant( LdapDN name ) throws NamingException
     {
         ExprNode filter = new PresenceNode( "administrativeRole" );
         SearchControls controls = new SearchControls();
@@ -583,7 +608,7 @@
         while ( subentries.hasNext() )
         {
             String subentryDn = ( String ) subentries.next();
-            Name apDn = new LdapName( subentryDn );
+            Name apDn = new LdapDN( subentryDn );
             apDn.remove( apDn.size() - 1 );
             SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDn );
             boolean isOldNameSelected = evaluator.evaluate( ss, apDn, oldName, objectClasses );
@@ -634,41 +659,44 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, Name name, String newRn, boolean deleteOldRn ) throws NamingException
+    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
     {
         Attributes entry = nexus.lookup( name );
-        Attribute objectClasses = entry.get( "objectClass" );
+        Attribute objectClasses = ServerUtils.getAttribute( objectClassType, entry );
 
         if ( objectClasses.contains( "subentry" ) )
         {
-            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( name.toString() );
-            Name apName = ( Name ) name.clone();
+            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( name.toNormName() );
+            LdapDN apName = ( LdapDN ) name.clone();
             apName.remove( apName.size() - 1 );
-            Name baseDn = ( Name ) apName.clone();
+            LdapDN baseDn = ( LdapDN ) apName.clone();
             baseDn.addAll( ss.getBase() );
-            Name newName = ( Name ) name.clone();
+            LdapDN newName = ( LdapDN ) name.clone();
             newName.remove( newName.size() - 1 );
-            Name rdn = dnParser.parse( newRn );
+
+            LdapDN rdn = new LdapDN( newRn );
             newName.addAll( rdn );
+            rdn.normalize();
+            newName.normalize();
 
-            subtrees.put( newName.toString(), ss );
+            subtrees.put( newName.toNormName(), ss );
             next.modifyRn( name, newRn, deleteOldRn );
 
             Attributes apAttrs = nexus.lookup( apName );
-            Attribute administrativeRole = apAttrs.get( "administrativeRole" );
-            ExprNode filter = new PresenceNode( "objectclass" );
+            Attribute administrativeRole = ServerUtils.getAttribute( administrativeRoleType, apAttrs );
+            ExprNode filter = new PresenceNode( oidRegistry.getOid( "objectclass" ) );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-            controls.setReturningAttributes( new String[]
-                { "+", "*" } );
+            controls.setReturningAttributes( new String[] { "+", "*" } );
             NamingEnumeration subentries = nexus.search( baseDn, factoryCfg.getEnvironment(), filter, controls );
             while ( subentries.hasMore() )
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
-                if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) ) )
+                if ( evaluator.evaluate( ss, apName, dn, ServerUtils.getAttribute( objectClassType, candidate ) ) )
                 {
                     nexus.modify( dn, getOperationalModsForReplace( name, newName, administrativeRole, candidate ) );
                 }
@@ -686,9 +714,10 @@
 
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes
-            Name newName = ( Name ) name.clone();
+            LdapDN newName = ( LdapDN ) name.clone();
             newName.remove( newName.size() - 1 );
             newName.add( newRn );
+            newName.normalize();
             ModificationItem[] mods = getModsOnEntryRdnChange( name, newName, entry );
 
             if ( mods.length > 0 )
@@ -699,43 +728,46 @@
     }
 
 
-    public void move( NextInterceptor next, Name oriChildName, Name newParentName, String newRn, boolean deleteOldRn )
+    public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn )
         throws NamingException
     {
         Attributes entry = nexus.lookup( oriChildName );
-        Attribute objectClasses = entry.get( "objectClass" );
+        Attribute objectClasses = ServerUtils.getAttribute( objectClassType, entry );
 
         if ( objectClasses.contains( "subentry" ) )
         {
-            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( oriChildName.toString() );
-            Name apName = ( Name ) oriChildName.clone();
+            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( oriChildName.toNormName() );
+            LdapDN apName = ( LdapDN ) oriChildName.clone();
             apName.remove( apName.size() - 1 );
-            Name baseDn = ( Name ) apName.clone();
+            LdapDN baseDn = ( LdapDN ) apName.clone();
             baseDn.addAll( ss.getBase() );
-            Name newName = ( Name ) newParentName.clone();
+            LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.remove( newName.size() - 1 );
-            Name rdn = dnParser.parse( newRn );
-            newName.addAll( rdn );
 
-            subtrees.put( newName.toString(), ss );
+            LdapDN rdn = new LdapDN( newRn );
+            newName.addAll( rdn );
+            rdn.normalize();
+            newName.normalize();
+            
+            subtrees.put( newName.toNormName(), ss );
             next.move( oriChildName, newParentName, newRn, deleteOldRn );
 
             Attributes apAttrs = nexus.lookup( apName );
-            Attribute administrativeRole = apAttrs.get( "administrativeRole" );
+            Attribute administrativeRole = ServerUtils.getAttribute( administrativeRoleType, apAttrs );
 
-            ExprNode filter = new PresenceNode( "objectclass" );
+            ExprNode filter = new PresenceNode( oidRegistry.getOid( "objectclass" ) );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-            controls.setReturningAttributes( new String[]
-                { "+", "*" } );
+            controls.setReturningAttributes( new String[] { "+", "*" } );
             NamingEnumeration subentries = nexus.search( baseDn, factoryCfg.getEnvironment(), filter, controls );
             while ( subentries.hasMore() )
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
-                if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) ) )
+                if ( evaluator.evaluate( ss, apName, dn, ServerUtils.getAttribute( objectClassType, candidate ) ) )
                 {
                     nexus.modify( dn, getOperationalModsForReplace( oriChildName, newName, administrativeRole,
                         candidate ) );
@@ -754,8 +786,9 @@
 
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes
-            Name newName = ( Name ) newParentName.clone();
+            LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.add( newRn );
+            newName.normalize();
             ModificationItem[] mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
 
             if ( mods.length > 0 )
@@ -766,7 +799,7 @@
     }
 
 
-    public void move( NextInterceptor next, Name oriChildName, Name newParentName ) throws NamingException
+    public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName ) throws NamingException
     {
         Attributes entry = nexus.lookup( oriChildName );
         Attribute objectClasses = entry.get( "objectClass" );
@@ -774,11 +807,11 @@
         if ( objectClasses.contains( "subentry" ) )
         {
             SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( oriChildName.toString() );
-            Name apName = ( Name ) oriChildName.clone();
+            LdapDN apName = ( LdapDN ) oriChildName.clone();
             apName.remove( apName.size() - 1 );
-            Name baseDn = ( Name ) apName.clone();
+            LdapDN baseDn = ( LdapDN ) apName.clone();
             baseDn.addAll( ss.getBase() );
-            Name newName = ( Name ) newParentName.clone();
+            LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.remove( newName.size() - 1 );
             newName.add( newParentName.get( newParentName.size() - 1 ) );
 
@@ -798,7 +831,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) ) )
                 {
@@ -819,7 +853,7 @@
 
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes
-            Name newName = ( Name ) newParentName.clone();
+            LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.add( oriChildName.get( oriChildName.size() - 1 ) );
             ModificationItem[] mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
 
@@ -835,14 +869,14 @@
     // Methods dealing subentry modification
     // -----------------------------------------------------------------------
 
-    public void modify( NextInterceptor next, Name name, int modOp, Attributes mods ) throws NamingException
+    public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
     {
         Attributes entry = nexus.lookup( name );
-        Attribute objectClasses = entry.get( "objectClass" );
+        Attribute objectClasses = ServerUtils.getAttribute( objectClassType, entry );
 
         if ( objectClasses.contains( "subentry" ) && mods.get( "subtreeSpecification" ) != null )
         {
-            SubtreeSpecification ssOld = ( SubtreeSpecification ) subtrees.remove( name.toString() );
+            SubtreeSpecification ssOld = ( SubtreeSpecification ) subtrees.remove( name.toNormName() );
             SubtreeSpecification ssNew;
 
             try
@@ -856,15 +890,15 @@
                 throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALIDATTRIBUTESYNTAX );
             }
 
-            subtrees.put( name.toString(), ssNew );
+            subtrees.put( name.toNormName(), ssNew );
             next.modify( name, modOp, mods );
 
             // search for all entries selected by the old SS and remove references to subentry
-            Name apName = ( Name ) name.clone();
+            LdapDN apName = ( LdapDN ) name.clone();
             apName.remove( apName.size() - 1 );
-            Name oldBaseDn = ( Name ) apName.clone();
+            LdapDN oldBaseDn = ( LdapDN ) apName.clone();
             oldBaseDn.addAll( ssOld.getBase() );
-            ExprNode filter = new PresenceNode( "objectClass" );
+            ExprNode filter = new PresenceNode( oidRegistry.getOid( "objectClass" ) );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -874,9 +908,10 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
-                if ( evaluator.evaluate( ssOld, apName, dn, candidate.get( "objectClass" ) ) )
+                if ( evaluator.evaluate( ssOld, apName, dn, ServerUtils.getAttribute( objectClassType, candidate ) ) )
                 {
                     nexus.modify( dn, getOperationalModsForRemove( name, candidate ) );
                 }
@@ -884,18 +919,19 @@
 
             // search for all selected entries by the new SS and add references to subentry
             Attributes apAttrs = nexus.lookup( apName );
-            Attribute administrativeRole = apAttrs.get( "administrativeRole" );
+            Attribute administrativeRole = ServerUtils.getAttribute( administrativeRoleType, apAttrs );
             Attributes operational = getSubentryOperatationalAttributes( name, administrativeRole );
-            Name newBaseDn = ( Name ) apName.clone();
+            LdapDN newBaseDn = ( LdapDN ) apName.clone();
             newBaseDn.addAll( ssNew.getBase() );
             subentries = nexus.search( newBaseDn, factoryCfg.getEnvironment(), filter, controls );
             while ( subentries.hasMore() )
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
-                if ( evaluator.evaluate( ssNew, apName, dn, candidate.get( "objectClass" ) ) )
+                if ( evaluator.evaluate( ssNew, apName, dn, ServerUtils.getAttribute( objectClassType, candidate ) ) )
                 {
                     nexus.modify( dn, getOperationalModsForAdd( candidate, operational ) );
                 }
@@ -908,10 +944,10 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, ModificationItem[] mods ) throws NamingException
+    public void modify( NextInterceptor next, LdapDN name, ModificationItem[] mods ) throws NamingException
     {
         Attributes entry = nexus.lookup( name );
-        Attribute objectClasses = entry.get( "objectClass" );
+        Attribute objectClasses = ServerUtils.getAttribute( objectClassType, entry );
         boolean isSubtreeSpecificationModification = false;
         ModificationItem subtreeMod = null;
 
@@ -940,15 +976,15 @@
                 throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALIDATTRIBUTESYNTAX );
             }
 
-            subtrees.put( name.toString(), ssNew );
+            subtrees.put( name.toNormName(), ssNew );
             next.modify( name, mods );
 
             // search for all entries selected by the old SS and remove references to subentry
-            Name apName = ( Name ) name.clone();
+            LdapDN apName = ( LdapDN ) name.clone();
             apName.remove( apName.size() - 1 );
-            Name oldBaseDn = ( Name ) apName.clone();
+            LdapDN oldBaseDn = ( LdapDN ) apName.clone();
             oldBaseDn.addAll( ssOld.getBase() );
-            ExprNode filter = new PresenceNode( "objectClass" );
+            ExprNode filter = new PresenceNode( oidRegistry.getOid( "objectClass" ) );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -958,7 +994,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
                 if ( evaluator.evaluate( ssOld, apName, dn, candidate.get( "objectClass" ) ) )
                 {
@@ -970,14 +1007,15 @@
             Attributes apAttrs = nexus.lookup( apName );
             Attribute administrativeRole = apAttrs.get( "administrativeRole" );
             Attributes operational = getSubentryOperatationalAttributes( name, administrativeRole );
-            Name newBaseDn = ( Name ) apName.clone();
+            LdapDN newBaseDn = ( LdapDN ) apName.clone();
             newBaseDn.addAll( ssNew.getBase() );
             subentries = nexus.search( newBaseDn, factoryCfg.getEnvironment(), filter, controls );
             while ( subentries.hasMore() )
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn.normalize();
 
                 if ( evaluator.evaluate( ssNew, apName, dn, candidate.get( "objectClass" ) ) )
                 {
@@ -1168,10 +1206,10 @@
      * @return the set of modifications required to remove an entry's reference to
      * a subentry
      */
-    private ModificationItem[] getOperationalModsForRemove( Name subentryDn, Attributes candidate )
+    private ModificationItem[] getOperationalModsForRemove( LdapDN subentryDn, Attributes candidate )
     {
         List modList = new ArrayList();
-        String dn = subentryDn.toString();
+        String dn = subentryDn.toNormName();
 
         for ( int ii = 0; ii < SUBENTRY_OPATTRS.length; ii++ )
         {
@@ -1288,12 +1326,18 @@
 
             if ( !result.isRelative() )
             {
-                String normalizedDn = dnParser.parse( dn ).toString();
+                LdapDN ndn = new LdapDN( dn );
+                ndn.normalize();
+                String normalizedDn = ndn.toString();
                 return !subtrees.containsKey( normalizedDn );
             }
 
-            Name name = dnParser.parse( invocation.getCaller().getNameInNamespace() );
-            name.addAll( dnParser.parse( result.getName() ) );
+            LdapDN name = new LdapDN( invocation.getCaller().getNameInNamespace() );
+            name.normalize();
+
+            LdapDN rest = new LdapDN( result.getName() );
+            rest.normalize();
+            name.addAll( rest );
             return !subtrees.containsKey( name.toString() );
         }
     }
@@ -1343,13 +1387,18 @@
 
             if ( !result.isRelative() )
             {
-                String normalizedDn = dnParser.parse( dn ).toString();
-                return subtrees.containsKey( normalizedDn );
+                LdapDN ndn = new LdapDN( dn );
+                ndn.normalize();
+                return subtrees.containsKey( ndn.toNormName() );
             }
 
-            Name name = dnParser.parse( invocation.getCaller().getNameInNamespace() );
-            name.addAll( dnParser.parse( result.getName() ) );
-            return subtrees.containsKey( name.toString() );
+            LdapDN name = new LdapDN( invocation.getCaller().getNameInNamespace() );
+            name.normalize();
+
+            LdapDN rest = new LdapDN( result.getName() );
+            rest.normalize();
+            name.addAll( rest );
+            return subtrees.containsKey( name.toNormName() );
         }
     }
 }

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java Tue Jun 13 18:36:40 2006
@@ -18,7 +18,7 @@
 
 
 import org.apache.directory.server.core.schema.OidRegistry;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
 
@@ -90,7 +90,7 @@
         }
         else if ( apDn.equals( entryDn ) )
         {
-            apRelativeRdn = new LdapName();
+            apRelativeRdn = new LdapDN();
         }
         else
         {
@@ -110,7 +110,7 @@
         }
         else if ( apRelativeRdn.equals( subtree.getBase() ) )
         {
-            baseRelativeRdn = new LdapName();
+            baseRelativeRdn = new LdapDN();
         }
         else if ( !NamespaceTools.isDescendant( subtree.getBase(), apRelativeRdn ) )
         {

Modified: directory/branches/apacheds/1.0/core/src/main/schema/apache.schema
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/schema/apache.schema?rev=414018&r1=414017&r2=414018&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/schema/apache.schema (original)
+++ directory/branches/apacheds/1.0/core/src/main/schema/apache.schema Tue Jun 13 18:36:40 2006
@@ -18,8 +18,7 @@
 
 attributetype ( 1.2.6.1.4.1.18060.1.1.1.3.1 NAME 'apacheNdn'
     DESC 'Index attribute DN whose values are normalized based on schema'
-    SUP distinguishedName
-    EQUALITY distinguishedNameMatch
+    EQUALITY exactDnAsStringMatch
     SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
     SINGLE-VALUE
     NO-USER-MODIFICATION



Mime
View raw message