directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r189986 - in /directory/apacheds/branches/direve-158: core/src/main/java/org/apache/ldap/server/configuration/ core/src/test/org/apache/ldap/server/authn/ main/ main/src/main/java/org/apache/ldap/server/ main/src/main/java/org/apache/ldap/server/configuration/ main/src/main/java/org/apache/ldap/server/jndi/ main/src/test/org/apache/ldap/server/
Date Fri, 10 Jun 2005 16:49:53 GMT
Author: trustin
Date: Fri Jun 10 09:49:50 2005
New Revision: 189986

URL: http://svn.apache.org/viewcvs?rev=189986&view=rev
Log:
* Moved networking related properties to apacheds/main
* Added ServerStartupConfiguration and its mutable version

TODO:
* Fix apacheds/main compilation errors
* Use Spring Framework to make it run


Added:
    directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/
    directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
  (with props)
    directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
  (with props)
Modified:
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
    directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/server/authn/SimpleAuthenticationTest.java
    directory/apacheds/branches/direve-158/main/project.xml
    directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/ServerMain.java
    directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
    directory/apacheds/branches/direve-158/main/src/test/org/apache/ldap/server/DisableAnonBindTest.java

Modified: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java?rev=189986&r1=189985&r2=189986&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
(original)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
Fri Jun 10 09:49:50 2005
@@ -22,7 +22,6 @@
 import java.util.Set;
 
 import org.apache.ldap.server.interceptor.InterceptorChain;
-import org.apache.mina.registry.ServiceRegistry;
 
 /**
  * A mutable version of {@link StartupConfiguration}.
@@ -58,29 +57,9 @@
         super.setAllowAnonymousAccess( enableAnonymousAccess );
     }
 
-    public void setEnableKerberos( boolean enableKerberos )
-    {
-        super.setEnableKerberos( enableKerberos );
-    }
-
     public void setInterceptors( InterceptorChain interceptors )
     {
         super.setInterceptors( interceptors );
-    }
-
-    public void setLdapPort( int ldapPort )
-    {
-        super.setLdapPort( ldapPort );
-    }
-
-    public void setLdapsPort( int ldapsPort )
-    {
-        super.setLdapsPort( ldapsPort );
-    }
-
-    public void setMinaServiceRegistry( ServiceRegistry minaServiceRegistry )
-    {
-        super.setMinaServiceRegistry( minaServiceRegistry );
     }
 
     public void setTestEntries( Set testEntries )

Modified: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java?rev=189986&r1=189985&r2=189986&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
(original)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
Fri Jun 10 09:49:50 2005
@@ -35,12 +35,9 @@
 import org.apache.ldap.server.schema.bootstrap.InetorgpersonSchema;
 import org.apache.ldap.server.schema.bootstrap.JavaSchema;
 import org.apache.ldap.server.schema.bootstrap.SystemSchema;
-import org.apache.mina.registry.ServiceRegistry;
-import org.apache.mina.registry.SimpleServiceRegistry;
 
 /**
  * A {@link Configuration} that starts up ApacheDS.
- * TODO Move ldapPort, ldapsPort, enableKerberos, minaServiceRegistry to apacheds/main
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -49,18 +46,14 @@
 {
     private static final long serialVersionUID = 4826762196566871677L;
 
-    protected File workingDirectory = new File( "server-work" );
-    protected boolean allowAnonymousAccess = true; // allow by default
-    protected Set authenticatorConfigurations; // Set<AuthenticatorConfiguration>
-    protected InterceptorChain interceptors = InterceptorChain.newDefaultChain();
-    protected ServiceRegistry minaServiceRegistry = new SimpleServiceRegistry();
-    protected int ldapPort = 389;
-    protected int ldapsPort = 636;
-    protected boolean enableKerberos;
+    private File workingDirectory = new File( "server-work" );
+    private boolean allowAnonymousAccess = true; // allow by default
+    private Set authenticatorConfigurations; // Set<AuthenticatorConfiguration>
+    private InterceptorChain interceptors = InterceptorChain.newDefaultChain();
     
-    protected Set bootstrapSchemas; // Set<BootstrapSchema>
-    protected Set contextPartitionConfigurations = new HashSet(); // Set<ContextPartitionConfiguration>
-    protected Set testEntries = new HashSet(); // Set<Attributes>
+    private Set bootstrapSchemas; // Set<BootstrapSchema>
+    private Set contextPartitionConfigurations = new HashSet(); // Set<ContextPartitionConfiguration>
+    private Set testEntries = new HashSet(); // Set<Attributes>
     
     protected StartupConfiguration()
     {
@@ -182,22 +175,6 @@
     }
 
     /**
-     * Returns <tt>true</tt> if Kerberos support is enabled.
-     */
-    public boolean isEnableKerberos()
-    {
-        return enableKerberos;
-    }
-
-    /**
-     * Sets whether to enable Kerberos support or not.
-     */
-    protected void setEnableKerberos( boolean enableKerberos )
-    {
-        this.enableKerberos = enableKerberos;
-    }
-
-    /**
      * Returns interceptor chain.
      */
     public InterceptorChain getInterceptors()
