directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r355412 - in /directory/apacheds: branches/DN-refactoring/ branches/DN-refactoring/core-unit/ branches/DN-refactoring/core-unit/src/test/java/org/apache/ldap/server/authz/ branches/DN-refactoring/core/ branches/DN-refactoring/core/src/main/...
Date Fri, 09 Dec 2005 08:28:32 GMT
Author: elecharny
Date: Fri Dec  9 00:26:34 2005
New Revision: 355412

URL: http://svn.apache.org/viewcvs?rev=355412&view=rev
Log:
Creating a branch to work on a refactored DN

Added:
    directory/apacheds/branches/DN-refactoring/
      - copied from r354930, directory/apacheds/trunk/
    directory/apacheds/branches/DN-refactoring/core/
      - copied from r355143, directory/apacheds/trunk/core/
    directory/apacheds/branches/DN-refactoring/core-unit/
      - copied from r355143, directory/apacheds/trunk/core-unit/
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java
      - copied unchanged from r355239, directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/partition/DefaultDirectoryPartitionNexus.java
      - copied unchanged from r355241, directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/DefaultDirectoryPartitionNexus.java
    directory/apacheds/branches/DN-refactoring/plugin/
      - copied from r355144, directory/apacheds/trunk/plugin/
    directory/apacheds/branches/DN-refactoring/server/
      - copied from r355143, directory/apacheds/trunk/server/
    directory/apacheds/branches/DN-refactoring/server-main/
      - copied from r355143, directory/apacheds/trunk/server-main/
    directory/apacheds/branches/DN-refactoring/server-unit/
      - copied from r355143, directory/apacheds/trunk/server-unit/
    directory/apacheds/branches/DN-refactoring/shared/
      - copied from r355143, directory/apacheds/trunk/shared/
Modified:
    directory/apacheds/branches/DN-refactoring/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java
    directory/apacheds/trunk/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
    directory/apacheds/trunk/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java

Modified: directory/apacheds/branches/DN-refactoring/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java?rev=355412&r1=355143&r2=355412&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
Fri Dec  9 00:26:34 2005
@@ -214,4 +214,23 @@
         // should work with billyd now that all users are authorized
         assertTrue( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309"
) );
     }
+    
+    public void testPasswordCompare() throws NamingException {
+        DirContext adminCtx = getContextAsAdmin();
+        Attributes user = new BasicAttributes( "uid", "bob", true );
+        user.put( "userPassword", "bobspassword".getBytes() );
+        Attribute objectClass = new BasicAttribute( "objectClass" );
+        user.put( objectClass );
+        objectClass.add( "top" );
+        objectClass.add( "person" );
+        objectClass.add( "organizationalPerson" );
+        objectClass.add( "inetOrgPerson" );
+        user.put( "sn", "bob" );
+        user.put( "cn", "bob" );
+        adminCtx.createSubcontext( "uid=bob,ou=users", user );
+
+        ServerLdapContext ctx = ( ServerLdapContext ) adminCtx.lookup( "" );
+        assertTrue(ctx.compare(new LdapName( "uid=bob,ou=users,ou=system"), "userPassword",
"bobspassword"));
+    }
+    
 }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java?rev=355412&r1=355143&r2=355412&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
Fri Dec  9 00:26:34 2005
@@ -16,8 +16,10 @@
  */
 package org.apache.ldap.server;
 
+import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.Set;
 import java.util.HashSet;
 
@@ -33,6 +35,7 @@
 import org.apache.ldap.common.message.LockableAttributeImpl;
 import org.apache.ldap.common.message.LockableAttributesImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
+import org.apache.ldap.common.name.DnOidContainer;
 import org.apache.ldap.common.name.DnParser;
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.name.NameComponentNormalizer;
@@ -94,8 +97,7 @@
     
     /** whether or not this instance has been shutdown */
     private boolean started = false;
-
-
+    
     // ------------------------------------------------------------------------
     // Constructor
     // ------------------------------------------------------------------------
@@ -179,13 +181,13 @@
 
     public synchronized void startup( DirectoryServiceListener listener, Hashtable env )
