directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414035 [4/8] - in /directory/trunks/apacheds: ./ 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/org/apac...
Date Wed, 14 Jun 2006 03:22:12 GMT
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java Tue Jun 13 20:22:05 2006
@@ -21,7 +21,6 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
@@ -31,6 +30,7 @@
 import org.apache.directory.server.core.configuration.DirectoryPartitionConfiguration;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -44,9 +44,9 @@
 public interface NextInterceptor
 {
     /**
-     * Calls the next interceptor's {@link Interceptor#compare(NextInterceptor,Name,String,Object)}.
+     * Calls the next interceptor's {@link Interceptor#compare(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,String,Object)}.
      */
-    boolean compare( Name name, String oid, Object value ) throws NamingException;
+    boolean compare( LdapDN name, String oid, Object value ) throws NamingException;
 
 
     /**
@@ -56,21 +56,21 @@
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#getMatchedName(NextInterceptor, Name, boolean)}.
+     * Calls the next interceptor's {@link Interceptor#getMatchedName(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    Name getMatchedName( Name name, boolean normalized ) throws NamingException;
+    LdapDN getMatchedName ( LdapDN name ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#getSuffix(NextInterceptor, Name, boolean)}.
+     * Calls the next interceptor's {@link Interceptor#getSuffix(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    Name getSuffix( Name name, boolean normalized ) throws NamingException;
+    LdapDN getSuffix ( LdapDN name ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#listSuffixes(NextInterceptor, boolean)}.
+     * Calls the next interceptor's {@link Interceptor#listSuffixes(NextInterceptor)}.
      */
-    Iterator listSuffixes( boolean normalized ) throws NamingException;
+    Iterator listSuffixes () throws NamingException;
 
 
     /**
@@ -80,98 +80,98 @@
 
 
     /**
-     * Calls the next interceptor's {@link DirectoryPartitionNexus#removeContextPartition(Name)}.
+     * Calls the next interceptor's {@link DirectoryPartitionNexus#removeContextPartition(org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    void removeContextPartition( Name suffix ) throws NamingException;
+    void removeContextPartition( LdapDN suffix ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#delete(NextInterceptor, Name)}.
+     * Calls the next interceptor's {@link Interceptor#delete(NextInterceptor, org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    void delete( Name name ) throws NamingException;
+    void delete( LdapDN name ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#add(NextInterceptor, String, Name, Attributes)}.
+     * Calls the next interceptor's {@link Interceptor#add(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.Attributes)}.
      */
-    void add( String userProvidedName, Name normalizedName, Attributes entry ) throws NamingException;
+    void add(LdapDN normName, Attributes entry) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#modify(NextInterceptor, Name, int, Attributes)}.
+     * Calls the next interceptor's {@link Interceptor#modify(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,int,javax.naming.directory.Attributes)}.
      */
-    void modify( Name name, int modOp, Attributes attributes ) throws NamingException;
+    void modify( LdapDN name, int modOp, Attributes attributes ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#modify(NextInterceptor, Name, ModificationItem[])}.
+     * Calls the next interceptor's {@link Interceptor#modify(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])}.
      */
-    void modify( Name name, ModificationItem[] items ) throws NamingException;
+    void modify( LdapDN name, ModificationItem[] items ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#list(NextInterceptor, Name)}.
+     * Calls the next interceptor's {@link Interceptor#list(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    NamingEnumeration list( Name baseName ) throws NamingException;
+    NamingEnumeration list( LdapDN baseName ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#search(NextInterceptor, Name, Map, ExprNode, SearchControls)}.
+     * Calls the next interceptor's {@link Interceptor#search(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,java.util.Map,org.apache.directory.shared.ldap.filter.ExprNode,javax.naming.directory.SearchControls)}.
      */
-    NamingEnumeration search( Name baseName, Map environment, ExprNode filter, SearchControls searchControls )
+    NamingEnumeration search( LdapDN baseName, Map environment, ExprNode filter, SearchControls searchControls )
         throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor, Name)}.
+     * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    Attributes lookup( Name name ) throws NamingException;
+    Attributes lookup( LdapDN name ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor, Name, String[])}.
+     * Calls the next interceptor's {@link Interceptor#lookup(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,String[])}.
      */
-    Attributes lookup( Name name, String[] attrIds ) throws NamingException;
+    Attributes lookup( LdapDN name, String[] attrIds ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#hasEntry(NextInterceptor, Name)}.
+     * Calls the next interceptor's {@link Interceptor#hasEntry(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    boolean hasEntry( Name name ) throws NamingException;
+    boolean hasEntry( LdapDN name ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#isSuffix(NextInterceptor, Name)}.
+     * Calls the next interceptor's {@link Interceptor#isSuffix(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    boolean isSuffix( Name name ) throws NamingException;
+    boolean isSuffix( LdapDN name ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#modifyRn(NextInterceptor, Name, String, boolean)}.
+     * Calls the next interceptor's {@link Interceptor#modifyRn(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,String,boolean)}.
      */
-    void modifyRn( Name name, String newRn, boolean deleteOldRn ) throws NamingException;
+    void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#move(NextInterceptor, Name, Name)}.
+     * Calls the next interceptor's {@link Interceptor#move(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN)}.
      */
-    void move( Name oldName, Name newParentName ) throws NamingException;
+    void move( LdapDN oldName, LdapDN newParentName ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#move(NextInterceptor, Name, Name, String, boolean)}.
+     * Calls the next interceptor's {@link Interceptor#move(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN,String,boolean)}.
      */
-    void move( Name oldName, Name newParentName, String newRn, boolean deleteOldRn ) throws NamingException;
+    void move( LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#bind(NextInterceptor, Name, byte[], List, String)
+     * Calls the next interceptor's {@link Interceptor#bind(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN,byte[],java.util.List,String)
      */
-    void bind( Name bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException;
+    void bind( LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException;
 
 
     /**
-     * Calls the next interceptor's {@link Interceptor#unbind(NextInterceptor, Name)
+     * Calls the next interceptor's {@link Interceptor#unbind(NextInterceptor,org.apache.directory.shared.ldap.name.LdapDN)
      */
-    void unbind( Name bindDn ) throws NamingException;
+    void unbind( LdapDN bindDn ) throws NamingException;
 }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java Tue Jun 13 20:22:05 2006
@@ -110,8 +110,9 @@
         }
         else if ( cfg instanceof RemoveDirectoryPartitionConfiguration )
         {
-            new DirectoryPartitionNexusProxy( service.getJndiContext( principal, credential, authentication, "" ),
-                service ).removeContextPartition( ( ( RemoveDirectoryPartitionConfiguration ) cfg ).getSuffix() );
+            Context ctx = service.getJndiContext( principal, credential, authentication, "" );
+            DirectoryPartitionNexusProxy proxy = new DirectoryPartitionNexusProxy( ctx, service );
+            proxy.removeContextPartition( ( ( RemoveDirectoryPartitionConfiguration ) cfg ).getSuffix() );
         }
         else if ( service == null )
         {

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java Tue Jun 13 20:22:05 2006
@@ -27,7 +27,7 @@
 
 import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
 import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -42,8 +42,8 @@
 {
     private static final String SASL_AUTHID = "java.naming.security.sasl.authorizationId";
 
-    private LdapName providerDn;
-    private LdapName bindDn;
+    private LdapDN providerDn;
+    private LdapDN bindDn;
     private String saslAuthId;
     private AuthenticationLevel level;
     private List mechanisms = new ArrayList();
@@ -130,11 +130,11 @@
 
         if ( url.trim().equals( "" ) )
         {
-            props.providerDn = LdapName.EMPTY_LDAP_NAME;
+            props.providerDn = LdapDN.EMPTY_LDAPDN;
         }
         else
         {
-            props.providerDn = new LdapName( url );
+            props.providerDn = new LdapDN( url );
         }
 
         // -------------------------------------------------------------------
@@ -203,11 +203,11 @@
 
         if ( ( ( String ) principal ).trim().equals( "" ) )
         {
-            props.bindDn = LdapName.EMPTY_LDAP_NAME;
+            props.bindDn = LdapDN.EMPTY_LDAPDN;
         }
         else
         {
-            props.bindDn = new LdapName( ( String ) principal );
+            props.bindDn = new LdapDN( ( String ) principal );
         }
 
         if ( env.get( SASL_AUTHID ) != null && props.level == AuthenticationLevel.STRONG )
@@ -254,13 +254,13 @@
     }
 
 
-    public LdapName getBindDn()
+    public LdapDN getBindDn()
     {
         return bindDn;
     }
 
 
-    public LdapName getProviderDn()
+    public LdapDN getProviderDn()
     {
         return providerDn;
     }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Tue Jun 13 20:22:05 2006
@@ -52,7 +52,7 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -78,7 +78,7 @@
     private final Hashtable env;
 
     /** The distinguished name of this Context */
-    private final LdapName dn;
+    private final LdapDN dn;
 
     /** The set of registered NamingListeners */
     private final Set listeners = new HashSet();
@@ -123,7 +123,10 @@
             .getSaslAuthId() );
 
         if ( dn.size() == 0 )
+        {
             return;
+        }
+        
         if ( !nexusProxy.hasEntry( dn ) )
         {
             throw new NameNotFoundException( dn + " does not exist" );
@@ -137,14 +140,12 @@
      * constructor is used to propagate new contexts from existing contexts.
      *
      * @param principal the directory user principal that is propagated
-     * @param nexusProxy the intercepting proxy to the nexus
-     * @param env the environment properties used by this context
      * @param dn the distinguished name of this context
      */
     protected ServerContext(DirectoryService service, LdapPrincipal principal, Name dn) throws NamingException
     {
         this.service = service;
-        this.dn = ( LdapName ) dn.clone();
+        this.dn = ( LdapDN ) dn.clone();
 
         this.env = ( Hashtable ) service.getConfiguration().getEnvironment().clone();
         this.env.put( PROVIDER_URL, dn.toString() );
@@ -275,7 +276,7 @@
      */
     public Context createSubcontext( String name ) throws NamingException
     {
-        return createSubcontext( new LdapName( name ) );
+        return createSubcontext( new LdapDN( name ) );
     }
 
 
@@ -285,7 +286,7 @@
     public Context createSubcontext( Name name ) throws NamingException
     {
         Attributes attributes = new LockableAttributesImpl();
-        LdapName target = buildTarget( name );
+        LdapDN target = buildTarget( name );
 
         String rdn = name.get( name.size() - 1 );
         String rdnAttribute = NamespaceTools.getRdnAttribute( rdn );
@@ -302,7 +303,7 @@
          * we need to copy over the controls as well to propagate the complete 
          * environment besides whats in the hashtable for env.
          */
-        nexusProxy.add( target.toString(), target, attributes );
+        nexusProxy.add(target, attributes );
         return new ServerLdapContext( service, principal, target );
     }
 
@@ -312,7 +313,7 @@
      */
     public void destroySubcontext( String name ) throws NamingException
     {
-        destroySubcontext( new LdapName( name ) );
+        destroySubcontext( new LdapDN( name ) );
     }
 
 
@@ -321,7 +322,7 @@
      */
     public void destroySubcontext( Name name ) throws NamingException
     {
-        Name target = buildTarget( name );
+        LdapDN target = buildTarget( name );
         if ( target.size() == 0 )
         {
             throw new LdapNoPermissionException( "can't delete the rootDSE" );
@@ -336,7 +337,7 @@
      */
     public void bind( String name, Object obj ) throws NamingException
     {
-        bind( new LdapName( name ), obj );
+        bind( new LdapDN( name ), obj );
     }
 
 
@@ -351,8 +352,8 @@
 
         if ( outAttrs != null )
         {
-            Name target = buildTarget( name );
-            nexusProxy.add( target.toString(), target, outAttrs );
+            LdapDN target = buildTarget( name );
+            nexusProxy.add( target, outAttrs );
             return;
         }
 
@@ -381,11 +382,11 @@
                 }
             }
 
-            Name target = buildTarget( name );
+            LdapDN target = buildTarget( name );
 
             // Serialize object into entry attributes and add it.
             JavaLdapSupport.serialize( attributes, obj );
-            nexusProxy.add( target.toString(), target, attributes );
+            nexusProxy.add( target, attributes );
         }
         else if ( obj instanceof DirContext )
         {
@@ -400,8 +401,8 @@
                 }
             }
 
-            Name target = buildTarget( name );
-            nexusProxy.add( target.toString(), target, attributes );
+            LdapDN target = buildTarget( name );
+            nexusProxy.add( target, attributes );
         }
         else
         {
@@ -415,7 +416,7 @@
      */
     public void rename( String oldName, String newName ) throws NamingException
     {
-        rename( new LdapName( oldName ), new LdapName( newName ) );
+        rename( new LdapDN( oldName ), new LdapDN( newName ) );
     }
 
 
@@ -424,15 +425,19 @@
      */
     public void rename( Name oldName, Name newName ) throws NamingException
     {
-        Name oldDn = buildTarget( oldName );
-        Name newDn = buildTarget( newName );
+        LdapDN oldDn = buildTarget( oldName );
+        LdapDN newDn = buildTarget( newName );
         if ( oldDn.size() == 0 )
         {
             throw new LdapNoPermissionException( "can't rename the rootDSE" );
         }
 
-        Name oldBase = oldName.getPrefix( 1 );
-        Name newBase = newName.getPrefix( 1 );
+        // calculate parents
+        LdapDN oldBase = ( LdapDN ) oldName.clone();
+        oldBase.remove( oldName.size() - 1 );
+        LdapDN newBase = ( LdapDN ) newName.clone();
+        newBase.remove( newName.size() - 1 );
+        
         String newRdn = newName.get( newName.size() - 1 );
         String oldRdn = oldName.get( oldName.size() - 1 );
         boolean delOldRdn = true;
@@ -463,7 +468,8 @@
         }
         else
         {
-            Name parent = newDn.getPrefix( 1 );
+            LdapDN parent = ( LdapDN ) newDn.clone();
+            parent.remove( newDn.size() - 1 );
             if ( newRdn.equalsIgnoreCase( oldRdn ) )
             {
                 nexusProxy.move( oldDn, parent );
@@ -481,7 +487,7 @@
      */
     public void rebind( String name, Object obj ) throws NamingException
     {
-        rebind( new LdapName( name ), obj );
+        rebind( new LdapDN( name ), obj );
     }
 
 
@@ -490,7 +496,7 @@
      */
     public void rebind( Name name, Object obj ) throws NamingException
     {
-        Name target = buildTarget( name );
+        LdapDN target = buildTarget( name );
         if ( nexusProxy.hasEntry( target ) )
         {
             nexusProxy.delete( target );
@@ -504,7 +510,7 @@
      */
     public void unbind( String name ) throws NamingException
     {
-        unbind( new LdapName( name ) );
+        unbind( new LdapDN( name ) );
     }
 
 
@@ -524,11 +530,11 @@
     {
         if ( StringTools.isEmpty( name ) )
         {
-            return lookup( LdapName.EMPTY_LDAP_NAME );
+            return lookup( LdapDN.EMPTY_LDAPDN );
         }
         else
         {
-            return lookup( new LdapName( name ) );
+            return lookup( new LdapDN( name ) );
         }
     }
 
@@ -539,7 +545,7 @@
     public Object lookup( Name name ) throws NamingException
     {
         Object obj;
-        LdapName target = buildTarget( name );
+        LdapDN target = buildTarget( name );
         Attributes attributes = nexusProxy.lookup( target );
 
         try
@@ -604,13 +610,19 @@
      * Non-federated implementation presuming the name argument is not a 
      * composite name spanning multiple namespaces but a compound name in 
      * the same LDAP namespace.  Hence the parser returned is always the
-     * same as calling this method with the empty String.
+     * same as calling this method with the empty String. 
      * 
      * @see javax.naming.Context#getNameParser(java.lang.String)
      */
     public NameParser getNameParser( String name ) throws NamingException
     {
-        return LdapName.getNameParser();
+        return new NameParser()
+        {
+            public Name parse( String name ) throws NamingException
+            {
+                return new LdapDN( name );
+            }
+        };
     }
 
 
@@ -624,7 +636,13 @@
      */
     public NameParser getNameParser( Name name ) throws NamingException
     {
-        return LdapName.getNameParser();
+        return new NameParser()
+        {
+            public Name parse( String name ) throws NamingException
+            {
+                return new LdapDN( name );
+            }
+        };
     }
 
 
@@ -633,7 +651,7 @@
      */
     public NamingEnumeration list( String name ) throws NamingException
     {
-        return list( new LdapName( name ) );
+        return list( new LdapDN( name ) );
     }
 
 
@@ -651,7 +669,7 @@
      */
     public NamingEnumeration listBindings( String name ) throws NamingException
     {
-        return listBindings( new LdapName( name ) );
+        return listBindings( new LdapDN( name ) );
     }
 
 
@@ -661,7 +679,7 @@
     public NamingEnumeration listBindings( Name name ) throws NamingException
     {
         // Conduct a special one level search at base for all objects
-        Name base = buildTarget( name );
+        LdapDN base = buildTarget( name );
         PresenceNode filter = new PresenceNode( "objectClass" );
         SearchControls ctls = new SearchControls();
         ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
@@ -674,7 +692,7 @@
      */
     public String composeName( String name, String prefix ) throws NamingException
     {
-        return composeName( new LdapName( name ), new LdapName( prefix ) ).toString();
+        return composeName( new LdapDN( name ), new LdapDN( prefix ) ).toString();
     }
 
 
@@ -747,7 +765,7 @@
 
     public void addNamingListener( String name, int scope, NamingListener namingListener ) throws NamingException
     {
-        addNamingListener( new LdapName( name ), scope, namingListener );
+        addNamingListener( new LdapDN( name ), scope, namingListener );
     }
 
 
@@ -788,10 +806,9 @@
      * @throws InvalidNameException if relativeName is not a valid name in
      *      the LDAP namespace.
      */
-    LdapName buildTarget( Name relativeName ) throws InvalidNameException
+    LdapDN buildTarget( Name relativeName ) throws InvalidNameException
     {
-        // Clone our DN or absolute path
-        LdapName target = ( LdapName ) dn.clone();
+        LdapDN target = ( LdapDN ) dn.clone();
 
         // Add to left hand side of cloned DN the relative name arg
         target.addAll( target.size(), relativeName );

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Tue Jun 13 20:22:05 2006
@@ -46,7 +46,7 @@
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
 
 
@@ -82,8 +82,6 @@
      * set the PROVIDER_URL to the distinguished name for this context.
      *
      * @param principal the principal which is propagated
-     * @param nexusProxy the intercepting proxy to the nexus
-     * @param env the environment properties used by this context
      * @param dn the distinguished name of this context
      */
     protected ServerDirContext(DirectoryService service, LdapPrincipal principal, Name dn) throws NamingException
@@ -101,7 +99,7 @@
      */
     public Attributes getAttributes( String name ) throws NamingException
     {
-        return getAttributes( new LdapName( name ) );
+        return getAttributes( new LdapDN( name ) );
     }
 
 
@@ -120,7 +118,7 @@
      */
     public Attributes getAttributes( String name, String[] attrIds ) throws NamingException
     {
-        return getAttributes( new LdapName( name ), attrIds );
+        return getAttributes( new LdapDN( name ), attrIds );
     }
 
 
@@ -140,7 +138,7 @@
      */
     public void modifyAttributes( String name, int modOp, Attributes attrs ) throws NamingException
     {
-        modifyAttributes( new LdapName( name ), modOp, attrs );
+        modifyAttributes( new LdapDN( name ), modOp, attrs );
     }
 
 
@@ -160,7 +158,7 @@
      */
     public void modifyAttributes( String name, ModificationItem[] mods ) throws NamingException
     {
-        modifyAttributes( new LdapName( name ), mods );
+        modifyAttributes( new LdapDN( name ), mods );
     }
 
 
@@ -180,7 +178,7 @@
      */
     public void bind( String name, Object obj, Attributes attrs ) throws NamingException
     {
-        bind( new LdapName( name ), obj, attrs );
+        bind( new LdapDN( name ), obj, attrs );
     }
 
 
@@ -207,8 +205,8 @@
         if ( null == obj )
         {
             Attributes clone = ( Attributes ) attrs.clone();
-            Name target = buildTarget( name );
-            getNexusProxy().add( target.toString(), target, clone );
+            LdapDN target = buildTarget( name );
+            getNexusProxy().add( target, clone );
             return;
         }
 
@@ -218,7 +216,7 @@
 
         if ( outAttrs != attrs )
         {
-            Name target = buildTarget( name );
+            LdapDN target = buildTarget( name );
             Attributes attributes = ( Attributes ) attrs.clone();
             if ( outAttrs != null && outAttrs.size() > 0 )
             {
@@ -228,7 +226,7 @@
                     attributes.put( ( Attribute ) list.next() );
                 }
             }
-            getNexusProxy().add( target.toString(), target, attributes );
+            getNexusProxy().add( target, attributes );
             return;
         }
 
@@ -257,11 +255,11 @@
                     attributes.put( ( Attribute ) list.next() );
                 }
             }
-            Name target = buildTarget( name );
+            LdapDN target = buildTarget( name );
 
             // Serialize object into entry attributes and add it.
             JavaLdapSupport.serialize( attributes, obj );
-            getNexusProxy().add( target.toString(), target, attributes );
+            getNexusProxy().add( target, attributes );
         }
         else if ( obj instanceof DirContext )
         {
@@ -275,8 +273,8 @@
                     attributes.put( ( Attribute ) list.next() );
                 }
             }
-            Name target = buildTarget( name );
-            getNexusProxy().add( target.toString(), target, attributes );
+            LdapDN target = buildTarget( name );
+            getNexusProxy().add( target, attributes );
         }
         else
         {
@@ -291,7 +289,7 @@
      */
     public void rebind( String name, Object obj, Attributes attrs ) throws NamingException
     {
-        rebind( new LdapName( name ), obj, attrs );
+        rebind( new LdapDN( name ), obj, attrs );
     }
 
 
@@ -301,7 +299,7 @@
      */
     public void rebind( Name name, Object obj, Attributes attrs ) throws NamingException
     {
-        Name target = buildTarget( name );
+        LdapDN target = buildTarget( name );
         if ( getNexusProxy().hasEntry( target ) )
         {
             getNexusProxy().delete( target );
@@ -316,7 +314,7 @@
      */
     public DirContext createSubcontext( String name, Attributes attrs ) throws NamingException
     {
-        return createSubcontext( new LdapName( name ), attrs );
+        return createSubcontext( new LdapDN( name ), attrs );
     }
 
 
@@ -331,7 +329,7 @@
             return ( DirContext ) super.createSubcontext( name );
         }
 
-        Name target = buildTarget( name );
+        LdapDN target = buildTarget( name );
         String rdn = name.get( name.size() - 1 );
         String rdnAttribute = NamespaceTools.getRdnAttribute( rdn );
         String rdnValue = NamespaceTools.getRdnValue( rdn );
@@ -348,7 +346,7 @@
         }
 
         // Add the new context to the server which as a side effect adds
-        getNexusProxy().add( target.toString(), target, attributes );
+        getNexusProxy().add( target, attributes );
 
         // Initialize the new context
         return new ServerLdapContext( getService(), getPrincipal(), target );
@@ -401,7 +399,7 @@
      */
     public NamingEnumeration search( String name, Attributes matchingAttributes ) throws NamingException
     {
-        return search( new LdapName( name ), matchingAttributes, null );
+        return search( new LdapDN( name ), matchingAttributes, null );
     }
 
 
@@ -422,7 +420,7 @@
     public NamingEnumeration search( String name, Attributes matchingAttributes, String[] attributesToReturn )
         throws NamingException
     {
-        return search( new LdapName( name ), matchingAttributes, attributesToReturn );
+        return search( new LdapDN( name ), matchingAttributes, attributesToReturn );
     }
 
 
@@ -434,7 +432,7 @@
         throws NamingException
     {
         SearchControls ctls = new SearchControls();
-        Name target = buildTarget( name );
+        LdapDN target = buildTarget( name );
 
         // If we need to return specific attributes add em to the SearchControls
         if ( null != attributesToReturn )
@@ -501,7 +499,7 @@
      */
     public NamingEnumeration search( String name, String filter, SearchControls cons ) throws NamingException
     {
-        return search( new LdapName( name ), filter, cons );
+        return search( new LdapDN( name ), filter, cons );
     }
 
 
@@ -522,7 +520,7 @@
          newName = LdapDN.oidToName( newName, DnOidContainer.getOids() );
          Name target = buildTarget( ((LdapDN)newName).toLdapName() );*/
 
-        Name target = buildTarget( name );
+        LdapDN target = buildTarget( name );
         return getNexusProxy().search( target, getEnvironment(), filter, cons );
     }
 
@@ -534,7 +532,7 @@
     public NamingEnumeration search( Name name, String filter, SearchControls cons ) throws NamingException
     {
         ExprNode filterNode;
-        Name target = buildTarget( name );
+        LdapDN target = buildTarget( name );
 
         try
         {
@@ -566,7 +564,7 @@
     public NamingEnumeration search( String name, String filterExpr, Object[] filterArgs, SearchControls cons )
         throws NamingException
     {
-        return search( new LdapName( name ), filterExpr, filterArgs, cons );
+        return search( new LdapDN( name ), filterExpr, filterArgs, cons );
     }
 
 
@@ -654,7 +652,7 @@
     public void addNamingListener( String name, String filter, SearchControls searchControls,
         NamingListener namingListener ) throws NamingException
     {
-        addNamingListener( new LdapName( name ), filter, searchControls, namingListener );
+        addNamingListener( new LdapDN( name ), filter, searchControls, namingListener );
     }
 
 
@@ -696,6 +694,6 @@
     public void addNamingListener( String name, String filter, Object[] objects, SearchControls searchControls,
         NamingListener namingListener ) throws NamingException
     {
-        addNamingListener( new LdapName( name ), filter, objects, searchControls, namingListener );
+        addNamingListener( new LdapDN( name ), filter, objects, searchControls, namingListener );
     }
 }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Tue Jun 13 20:22:05 2006
@@ -31,8 +31,7 @@
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.referral.ReferralService;
 import org.apache.directory.shared.ldap.NotImplementedException;
-
-import com.sun.jndi.ldap.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -56,7 +55,7 @@
      * @param env the JNDI environment parameters
      * @throws NamingException the context cannot be created
      */
-    public ServerLdapContext(DirectoryService service, Hashtable env) throws NamingException
+    public ServerLdapContext( DirectoryService service, Hashtable env ) throws NamingException
     {
         super( service, env );
     }
@@ -67,11 +66,9 @@
      * set the PROVIDER_URL to the distinguished name for this context.
      *
      * @param principal the directory user principal that is propagated
-     * @param nexusProxy the intercepting proxy to the nexus
-     * @param env the environment properties used by this context
      * @param dn the distinguished name of this context
      */
-    ServerLdapContext(DirectoryService service, LdapPrincipal principal, Name dn) throws NamingException
+    ServerLdapContext( DirectoryService service, LdapPrincipal principal, Name dn ) throws NamingException
     {
         super( service, principal, dn );
     }
@@ -162,7 +159,7 @@
      * permission is not allowed for this operation or the oid is not recognized,
      * or the attribute is not present in the entry ... you get the picture.
      */
-    public boolean compare( Name name, String oid, Object value ) throws NamingException
+    public boolean compare( LdapDN name, String oid, Object value ) throws NamingException
     {
         return super.getNexusProxy().compare( name, oid, value );
     }
@@ -179,7 +176,7 @@
     public void ldapUnbind() throws NamingException
     {
         String bindDn = ( String ) getEnvironment().get( Context.SECURITY_PRINCIPAL );
-        super.getNexusProxy().unbind( new LdapName( bindDn ) );
+        super.getNexusProxy().unbind( new LdapDN( bindDn ) );
     }
 
 

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java Tue Jun 13 20:22:05 2006
@@ -19,7 +19,6 @@
 
 import java.util.Map;
 
-import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
@@ -27,18 +26,22 @@
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.configuration.DirectoryPartitionConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
 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.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.LeafNode;
-import org.apache.directory.shared.ldap.name.DnParser;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
-import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
+
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
@@ -56,20 +59,18 @@
     /** logger used by this class */
     private static final Logger log = LoggerFactory.getLogger( NormalizationService.class );
 
-    /** the parser used for normalizing distinguished names */
-    private DnParser parser;
     /** a filter node value normalizer and undefined node remover */
-    private ValueNormalizingVisitor visitor;
+    private NormalizingVisitor visitor;
     /** the attributeType registry used for normalization and determining if some filter nodes are undefined */
-    private AttributeTypeRegistry registry;
+    private AttributeTypeRegistry attributeRegistry;
 
 
     public void init( DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration cfg ) throws NamingException
     {
-        registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
-        NameComponentNormalizer ncn = new PerComponentNormalizer();
-        parser = new DnParser( ncn );
-        visitor = new ValueNormalizingVisitor( ncn );
+        OidRegistry oidRegistry = factoryCfg.getGlobalRegistries().getOidRegistry();
+        attributeRegistry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
+        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
+        visitor = new NormalizingVisitor( ncn, oidRegistry );
     }
 
 
@@ -82,70 +83,70 @@
     // Normalize all Name based arguments for ContextPartition interface operations
     // ------------------------------------------------------------------------
 
-    public void add( NextInterceptor nextInterceptor, String upName, Name normName, Attributes attrs )
+    public void add(NextInterceptor nextInterceptor, LdapDN name, Attributes attrs)
         throws NamingException
     {
-        normName = parser.parse( normName.toString() );
-        nextInterceptor.add( upName, normName, attrs );
+        LdapDN normalized = LdapDN.normalize( name );
+        nextInterceptor.add( normalized, attrs );
     }
 
 
-    public void delete( NextInterceptor nextInterceptor, Name name ) throws NamingException
+    public void delete( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
-        name = parser.parse( name.toString() );
-        nextInterceptor.delete( name );
+        LdapDN normalized = LdapDN.normalize( name );
+        nextInterceptor.delete( normalized );
     }
 
 
-    public void modify( NextInterceptor nextInterceptor, Name name, int modOp, Attributes attrs )
+    public void modify( NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs )
         throws NamingException
     {
-        name = parser.parse( name.toString() );
-        nextInterceptor.modify( name, modOp, attrs );
+        LdapDN normalized = LdapDN.normalize( name );
+        nextInterceptor.modify( normalized, modOp, attrs );
     }
 
 
-    public void modify( NextInterceptor nextInterceptor, Name name, ModificationItem[] items ) throws NamingException
+    public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItem[] items ) throws NamingException
     {
-        name = parser.parse( name.toString() );
-        nextInterceptor.modify( name, items );
+        LdapDN normalized = LdapDN.normalize( name );
+        nextInterceptor.modify( normalized, items );
     }
 
 
-    public void modifyRn( NextInterceptor nextInterceptor, Name name, String newRn, boolean deleteOldRn )
+    public void modifyRn( NextInterceptor nextInterceptor, LdapDN name, String newRn, boolean deleteOldRn )
         throws NamingException
     {
-        name = parser.parse( name.toString() );
-        nextInterceptor.modifyRn( name, newRn, deleteOldRn );
+        LdapDN normalized = LdapDN.normalize( name );
+        nextInterceptor.modifyRn( normalized, newRn, deleteOldRn );
     }
 
 
-    public void move( NextInterceptor nextInterceptor, Name name, Name newParentName ) throws NamingException
+    public void move( NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName ) throws NamingException
     {
-        name = parser.parse( name.toString() );
-        newParentName = parser.parse( newParentName.toString() );
-        nextInterceptor.move( name, newParentName );
+        LdapDN normalized = LdapDN.normalize( name );
+        newParentName.normalize();
+        nextInterceptor.move( normalized, newParentName );
     }
 
 
-    public void move( NextInterceptor nextInterceptor, Name name, Name newParentName, String newRn, boolean deleteOldRn )
+    public void move( NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName, String newRn, boolean deleteOldRn )
         throws NamingException
     {
-        name = parser.parse( name.toString() );
-        newParentName = parser.parse( newParentName.toString() );
-        nextInterceptor.move( name, newParentName, newRn, deleteOldRn );
+        LdapDN normalized = LdapDN.normalize( name );
+        newParentName.normalize();
+        nextInterceptor.move( normalized, newParentName, newRn, deleteOldRn );
     }
 
 
-    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
     {
-        base = parser.parse( base.toString() );
+        base.normalize();
 
         if ( filter.isLeaf() )
         {
             LeafNode ln = ( LeafNode ) filter;
-            if ( !registry.hasAttributeType( ln.getAttribute() ) )
+            if ( !attributeRegistry.hasAttributeType( ln.getAttribute() ) )
             {
                 StringBuffer buf = new StringBuffer();
                 buf.append( "undefined filter based on undefined attributeType '" );
@@ -156,7 +157,52 @@
             }
         }
 
-        filter.accept( visitor );
+        boolean isFailure = true;
+        while ( isFailure && ( filter != null ) )
+        {
+            try
+            {
+                if ( filter.isLeaf() )
+                {
+                    LeafNode ln = ( LeafNode ) filter;
+                    if ( !attributeRegistry.hasAttributeType( ln.getAttribute() ) )
+                    {
+                        StringBuffer buf = new StringBuffer();
+                        buf.append( "undefined filter based on undefined attributeType '" );
+                        buf.append( ln.getAttribute() );
+                        buf.append( "' not evaluted at all.  Returning empty enumeration." );
+                        log.warn( buf.toString() );
+                        return new EmptyEnumeration();
+                    }
+                }
+
+                filter.accept( visitor );
+                isFailure = false;
+            }
+            catch( UndefinedFilterAttributeException e )
+            {
+                isFailure = true;
+                if ( log.isWarnEnabled() )
+                {
+                    log.warn( "An undefined attribute was found within the supplied search filter.  " +
+                            "The node associated with the filter has been removed.", e.getCause() );
+                }
+
+                // we can only get here if the filter is a branch node with only leaves
+                // note that in this case the undefined node will not be removed.
+                BranchNode bnode = ( BranchNode ) filter;
+                if ( bnode.isNegation() )
+                {
+                    return new EmptyEnumeration();
+                }
+                
+                bnode.getChildren().remove( e.getUndefinedFilterNode() );
+                if ( bnode.getChildren().size() < 2 )
+                {
+                    filter = bnode.getChild();
+                }
+            }
+        }
 
         // check that after pruning we have valid branch node at the top
         if ( !filter.isLeaf() )
@@ -181,37 +227,37 @@
     }
 
 
-    public boolean hasEntry( NextInterceptor nextInterceptor, Name name ) throws NamingException
+    public boolean hasEntry( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
-        name = parser.parse( name.toString() );
+        name = LdapDN.normalize( name );
         return nextInterceptor.hasEntry( name );
     }
 
 
-    public boolean isSuffix( NextInterceptor nextInterceptor, Name name ) throws NamingException
+    public boolean isSuffix( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
-        name = parser.parse( name.toString() );
+        name = LdapDN.normalize( name );
         return nextInterceptor.isSuffix( name );
     }
 
 
-    public NamingEnumeration list( NextInterceptor nextInterceptor, Name base ) throws NamingException
+    public NamingEnumeration list( NextInterceptor nextInterceptor, LdapDN base ) throws NamingException
     {
-        base = parser.parse( base.toString() );
+        base = LdapDN.normalize( base );
         return nextInterceptor.list( base );
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, Name name ) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
-        name = parser.parse( name.toString() );
+        name = LdapDN.normalize( name );
         return nextInterceptor.lookup( name );
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, Name name, String[] attrIds ) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds ) throws NamingException
     {
-        name = parser.parse( name.toString() );
+        name = LdapDN.normalize( name );
         return nextInterceptor.lookup( name, attrIds );
     }
 
@@ -220,65 +266,36 @@
     // Normalize all Name based arguments for other interface operations
     // ------------------------------------------------------------------------
 
-    public Name getMatchedName( NextInterceptor nextInterceptor, Name name, boolean normalized ) throws NamingException
+    public LdapDN getMatchedName ( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
-        name = parser.parse( name.toString() );
-        return nextInterceptor.getMatchedName( name, normalized );
+        name = LdapDN.normalize( name );
+        return nextInterceptor.getMatchedName( name );
     }
 
 
-    public Name getSuffix( NextInterceptor nextInterceptor, Name name, boolean normalized ) throws NamingException
+    public LdapDN getSuffix ( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
-        name = parser.parse( name.toString() );
-        return nextInterceptor.getSuffix( name, normalized );
+        name = LdapDN.normalize( name );
+        return nextInterceptor.getSuffix( name );
     }
 
 
-    public boolean compare( NextInterceptor next, Name name, String oid, Object value ) throws NamingException
+    public boolean compare( NextInterceptor next, LdapDN name, String oid, Object value ) throws NamingException
     {
-        name = parser.parse( name.toString() );
+        name = LdapDN.normalize( name );
         return next.compare( name, oid, value );
     }
 
-    /**
-     * A normalizer that normalizes each name component specifically according to
-     * the attribute type of the name component.
-     */
-    private class PerComponentNormalizer implements NameComponentNormalizer
-    {
-        public String normalizeByName( String name, String value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( name );
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
-
-
-        public String normalizeByName( String name, byte[] value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( name );
-
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
-
-
-        public String normalizeByOid( String oid, String value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( oid );
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
 
-
-        public boolean isDefined( String id )
-        {
-            return registry.hasAttributeType( id );
-        }
+    public void addContextPartition( NextInterceptor next, DirectoryPartitionConfiguration cfg ) throws NamingException
+    {
+        next.addContextPartition( cfg );
+    }
 
 
-        public String normalizeByOid( String oid, byte[] value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( oid );
-
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
+    public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
+    {
+        suffix = LdapDN.normalize( suffix );
+        next.removeContextPartition( suffix );
     }
 }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Tue Jun 13 20:22:05 2006
@@ -46,6 +46,7 @@
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.shared.ldap.util.DateUtils;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -107,7 +108,7 @@
     /**
      * Adds extra operational attributes to the entry before it is added.
      */
-    public void add( NextInterceptor nextInterceptor, String upName, Name normName, Attributes entry )
+    public void add(NextInterceptor nextInterceptor, LdapDN normName, Attributes entry)
         throws NamingException
     {
         String principal = getPrincipal().getName();
@@ -120,11 +121,11 @@
         attribute.add( DateUtils.getGeneralizedTime() );
         entry.put( attribute );
 
-        nextInterceptor.add( upName, normName, entry );
+        nextInterceptor.add(normName, entry );
     }
 
 
-    public void modify( NextInterceptor nextInterceptor, Name name, int modOp, Attributes attrs )
+    public void modify( NextInterceptor nextInterceptor, LdapDN name, int modOp, Attributes attrs )
         throws NamingException
     {
         nextInterceptor.modify( name, modOp, attrs );
@@ -143,7 +144,7 @@
     }
 
 
-    public void modify( NextInterceptor nextInterceptor, Name name, ModificationItem[] items ) throws NamingException
+    public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItem[] items ) throws NamingException
     {
         nextInterceptor.modify( name, items );
 
@@ -161,7 +162,7 @@
     }
 
 
-    public void modifyRn( NextInterceptor nextInterceptor, Name name, String newRn, boolean deleteOldRn )
+    public void modifyRn( NextInterceptor nextInterceptor, LdapDN name, String newRn, boolean deleteOldRn )
         throws NamingException
     {
         nextInterceptor.modifyRn( name, newRn, deleteOldRn );
@@ -176,12 +177,15 @@
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        Name newDn = name.getPrefix( 1 ).add( newRn );
+        LdapDN newDn = ( LdapDN ) name.clone();
+        newDn.remove( name.size() - 1 );
+        newDn.add( newRn );
+        newDn.normalize();
         nexus.modify( newDn, DirContext.REPLACE_ATTRIBUTE, attributes );
     }
 
 
-    public void move( NextInterceptor nextInterceptor, Name name, Name newParentName ) throws NamingException
+    public void move( NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName ) throws NamingException
     {
         nextInterceptor.move( name, newParentName );
 
@@ -199,7 +203,7 @@
     }
 
 
-    public void move( NextInterceptor nextInterceptor, Name name, Name newParentName, String newRn, boolean deleteOldRn )
+    public void move( NextInterceptor nextInterceptor, LdapDN name, LdapDN newParentName, String newRn, boolean deleteOldRn )
         throws NamingException
     {
         nextInterceptor.move( name, newParentName, newRn, deleteOldRn );
@@ -218,7 +222,7 @@
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, Name name ) throws NamingException
+    public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
     {
         Attributes result = nextInterceptor.lookup( name );
         if ( result == null )
@@ -230,7 +234,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 )
@@ -243,7 +247,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();
@@ -251,8 +255,8 @@
     }
 
 
-    public NamingEnumeration search( NextInterceptor nextInterceptor, Name base, Map env, ExprNode filter,
-        SearchControls searchCtls ) throws NamingException
+    public NamingEnumeration search( NextInterceptor nextInterceptor, LdapDN base, Map env, ExprNode filter,
+                                     SearchControls searchCtls ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         NamingEnumeration e = nextInterceptor.search( base, env, filter, searchCtls );

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractDirectoryPartition.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractDirectoryPartition.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractDirectoryPartition.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractDirectoryPartition.java Tue Jun 13 20:22:05 2006
@@ -20,7 +20,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.naming.Name;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -31,7 +30,7 @@
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.DirectoryPartitionConfiguration;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -50,6 +49,8 @@
     private DirectoryPartitionConfiguration cfg;
     /** <tt>true</tt> if and only if this partition is initialized. */
     private boolean initialized;
+    /** the normalized suffix DN for this partition */
+    private LdapDN suffixDn;
 
 
     protected AbstractDirectoryPartition()
@@ -161,23 +162,21 @@
     }
 
 
-    public final Name getSuffix( boolean normalized ) throws NamingException
+    public final LdapDN getSuffix() throws NamingException
     {
-        if ( normalized )
+        if ( suffixDn == null )
         {
-            return getConfiguration().getNormalizedSuffix(
-                getFactoryConfiguration().getGlobalRegistries().getMatchingRuleRegistry() );
-        }
-        else
-        {
-            return new LdapName( getConfiguration().getSuffix() );
+            suffixDn = new LdapDN( cfg.getSuffix() );
+            suffixDn.normalize();
         }
+
+        return suffixDn;
     }
 
 
-    public final boolean isSuffix( Name name ) throws NamingException
+    public final boolean isSuffix( LdapDN name ) throws NamingException
     {
-        return getSuffix( true ).equals( name ) || getSuffix( false ).equals( name );
+        return getSuffix().equals( name );
     }
 
 
@@ -190,11 +189,11 @@
 
 
     /**
-     * This method calls {@link #lookup(Name)} and return <tt>true</tt>
+     * This method calls {@link DirectoryPartition#lookup(org.apache.directory.shared.ldap.name.LdapDN)} and return <tt>true</tt>
      * if it returns an entry by default.  Please override this method if
      * there is more effective way for your implementation.
      */
-    public boolean hasEntry( Name name ) throws NamingException
+    public boolean hasEntry( LdapDN name ) throws NamingException
     {
         try
         {
@@ -208,11 +207,11 @@
 
 
     /**
-     * This method calls {@link DirectoryPartition#lookup(Name, String[])}
+     * This method calls {@link DirectoryPartition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[])}
      * with null <tt>attributeIds</tt> by default.  Please override
      * this method if there is more effective way for your implementation.
      */
-    public Attributes lookup( Name name ) throws NamingException
+    public Attributes lookup( LdapDN name ) throws NamingException
     {
         return lookup( name, null );
     }
@@ -220,12 +219,12 @@
 
     /**
      * This method forwards the request to
-     * {@link DirectoryPartition#modify(Name, ModificationItem[])} after
+     * {@link DirectoryPartition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])} after
      * translating parameters to {@link ModificationItem}<tt>[]</tt> by default.
      * Please override this method if there is more effactive way for your
      * implementation.
      */
-    public void modify( Name name, int modOp, Attributes mods ) throws NamingException
+    public void modify( LdapDN name, int modOp, Attributes mods ) throws NamingException
     {
         List items = new ArrayList( mods.size() );
         NamingEnumeration e = mods.getAll();
@@ -241,14 +240,14 @@
 
 
     /**
-     * This method calls {@link DirectoryPartition#move(Name, Name)} and
-     * {@link DirectoryPartition#modifyRn(Name, String, boolean)} subsequently
+     * This method calls {@link DirectoryPartition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN)} and
+     * {@link DirectoryPartition#modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean)} subsequently
      * by default.  Please override this method if there is more effactive
      * way for your implementation.
      */
-    public void move( Name oldName, Name newParentName, String newRn, boolean deleteOldRn ) throws NamingException
+    public void move( LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException
     {
-        Name newName = ( Name ) newParentName.clone();
+        LdapDN newName = ( LdapDN ) newParentName.clone();
         newName.add( newRn );
         move( oldName, newParentName );
         modifyRn( newName, newRn, deleteOldRn );
@@ -259,7 +258,7 @@
      * This method throws {@link OperationNotSupportedException} by default.
      * Please override this method to implement move operation.
      */
-    public void move( Name oldName, Name newParentName ) throws NamingException
+    public void move( LdapDN oldName, LdapDN newParentName ) throws NamingException
     {
         throw new OperationNotSupportedException( "Moving an entry to other parent entry is not supported." );
     }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultDirectoryPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultDirectoryPartitionNexus.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultDirectoryPartitionNexus.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultDirectoryPartitionNexus.java Tue Jun 13 20:22:05 2006
@@ -30,7 +30,6 @@
 import java.util.Set;
 
 import javax.naming.ConfigurationException;
-import javax.naming.Name;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -60,7 +59,7 @@
 import org.apache.directory.shared.ldap.message.PersistentSearchControl;
 import org.apache.directory.shared.ldap.message.SubentriesControl;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
-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.Normalizer;
 import org.apache.directory.shared.ldap.util.DateUtils;
@@ -244,6 +243,7 @@
         indexedSystemAttrs.add( Oid.ONEALIAS );
         indexedSystemAttrs.add( Oid.SUBALIAS );
         indexedSystemAttrs.add( Oid.UPDN );
+        indexedSystemAttrs.add( "objectClass" );
         systemCfg.setIndexedAttributes( indexedSystemAttrs );
 
         // Add context entry for system partition
@@ -259,7 +259,7 @@
         systemCfg.setContextEntry( systemEntry );
 
         system.init( factoryCfg, systemCfg );
-        String key = system.getSuffix( true ).toString();
+        String key = system.getSuffix().toString();
         if ( partitions.containsKey( key ) )
         {
             throw new ConfigurationException( "Duplicate partition suffix: " + key );
@@ -267,7 +267,7 @@
         partitions.put( key, system );
 
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.add( system.getSuffix( false ).toString() );
+        namingContexts.add( system.getUpSuffix().toString() );
 
         return systemCfg;
     }
@@ -295,7 +295,7 @@
             String suffix = ( String ) suffixes.next();
             try
             {
-                removeContextPartition( new LdapName( suffix ) );
+                removeContextPartition( new LdapDN( suffix ) );
             }
             catch ( NamingException e )
             {
@@ -348,7 +348,7 @@
     // ContextPartitionNexus Method Implementations
     // ------------------------------------------------------------------------
 
-    public boolean compare( Name name, String oid, Object value ) throws NamingException
+    public boolean compare( LdapDN name, String oid, Object value ) throws NamingException
     {
         DirectoryPartition partition = getBackend( name );
         AttributeTypeRegistry registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
@@ -425,14 +425,14 @@
         }
 
         partition.init( factoryCfg, config );
-        partitions.put( partition.getSuffix( true ).toString(), partition );
+        partitions.put( partition.getSuffix().toString(), partition );
 
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.add( partition.getSuffix( false ).toString() );
+        namingContexts.add( partition.getUpSuffix() );
     }
 
 
-    public synchronized void removeContextPartition( Name suffix ) throws NamingException
+    public synchronized void removeContextPartition( LdapDN suffix ) throws NamingException
     {
         String key = suffix.toString();
         DirectoryPartition partition = ( DirectoryPartition ) partitions.get( key );
@@ -442,7 +442,7 @@
         }
 
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.remove( partition.getSuffix( false ).toString() );
+        namingContexts.remove( partition.getUpSuffix() );
         partitions.remove( key );
 
         partition.sync();
@@ -466,11 +466,11 @@
 
 
     /**
-     * @see DirectoryPartitionNexus#getMatchedName(javax.naming.Name, boolean)
+     * @see DirectoryPartitionNexus#getMatchedName(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public Name getMatchedName( Name dn, boolean normalized ) throws NamingException
+    public LdapDN getMatchedName ( LdapDN dn ) throws NamingException
     {
-        dn = ( Name ) dn.clone();
+        dn = ( LdapDN ) dn.clone();
         while ( dn.size() > 0 )
         {
             if ( hasEntry( dn ) )
@@ -478,33 +478,38 @@
                 return dn;
             }
 
-            dn = dn.getPrefix( 1 );
+            dn.remove( dn.size() - 1 );
         }
 
         return dn;
     }
 
 
-    public Name getSuffix( boolean normalized )
+    public LdapDN getSuffix()
     {
-        return new LdapName();
+        return LdapDN.EMPTY_LDAPDN;
+    }
+
+    public LdapDN getUpSuffix()
+    {
+        return LdapDN.EMPTY_LDAPDN;
     }
 
 
     /**
-     * @see org.apache.directory.server.core.partition.DirectoryPartitionNexus#getSuffix(javax.naming.Name, boolean)
+     * @see DirectoryPartitionNexus#getSuffix(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public Name getSuffix( Name dn, boolean normalized ) throws NamingException
+    public LdapDN getSuffix ( LdapDN dn ) throws NamingException
     {
         DirectoryPartition backend = getBackend( dn );
-        return backend.getSuffix( normalized );
+        return backend.getSuffix();
     }
 
 
     /**
-     * @see org.apache.directory.server.core.partition.DirectoryPartitionNexus#listSuffixes(boolean)
+     * @see DirectoryPartitionNexus#listSuffixes()
      */
-    public Iterator listSuffixes( boolean normalized ) throws NamingException
+    public Iterator listSuffixes () throws NamingException
     {
         return Collections.unmodifiableSet( partitions.keySet() ).iterator();
     }
@@ -531,8 +536,8 @@
     private void unregister( DirectoryPartition partition ) throws NamingException
     {
         Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-        namingContexts.remove( partition.getSuffix( false ).toString() );
-        partitions.remove( partition.getSuffix( true ).toString() );
+        namingContexts.remove( partition.getSuffix().toString() );
+        partitions.remove( partition.getSuffix().toString() );
     }
 
 
@@ -540,14 +545,14 @@
     // DirectoryPartition Interface Method Implementations
     // ------------------------------------------------------------------------
 
-    public void bind( Name bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException
+    public void bind( LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException
     {
         DirectoryPartition partition = getBackend( bindDn );
         partition.bind( bindDn, credentials, mechanisms, saslAuthId );
     }
 
 
-    public void unbind( Name bindDn ) throws NamingException
+    public void unbind( LdapDN bindDn ) throws NamingException
     {
         DirectoryPartition partition = getBackend( bindDn );
         partition.unbind( bindDn );
@@ -555,9 +560,9 @@
 
 
     /**
-     * @see DirectoryPartition#delete(javax.naming.Name)
+     * @see DirectoryPartition#delete(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public void delete( Name dn ) throws NamingException
+    public void delete( LdapDN dn ) throws NamingException
     {
         DirectoryPartition backend = getBackend( dn );
         backend.delete( dn );
@@ -571,19 +576,19 @@
      * here so backend implementors do not have to worry about performing these
      * kinds of checks.
      *
-     * @see org.apache.directory.server.core.partition.DirectoryPartition#add(String, Name, Attributes)
+     * @see DirectoryPartition#add(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.Attributes)
      */
-    public void add( String updn, Name dn, Attributes an_entry ) throws NamingException
+    public void add( LdapDN dn, Attributes entry ) throws NamingException
     {
         DirectoryPartition backend = getBackend( dn );
-        backend.add( updn, dn, an_entry );
+        backend.add( dn, entry );
     }
 
 
     /**
-     * @see DirectoryPartition#modify(Name, int,Attributes)
+     * @see DirectoryPartition#modify(org.apache.directory.shared.ldap.name.LdapDN,int,javax.naming.directory.Attributes)
      */
-    public void modify( Name dn, int modOp, Attributes mods ) throws NamingException
+    public void modify( LdapDN dn, int modOp, Attributes mods ) throws NamingException
     {
         DirectoryPartition backend = getBackend( dn );
         backend.modify( dn, modOp, mods );
@@ -591,10 +596,9 @@
 
 
     /**
-     * @see DirectoryPartition#modify(javax.naming.Name,
-     * javax.naming.directory.ModificationItem[])
+     * @see DirectoryPartition#modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[])
      */
-    public void modify( Name dn, ModificationItem[] mods ) throws NamingException
+    public void modify( LdapDN dn, ModificationItem[] mods ) throws NamingException
     {
         DirectoryPartition backend = getBackend( dn );
         backend.modify( dn, mods );
@@ -602,9 +606,9 @@
 
 
     /**
-     * @see DirectoryPartition#list(javax.naming.Name)
+     * @see DirectoryPartition#list(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public NamingEnumeration list( Name base ) throws NamingException
+    public NamingEnumeration list( LdapDN base ) throws NamingException
     {
         DirectoryPartition backend = getBackend( base );
         return backend.list( base );
@@ -612,16 +616,18 @@
 
 
     /**
-     * @see DirectoryPartition#search(Name, Map, ExprNode, SearchControls)
+     * @see DirectoryPartition#search(org.apache.directory.shared.ldap.name.LdapDN,java.util.Map,org.apache.directory.shared.ldap.filter.ExprNode,javax.naming.directory.SearchControls)
      */
-    public NamingEnumeration search( Name base, Map env, ExprNode filter, SearchControls searchCtls )
+    public NamingEnumeration search( LdapDN base, Map env, ExprNode filter, SearchControls searchCtls )
         throws NamingException
     {
 
         if ( base.size() == 0 )
         {
             boolean isObjectScope = searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE;
-            boolean isSearchAll = ( ( PresenceNode ) filter ).getAttribute().equalsIgnoreCase( "objectclass" );
+            
+            // test for (objectClass=*)
+            boolean isSearchAll = ( ( PresenceNode ) filter ).getAttribute().equalsIgnoreCase( "2.5.4.0" );
 
             /*
              * if basedn is "", filter is "(objectclass=*)" and scope is object
@@ -670,9 +676,9 @@
 
 
     /**
-     * @see DirectoryPartition#lookup(javax.naming.Name)
+     * @see DirectoryPartition#lookup(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public Attributes lookup( Name dn ) throws NamingException
+    public Attributes lookup( LdapDN dn ) throws NamingException
     {
         if ( dn.size() == 0 )
         {
@@ -685,9 +691,9 @@
 
 
     /**
-     * @see org.apache.directory.server.core.partition.DirectoryPartition#lookup(javax.naming.Name, String[])
+     * @see DirectoryPartition#lookup(org.apache.directory.shared.ldap.name.LdapDN,String[])
      */
-    public Attributes lookup( Name dn, String[] attrIds ) throws NamingException
+    public Attributes lookup( LdapDN dn, String[] attrIds ) throws NamingException
     {
         if ( dn.size() == 0 )
         {
@@ -708,9 +714,9 @@
 
 
     /**
-     * @see DirectoryPartition#hasEntry(javax.naming.Name)
+     * @see DirectoryPartition#hasEntry(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public boolean hasEntry( Name dn ) throws NamingException
+    public boolean hasEntry( LdapDN dn ) throws NamingException
     {
         if ( log.isDebugEnabled() )
         {
@@ -728,18 +734,18 @@
 
 
     /**
-     * @see DirectoryPartition#isSuffix(javax.naming.Name)
+     * @see DirectoryPartition#isSuffix(org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public boolean isSuffix( Name dn )
+    public boolean isSuffix( LdapDN dn )
     {
         return partitions.containsKey( dn.toString() );
     }
 
 
     /**
-     * @see DirectoryPartition#modifyRn(Name, String, boolean)
+     * @see DirectoryPartition#modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean)
      */
-    public void modifyRn( Name dn, String newRdn, boolean deleteOldRdn ) throws NamingException
+    public void modifyRn( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws NamingException
     {
         DirectoryPartition backend = getBackend( dn );
         backend.modifyRn( dn, newRdn, deleteOldRdn );
@@ -747,9 +753,9 @@
 
 
     /**
-     * @see DirectoryPartition#move(Name, Name)
+     * @see DirectoryPartition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN)
      */
-    public void move( Name oriChildName, Name newParentName ) throws NamingException
+    public void move( LdapDN oriChildName, LdapDN newParentName ) throws NamingException
     {
         DirectoryPartition backend = getBackend( oriChildName );
         backend.move( oriChildName, newParentName );
@@ -757,10 +763,9 @@
 
 
     /**
-     * @see DirectoryPartition#move(javax.naming.Name,
-     * javax.naming.Name, java.lang.String, boolean)
+     * @see DirectoryPartition#move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN,String,boolean)
      */
-    public void move( Name oldChildDn, Name newParentDn, String newRdn, boolean deleteOldRdn ) throws NamingException
+    public void move( LdapDN oldChildDn, LdapDN newParentDn, String newRdn, boolean deleteOldRdn ) throws NamingException
     {
         DirectoryPartition backend = getBackend( oldChildDn );
         backend.move( oldChildDn, newParentDn, newRdn, deleteOldRdn );
@@ -778,9 +783,9 @@
      * @return the backend partition associated with the normalized dn
      * @throws NamingException if the name cannot be resolved to a backend
      */
-    private DirectoryPartition getBackend( Name dn ) throws NamingException
+    private DirectoryPartition getBackend( LdapDN dn ) throws NamingException
     {
-        Name clonedDn = ( Name ) dn.clone();
+        LdapDN clonedDn = ( LdapDN ) dn.clone();
         while ( clonedDn.size() > 0 )
         {
             if ( partitions.containsKey( clonedDn.toString() ) )
@@ -790,11 +795,11 @@
 
             clonedDn.remove( clonedDn.size() - 1 );
         }
-        throw new NameNotFoundException( dn.toString() );
+        throw new LdapNameNotFoundException( dn.toUpName() );
     }
 
 
-    public DirectoryPartition getPartition( Name dn ) throws NamingException
+    public DirectoryPartition getPartition( LdapDN dn ) throws NamingException
     {
         return getBackend( dn );
     }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DirectoryPartition.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DirectoryPartition.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DirectoryPartition.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DirectoryPartition.java Tue Jun 13 20:22:05 2006
@@ -21,7 +21,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.Attributes;
@@ -32,6 +31,7 @@
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.DirectoryPartitionConfiguration;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -50,7 +50,7 @@
     /** The objectClass name for aliases: 'alias' */
     String ALIAS_OBJECT = "alias";
 
-    /** 
+    /**
      * The aliased Dn attribute name: aliasedObjectName for LDAP and
      * aliasedEntryName or X.500.
      */
@@ -85,14 +85,19 @@
      * Gets the distinguished/absolute name of the suffix for all entries
      * stored within this ContextPartition.
      *
-     * @param normalized boolean value used to control the normalization of the
-     * returned Name.  If true the normalized Name is returned, otherwise the 
-     * original user provided Name without normalization is returned.
      * @return Name representing the distinguished/absolute name of this
      * ContextPartitions root context.
      */
-    Name getSuffix( boolean normalized ) throws NamingException;
+    LdapDN getSuffix() throws NamingException;
 
+    /**
+     * Gets the distinguished/absolute name of the suffix for all entries
+     * stored within this ContextPartition.
+     *
+     * @return Name representing the distinguished/absolute name of this
+     * ContextPartitions root context.
+     */
+    LdapDN getUpSuffix() throws NamingException;
 
     /**
      * Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be 
@@ -102,18 +107,17 @@
      * delete from this ContextPartition.
      * @throws NamingException if there are any problems
      */
-    void delete( Name name ) throws NamingException;
+    void delete( LdapDN name ) throws NamingException;
 
 
     /**
      * Adds an entry to this ContextPartition.
      *
-     * @param userProvidedName the user provided distinguished/absolute name of the entry
-     * @param normalizedName the normalized distinguished/absolute name of the entry
+     * @param name
      * @param entry the entry to add to this ContextPartition
      * @throws NamingException if there are any problems
      */
-    void add( String userProvidedName, Name normalizedName, Attributes entry ) throws NamingException;
+    void add( LdapDN name, Attributes entry ) throws NamingException;
 
 
     /**
@@ -132,7 +136,7 @@
      * @see javax.naming.directory.DirContext#REMOVE_ATTRIBUTE
      * @see javax.naming.directory.DirContext#REPLACE_ATTRIBUTE
      */
-    void modify( Name name, int modOp, Attributes attributes ) throws NamingException;
+    void modify( LdapDN name, int modOp, Attributes attributes ) throws NamingException;
 
 
     /**
@@ -144,7 +148,7 @@
      * @throws NamingException if there are any problems
      * @see ModificationItem
      */
-    void modify( Name name, ModificationItem[] items ) throws NamingException;
+    void modify( LdapDN name, ModificationItem[] items ) throws NamingException;
 
 
     /**
@@ -157,7 +161,7 @@
      * @return a NamingEnumeration containing objects of type {@link SearchResult}
      * @throws NamingException if there are any problems
      */
-    NamingEnumeration list( Name baseName ) throws NamingException;
+    NamingEnumeration list( LdapDN baseName ) throws NamingException;
 
 
     /**
@@ -177,7 +181,7 @@
      * <a href="http://java.sun.com/j2se/1.4.2/docs/api/
      * javax/naming/directory/SearchResult.html">SearchResult</a>.
      */
-    NamingEnumeration search( Name baseName, Map environment, ExprNode filter, SearchControls searchControls )
+    NamingEnumeration search( LdapDN baseName, Map environment, ExprNode filter, SearchControls searchControls )
         throws NamingException;
 
 
@@ -190,7 +194,7 @@
      * @return an Attributes object representing the entry
      * @throws NamingException if there are any problems
      */
-    Attributes lookup( Name name ) throws NamingException;
+    Attributes lookup( LdapDN name ) throws NamingException;
 
 
     /**
@@ -204,7 +208,7 @@
      * @return an Attributes object representing the entry
      * @throws NamingException if there are any problems
      */
-    Attributes lookup( Name name, String[] attrIds ) throws NamingException;
+    Attributes lookup( LdapDN name, String[] attrIds ) throws NamingException;
 
 
     /**
@@ -215,7 +219,7 @@
      * @return true if the entry exists, false if it does not
      * @throws NamingException if there are any problems
      */
-    boolean hasEntry( Name name ) throws NamingException;
+    boolean hasEntry( LdapDN name ) throws NamingException;
 
 
     /**
@@ -225,7 +229,7 @@
      * @return true if the name is a context suffix, false if it is not.
      * @throws NamingException if there are any problems
      */
-    boolean isSuffix( Name name ) throws NamingException;
+    boolean isSuffix( LdapDN name ) throws NamingException;
 
 
     /**
@@ -241,20 +245,20 @@
      * from the entry if set to true, and has no affect if set to false
      * @throws NamingException if there are any problems
      */
-    void modifyRn( Name name, String newRn, boolean deleteOldRn ) throws NamingException;
+    void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException;
 
 
     /**
      * Transplants a child entry, to a position in the namespace under a new
      * parent entry.
      *
-     * @param newParentName the normalized distinguished/absolute name of the
-     * new parent to move the target entry to
      * @param oldName the normalized distinguished/absolute name of the
      * original child name representing the child entry to move
+     * @param newParentName the normalized distinguished/absolute name of the
+     * new parent to move the target entry to
      * @throws NamingException if there are any problems
      */
-    void move( Name oldName, Name newParentName ) throws NamingException;
+    void move( LdapDN oldName, LdapDN newParentName ) throws NamingException;
 
 
     /**
@@ -274,7 +278,7 @@
      * from the entry if set to true, and has no affect if set to false
      * @throws NamingException if there are any problems
      */
-    void move( Name oldName, Name newParentName, String newRn, boolean deleteOldRn ) throws NamingException;
+    void move( LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException;
 
 
     /**
@@ -282,14 +286,14 @@
      * need not support this operation.  This operation is here to enable those
      * interested in implementing virtual directories with ApacheDS.
      * 
-     * @param bindDn the normalized dn of the principal 
+     * @param bindDn the normalized dn of the principal
      * @param credentials the credentials of the principal
      * @param mechanisms the mechanisms requested by the JNDI caller or a single
      * mechanism representing the SASL bind mechanism used by a networked client (Strings)
      * @param saslAuthId the SASL authentication (may be null)
      * @throws NamingException if something goes wrong
      */
-    void bind( Name bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException;
+    void bind( LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException;
 
 
     /**
@@ -300,5 +304,5 @@
      * @param bindDn the normalized dn of the principal attempting to unbind
      * @throws NamingException if something goes wrong
      */
-    void unbind( Name bindDn ) throws NamingException;
+    void unbind( LdapDN bindDn ) throws NamingException;
 }



Mime
View raw message