@@ -215,62 +192,6 @@
             throw new ConfigurationException( "Interceptors cannot be null" );
         }
         this.interceptors = interceptors;
-    }
-
-    /**
-     * Returns LDAP TCP/IP port number to listen to.
-     */
-    public int getLdapPort()
-    {
-        return ldapPort;
-    }
-
-    /**
-     * Sets LDAP TCP/IP port number to listen to.
-     */
-    protected void setLdapPort( int ldapPort )
-    {
-        ConfigurationUtil.validatePortNumber( ldapPort );
-        this.ldapPort = ldapPort;
-    }
-
-    /**
-     * Returns LDAPS TCP/IP port number to listen to.
-     */
-    public int getLdapsPort()
-    {
-        return ldapsPort;
-    }
-
-    /**
-     * Sets LDAPS TCP/IP port number to listen to.
-     */
-    protected void setLdapsPort( int ldapsPort )
-    {
-        ConfigurationUtil.validatePortNumber( ldapsPort );
-        this.ldapsPort = ldapsPort;
-    }
-
-    /**
-     * Returns <a href="http://directory.apache.org/subprojects/network/">MINA</a>
-     * {@link ServiceRegistry} that will be used by ApacheDS.
-     */
-    public ServiceRegistry getMinaServiceRegistry()
-    {
-        return minaServiceRegistry;
-    }
-
-    /**
-     * Sets <a href="http://directory.apache.org/subprojects/network/">MINA</a>
-     * {@link ServiceRegistry} that will be used by ApacheDS.
-     */
-    protected void setMinaServiceRegistry( ServiceRegistry minaServiceRegistry )
-    {
-        if( interceptors == null )
-        {
-            throw new ConfigurationException( "MinaServiceRegistry cannot be null" );
-        }
-        this.minaServiceRegistry = minaServiceRegistry;
     }
 
     /**

Modified: directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/server/authn/SimpleAuthenticationTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/server/authn/SimpleAuthenticationTest.java?rev=189986&r1=189985&r2=189986&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/server/authn/SimpleAuthenticationTest.java
(original)
+++ directory/apacheds/branches/direve-158/core/src/test/org/apache/ldap/server/authn/SimpleAuthenticationTest.java
Fri Jun 10 09:49:50 2005
@@ -35,7 +35,6 @@
 import org.apache.ldap.common.exception.LdapNoPermissionException;
 import org.apache.ldap.common.util.ArrayUtils;
 import org.apache.ldap.server.AbstractCoreTest;
-import org.apache.mina.util.AvailablePortFinder;
 
 
 /**
@@ -187,7 +186,6 @@
         env.put( Context.SECURITY_AUTHENTICATION, "none" );
         
         configuration.setAllowAnonymousAccess( false );
-        configuration.setLdapPort( AvailablePortFinder.getNextAvailable( 1024 ) );
 
         try
         {

Modified: directory/apacheds/branches/direve-158/main/project.xml
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/main/project.xml?rev=189986&r1=189985&r2=189986&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/main/project.xml (original)
+++ directory/apacheds/branches/direve-158/main/project.xml Fri Jun 10 09:49:50 2005
@@ -126,7 +126,7 @@
     <dependency>
       <groupId>directory-network</groupId>
       <artifactId>mina</artifactId>
-      <version>0.7.2-SNAPSHOT</version>
+      <version>0.7.3-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>${pom.groupId}</groupId>

Modified: directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/ServerMain.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/ServerMain.java?rev=189986&r1=189985&r2=189986&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/ServerMain.java
(original)
+++ directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/ServerMain.java
Fri Jun 10 09:49:50 2005
@@ -25,7 +25,6 @@
 import javax.naming.directory.InitialDirContext;
 
 import org.apache.ldap.common.util.PropertiesUtils;
-import org.apache.ldap.server.jndi.EnvKeys;
 
 
 /**

Added: directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java?rev=189986&view=auto
==============================================================================
--- directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
(added)
+++ directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
Fri Jun 10 09:49:50 2005
@@ -0,0 +1,97 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.server.configuration;
+
+import java.io.File;
+import java.util.Set;
+
+import org.apache.ldap.server.interceptor.InterceptorChain;
+import org.apache.mina.registry.ServiceRegistry;
+
+/**
+ * A mutable version of {@link ServerStartupConfiguration}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MutableServerStartupConfiguration extends
+        ServerStartupConfiguration
+{
+    private static final long serialVersionUID = 515104910980600099L;
+
+    public MutableServerStartupConfiguration()
+    {
+        super();
+    }
+
+    public void setAllowAnonymousAccess( boolean arg0 )
+    {
+        super.setAllowAnonymousAccess( arg0 );
+    }
+
+    public void setAuthenticatorConfigurations( Set arg0 )
+    {
+        super.setAuthenticatorConfigurations( arg0 );
+    }
+
+    public void setBootstrapSchemas( Set arg0 )
+    {
+        super.setBootstrapSchemas( arg0 );
+    }
+
+    public void setContextPartitionConfigurations( Set arg0 )
+    {
+        super.setContextPartitionConfigurations( arg0 );
+    }
+
+    public void setInterceptors( InterceptorChain arg0 )
+    {
+        super.setInterceptors( arg0 );
+    }
+
+    public void setTestEntries( Set arg0 )
+    {
+        super.setTestEntries( arg0 );
+    }
+
+    public void setWorkingDirectory( File arg0 )
+    {
+        super.setWorkingDirectory( arg0 );
+    }
+
+    public void setEnableKerberos( boolean enableKerberos )
+    {
+        super.setEnableKerberos( enableKerberos );
+    }
+
+    public void setLdapPort( int ldapPort )
+    {
+        super.setLdapPort( ldapPort );
+    }
+
+    public void setLdapsPort( int ldapsPort )
+    {
+        super.setLdapsPort( ldapsPort );
+    }
+
+    public void setMinaServiceRegistry( ServiceRegistry minaServiceRegistry )
+    {
+        super.setMinaServiceRegistry( minaServiceRegistry );
+    }
+}

Propchange: directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java?rev=189986&view=auto
==============================================================================
--- directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
(added)
+++ directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
Fri Jun 10 09:49:50 2005
@@ -0,0 +1,131 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.server.configuration;
+
+import org.apache.mina.registry.ServiceRegistry;
+import org.apache.mina.registry.SimpleServiceRegistry;
+
+/**
+ * A {@link StartupConfiguration} that starts up ApacheDS with network layer support.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ServerStartupConfiguration extends StartupConfiguration
+{
+    private static final long serialVersionUID = -7138616822614155454L;
+
+    private boolean enableNetworking = true;
+    private ServiceRegistry minaServiceRegistry = new SimpleServiceRegistry();
+    private int ldapPort = 389;
+    private int ldapsPort = 636;
+    private boolean enableKerberos;
+
+    protected ServerStartupConfiguration()
+    {
+    }
+
+    /**
+     * Returns <tt>true</tt> if networking (LDAP, LDAPS, and Kerberos) is enabled.
+     */
+    public boolean isEnableNetworking()
+    {
+        return enableNetworking;
+    }
+
+    /**
+     * Sets whether to enable networking (LDAP, LDAPS, and Kerberos) or not.
+     */
+    public void setEnableNetworking( boolean enableNetworking )
+    {
+        this.enableNetworking = enableNetworking;
+    }
+
+    /**
+     * Returns <tt>true</tt> if Kerberos support is enabled.
+     */
+    public boolean isEnableKerberos()
+    {
+        return enableKerberos;
+    }
+
+    /**
+     * Sets whether to enable Kerberos support or not.
+     */
+    protected void setEnableKerberos( boolean enableKerberos )
+    {
+        this.enableKerberos = enableKerberos;
+    }
+
+    /**
+     * Returns LDAP TCP/IP port number to listen to.
+     */
+    public int getLdapPort()
+    {
+        return ldapPort;
+    }
+
+    /**
+     * Sets LDAP TCP/IP port number to listen to.
+     */
+    protected void setLdapPort( int ldapPort )
+    {
+        ConfigurationUtil.validatePortNumber( ldapPort );
+        this.ldapPort = ldapPort;
+    }
+
+    /**
+     * Returns LDAPS TCP/IP port number to listen to.
+     */
+    public int getLdapsPort()
+    {
+        return ldapsPort;
+    }
+
+    /**
+     * Sets LDAPS TCP/IP port number to listen to.
+     */
+    protected void setLdapsPort( int ldapsPort )
+    {
+        ConfigurationUtil.validatePortNumber( ldapsPort );
+        this.ldapsPort = ldapsPort;
+    }
+
+    /**
+     * Returns <a href="http://directory.apache.org/subprojects/network/">MINA</a>
+     * {@link ServiceRegistry} that will be used by ApacheDS.
+     */
+    public ServiceRegistry getMinaServiceRegistry()
+    {
+        return minaServiceRegistry;
+    }
+
+    /**
+     * Sets <a href="http://directory.apache.org/subprojects/network/">MINA</a>
+     * {@link ServiceRegistry} that will be used by ApacheDS.
+     */
+    protected void setMinaServiceRegistry( ServiceRegistry minaServiceRegistry )
+    {
+        if( minaServiceRegistry == null )
+        {
+            throw new ConfigurationException( "MinaServiceRegistry cannot be null" );
+        }
+        this.minaServiceRegistry = minaServiceRegistry;
+    }
+}