throws NamingException
     {
-        Hashtable envCopy = ( Hashtable ) env.clone();
-
         if( started )
         {
             return;
         }
 
+        Hashtable envCopy = ( Hashtable ) env.clone();
+
         StartupConfiguration cfg = ( StartupConfiguration ) Configuration.toConfiguration(
env );
         envCopy.put( Context.PROVIDER_URL, "" );
         
@@ -658,14 +660,21 @@
      */
     private void initialize() throws NamingException
     {
-        // --------------------------------------------------------------------
+    	if ( log.isDebugEnabled() )
+    	{
+    		log.debug( "---> Initializing the DefaultDirectoryService " );
+    	}
+
+    	// --------------------------------------------------------------------
         // Load the schema here and check that it is ok!
         // --------------------------------------------------------------------
 
         BootstrapRegistries bootstrapRegistries = new BootstrapRegistries();
 
         BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
+        
         loader.load( startupConfiguration.getBootstrapSchemas(), bootstrapRegistries );
+        DnOidContainer.setOidByName( bootstrapRegistries.getOidRegistry().getOidByName()
);
 
         java.util.List errors = bootstrapRegistries.checkRefInteg();
         if ( !errors.isEmpty() )
@@ -746,5 +755,10 @@
         
         interceptorChain = new InterceptorChain();
         interceptorChain.init( configuration );
+        
+    	if ( log.isDebugEnabled() )
+    	{
+    		log.debug( "<--- DefaultDirectoryService initialized" );
+    	}
     }
 }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java?rev=355412&r1=355143&r2=355412&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
Fri Dec  9 00:26:34 2005
@@ -383,7 +383,7 @@
                 e = new LdapNameNotFoundException( dn.toString() );
             }
 
-            e.setResolvedName( proxy.getMatchedName( dn, false ) );
+            e.setResolvedName( proxy.getMatchedName( dn.getSuffix( 1 ), false ) );
             throw e;
         }
     }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java?rev=355412&r1=355143&r2=355412&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
Fri Dec  9 00:26:34 2005
@@ -43,6 +43,7 @@
 import javax.naming.spi.DirStateFactory;
 import javax.naming.spi.DirectoryManager;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.exception.LdapNoPermissionException;
 import org.apache.ldap.common.filter.ExprNode;
 import org.apache.ldap.common.filter.PresenceNode;
@@ -567,7 +568,14 @@
      */
     public Object lookup( String name ) throws NamingException
     {
-        return lookup( new LdapName( name ) );
+    	if ( StringUtils.isEmpty( name ) )
+    	{
+    		return lookup( LdapName.EMPTY_LDAP_NAME );
+    	}
+    	else
+    	{
+    		return lookup( new LdapName( name ) );
+    	}
     }
 
 

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java?rev=355412&r1=355143&r2=355412&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
Fri Dec  9 00:26:34 2005
@@ -22,6 +22,7 @@
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -395,6 +396,24 @@
         byOid.put( oid, value );
 
         monitor.registered( name, oid );
+    }
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getOidByName()
+    {
+    	return byName;
+    }
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getNameByOid()
+    {
+    	return byOid;
     }
 }
 

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java?rev=355412&r1=355143&r2=355412&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java
Fri Dec  9 00:26:34 2005
@@ -19,6 +19,7 @@
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -87,4 +88,16 @@
      * @param oid the OID to add or associate a new name with
      */
     void register( String name, String oid );
+    
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getOidByName();
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getNameByOid();
 }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java?rev=355412&r1=355143&r2=355412&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