Propchange: directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java?rev=189986&r1=189985&r2=189986&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
(original)
+++ directory/apacheds/branches/direve-158/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
Fri Jun 10 09:49:50 2005
@@ -20,26 +20,28 @@
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.Hashtable;
-import java.util.Properties;
 import java.util.Iterator;
+import java.util.Properties;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
-import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.Control;
+import javax.naming.ldap.InitialLdapContext;
 
+import org.apache.kerberos.protocol.KerberosProtocolProvider;
+import org.apache.kerberos.service.KdcConfiguration;
+import org.apache.kerberos.store.JndiPrincipalStoreImpl;
+import org.apache.kerberos.store.PrincipalStore;
 import org.apache.ldap.common.exception.LdapConfigurationException;
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.util.PropertiesUtils;
+import org.apache.ldap.server.configuration.Configuration;
+import org.apache.ldap.server.configuration.ServerStartupConfiguration;
+import org.apache.ldap.server.configuration.ShutdownConfiguration;
 import org.apache.ldap.server.protocol.LdapProtocolProvider;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.registry.Service;
 import org.apache.mina.registry.ServiceRegistry;
-import org.apache.mina.registry.SimpleServiceRegistry;
-import org.apache.kerberos.service.KdcConfiguration;
-import org.apache.kerberos.protocol.KerberosProtocolProvider;
-import org.apache.kerberos.store.PrincipalStore;
-import org.apache.kerberos.store.JndiPrincipalStoreImpl;
 
 
 /**
@@ -52,11 +54,6 @@
  */
 public class ServerContextFactory extends CoreContextFactory
 {
-    /** the default LDAP port to use */
-    private static final int LDAP_PORT = 389;
-
-    private static final ServiceRegistry DEFAULT_MINA_REGISTRY;
-    
     private static Service ldapService;
 
     private static Service kerberosService;
@@ -64,22 +61,6 @@
     private static ServiceRegistry minaRegistry;
 
 
-    static
-    {
-        ServiceRegistry tmp = null;
-
-        try
-        {
-            tmp = new SimpleServiceRegistry();
-        }
-        catch( IOException e )
-        {
-            e.printStackTrace();
-        }
-        
-        DEFAULT_MINA_REGISTRY = tmp;
-    }
-
     // ------------------------------------------------------------------------
     // Members
     // ------------------------------------------------------------------------
@@ -97,8 +78,8 @@
     public Context getInitialContext( Hashtable env ) throws NamingException
     {
         Context ctx = null;
-
-        if ( env.containsKey( EnvKeys.SHUTDOWN ) )
+        Configuration cfg0 = Configuration.toConfiguration( env );
+        if ( cfg0 instanceof ShutdownConfiguration )
         {
             if ( this.provider == null )
             {
@@ -153,16 +134,25 @@
         ctx = super.getInitialContext( env );
 
         // fire up the front end if we have not explicitly disabled it
-
-        if ( initialEnv != null && ! initialEnv.containsKey( EnvKeys.DISABLE_PROTOCOL
) )
+        if( ctx == null || ctx instanceof DeadContext ||
+                !( cfg0 instanceof ServerStartupConfiguration ) )
         {
-            setupRegistry();
-
-            startLdapProtocol();
-
-            if ( initialEnv.containsKey( EnvKeys.ENABLE_KERBEROS ) )
+            return ctx;
+        }
+        
+        if( provider == null )
+        {
+            ServerStartupConfiguration cfg =
+                ( ServerStartupConfiguration ) cfg0;
+            if ( cfg.isEnableNetworking() )
             {
-                startKerberosProtocol();
+                setupRegistry();
+                startLdapProtocol();
+
+                if ( cfg.isEnableKerberos() )
+                {
+                    startKerberosProtocol();
+                }
             }
         }
 
@@ -172,34 +162,13 @@
 
     /**
      * Starts up the MINA registry so various protocol providers can be started.
-     *
-     * @throws NamingException if there is a problem initializing the registry
      */
-    private void setupRegistry() throws NamingException
+    private void setupRegistry()
     {
-        ServiceRegistry registry = null;
-
-        if ( initialEnv.containsKey( EnvKeys.PASSTHRU ) )
-        {
-            registry = ( ServiceRegistry ) initialEnv.get( EnvKeys.PASSTHRU );
-
-            if ( registry != null )
-            {
-                initialEnv.put( EnvKeys.PASSTHRU, "Handoff Succeeded!" );
-            }
-        }
-
-        if( DEFAULT_MINA_REGISTRY == null )
-        {
-            throw new NamingException( "Default MINA service registry is not available."
);
-        }
-
-        if( registry == null )
-        {
-            registry = DEFAULT_MINA_REGISTRY;
-        }
+        ServerStartupConfiguration configuration =
+            ( ServerStartupConfiguration ) this.configuration;
 
-        minaRegistry = registry;
+        minaRegistry = configuration.getMinaServiceRegistry();
     }
 
 
@@ -259,7 +228,9 @@
      */
     private void startLdapProtocol() throws NamingException
     {
-        int port = PropertiesUtils.get( initialEnv, EnvKeys.LDAP_PORT, LDAP_PORT );
+        ServerStartupConfiguration configuration =
+            ( ServerStartupConfiguration ) this.configuration;
+        int port = configuration.getLdapPort();
 
         Service service = new Service( "ldap", TransportType.SOCKET, new InetSocketAddress(
port ) );
 

Modified: directory/apacheds/branches/direve-158/main/src/test/org/apache/ldap/server/DisableAnonBindTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/main/src/test/org/apache/ldap/server/DisableAnonBindTest.java?rev=189986&r1=189985&r2=189986&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/main/src/test/org/apache/ldap/server/DisableAnonBindTest.java
(original)
+++ directory/apacheds/branches/direve-158/main/src/test/org/apache/ldap/server/DisableAnonBindTest.java
Fri Jun 10 09:49:50 2005
@@ -17,12 +17,13 @@
 package org.apache.ldap.server;
 
 
-import org.apache.ldap.server.jndi.EnvKeys;
-
-import javax.naming.*;
 import java.io.File;
 import java.io.IOException;
 import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NoPermissionException;
 
 
 /**



Mime
View raw message