Fri Dec  9 00:26:34 2005
@@ -19,9 +19,11 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -40,9 +42,11 @@
 public class BootstrapOidRegistry implements OidRegistry
 { 
     /** Maps OID to a name or a list of names if more than one name exists */
-    private Hashtable byOid = new Hashtable();
+    private Map byOid = new HashMap();
+    
     /** Maps several names to an OID */
-    private Hashtable byName = new Hashtable();
+    private Map byName = new HashMap();
+    
     /** Default OidRegistryMonitor */
     private OidRegistryMonitor monitor = new OidRegistryMonitorAdapter();
     
@@ -176,7 +180,24 @@
     {
         return Collections.unmodifiableSet( byOid.keySet() ).iterator();
     }
+    
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getOidByName()
+    {
+    	return byName;
+    }
 
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getNameByOid()
+    {
+    	return byOid;
+    }
 
     /**
      * @see org.apache.ldap.server.schema.OidRegistry#register(String, String)

Modified: directory/apacheds/branches/DN-refactoring/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java?rev=355412&r1=355143&r2=355412&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java
Fri Dec  9 00:26:34 2005
@@ -21,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -66,6 +67,24 @@
     public void register( String name, String oid )
     {
         // Not used
+    }
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getOidByName()
+    {
+    	return null;
+    }
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getNameByOid()
+    {
+    	return null;
     }
     
 }

Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java?rev=355412&r1=355411&r2=355412&view=diff
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
Fri Dec  9 00:26:34 2005
@@ -214,4 +214,23 @@
         // should work with billyd now that all users are authorized
         assertTrue( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309"
) );
     }
+    
+    public void testPasswordCompare() throws NamingException {
+        DirContext adminCtx = getContextAsAdmin();
+        Attributes user = new BasicAttributes( "uid", "bob", true );
+        user.put( "userPassword", "bobspassword".getBytes() );
+        Attribute objectClass = new BasicAttribute( "objectClass" );
+        user.put( objectClass );
+        objectClass.add( "top" );
+        objectClass.add( "person" );
+        objectClass.add( "organizationalPerson" );
+        objectClass.add( "inetOrgPerson" );
+        user.put( "sn", "bob" );
+        user.put( "cn", "bob" );
+        adminCtx.createSubcontext( "uid=bob,ou=users", user );
+
+        ServerLdapContext ctx = ( ServerLdapContext ) adminCtx.lookup( "" );
+        assertTrue(ctx.compare(new LdapName( "uid=bob,ou=users,ou=system"), "userPassword",
"bobspassword"));
+    }
+    
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java?rev=355412&r1=355411&r2=355412&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/DefaultDirectoryService.java
Fri Dec  9 00:26:34 2005
@@ -16,8 +16,10 @@
  */
 package org.apache.ldap.server;
 
+import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.Set;
 import java.util.HashSet;
 
@@ -33,6 +35,7 @@
 import org.apache.ldap.common.message.LockableAttributeImpl;
 import org.apache.ldap.common.message.LockableAttributesImpl;
 import org.apache.ldap.common.message.ResultCodeEnum;
+import org.apache.ldap.common.name.DnOidContainer;
 import org.apache.ldap.common.name.DnParser;
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.name.NameComponentNormalizer;
@@ -94,8 +97,7 @@
     
     /** whether or not this instance has been shutdown */
     private boolean started = false;
-
-
+    
     // ------------------------------------------------------------------------
     // Constructor
     // ------------------------------------------------------------------------
@@ -179,13 +181,13 @@
 
     public synchronized void startup( DirectoryServiceListener listener, Hashtable env )
throws NamingException
     {
-        Hashtable envCopy = ( Hashtable ) env.clone();
-
         if( started )
         {
             return;
         }
 
+        Hashtable envCopy = ( Hashtable ) env.clone();
+
         StartupConfiguration cfg = ( StartupConfiguration ) Configuration.toConfiguration(
env );
         envCopy.put( Context.PROVIDER_URL, "" );
         
@@ -658,14 +660,21 @@
      */
     private void initialize() throws NamingException
     {
-        // --------------------------------------------------------------------
+    	if ( log.isDebugEnabled() )
+    	{
+    		log.debug( "---> Initializing the DefaultDirectoryService " );
+    	}
+
+    	// --------------------------------------------------------------------
         // Load the schema here and check that it is ok!
         // --------------------------------------------------------------------
 
         BootstrapRegistries bootstrapRegistries = new BootstrapRegistries();
 
         BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
+        
         loader.load( startupConfiguration.getBootstrapSchemas(), bootstrapRegistries );
+        DnOidContainer.setOidByName( bootstrapRegistries.getOidRegistry().getOidByName()
);
 
         java.util.List errors = bootstrapRegistries.checkRefInteg();
         if ( !errors.isEmpty() )
@@ -746,5 +755,10 @@
         
         interceptorChain = new InterceptorChain();
         interceptorChain.init( configuration );
+        
+    	if ( log.isDebugEnabled() )
+    	{
+    		log.debug( "<--- DefaultDirectoryService initialized" );
+    	}
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java?rev=355412&r1=355411&r2=355412&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
Fri Dec  9 00:26:34 2005
@@ -383,7 +383,7 @@
                 e = new LdapNameNotFoundException( dn.toString() );
             }
 
-            e.setResolvedName( proxy.getMatchedName( dn, false ) );
+            e.setResolvedName( proxy.getMatchedName( dn.getSuffix( 1 ), false ) );
             throw e;
         }
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java?rev=355412&r1=355411&r2=355412&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
Fri Dec  9 00:26:34 2005
@@ -43,6 +43,7 @@
 import javax.naming.spi.DirStateFactory;
 import javax.naming.spi.DirectoryManager;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.exception.LdapNoPermissionException;
 import org.apache.ldap.common.filter.ExprNode;
 import org.apache.ldap.common.filter.PresenceNode;
@@ -567,7 +568,14 @@
      */
     public Object lookup( String name ) throws NamingException
     {
-        return lookup( new LdapName( name ) );
+    	if ( StringUtils.isEmpty( name ) )
+    	{
+    		return lookup( LdapName.EMPTY_LDAP_NAME );
+    	}
+    	else
+    	{
+    		return lookup( new LdapName( name ) );
+    	}
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java?rev=355412&r1=355411&r2=355412&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/GlobalOidRegistry.java
Fri Dec  9 00:26:34 2005
@@ -22,6 +22,7 @@
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -395,6 +396,24 @@
         byOid.put( oid, value );
 
         monitor.registered( name, oid );
+    }
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getOidByName()
+    {
+    	return byName;
+    }
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getNameByOid()
+    {
+    	return byOid;
     }
 }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java?rev=355412&r1=355411&r2=355412&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/OidRegistry.java
Fri Dec  9 00:26:34 2005
@@ -19,6 +19,7 @@
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -87,4 +88,16 @@
      * @param oid the OID to add or associate a new name with
      */
     void register( String name, String oid );
+    
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getOidByName();
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getNameByOid();
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java?rev=355412&r1=355411&r2=355412&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapOidRegistry.java
Fri Dec  9 00:26:34 2005
@@ -19,9 +19,11 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -40,9 +42,11 @@
 public class BootstrapOidRegistry implements OidRegistry
 { 
     /** Maps OID to a name or a list of names if more than one name exists */
-    private Hashtable byOid = new Hashtable();
+    private Map byOid = new HashMap();
+    
     /** Maps several names to an OID */
-    private Hashtable byName = new Hashtable();
+    private Map byName = new HashMap();
+    
     /** Default OidRegistryMonitor */
     private OidRegistryMonitor monitor = new OidRegistryMonitorAdapter();
     
@@ -176,7 +180,24 @@
     {
         return Collections.unmodifiableSet( byOid.keySet() ).iterator();
     }
+    
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getOidByName()
+    {
+    	return byName;
+    }
 
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getNameByOid()
+    {
+    	return byOid;
+    }
 
     /**
      * @see org.apache.ldap.server.schema.OidRegistry#register(String, String)

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java?rev=355412&r1=355411&r2=355412&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/ldap/server/authz/support/DummyOidRegistry.java
Fri Dec  9 00:26:34 2005
@@ -21,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.naming.NamingException;
 
@@ -66,6 +67,24 @@
     public void register( String name, String oid )
     {
         // Not used
+    }
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getOidByName()
+    {
+    	return null;
+    }
+
+    /**
+     * Get the map of all the oids by their name
+     * @return The Map that contains all the oids
+     */
+    public Map getNameByOid()
+    {
+    	return null;
     }
     
 }



Mime
View raw message