You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/10/12 04:39:16 UTC

svn commit: r584030 [1/2] - in /directory/apacheds/branches/bigbang: protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/ protocol-ldap/ protocol-ldap/src/main/java/org/apache/directory/server/ldap/ protocol-ldap/src/main/java/org/...

Author: akarasulu
Date: Thu Oct 11 19:39:14 2007
New Revision: 584030

URL: http://svn.apache.org/viewvc?rev=584030&view=rev
Log:
breaks a bunch of stuff but commiting for trustin to test something for me

Added:
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java   (contents, props changed)
      - copied, changed from r583968, directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java   (contents, props changed)
      - copied, changed from r583968, directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapProtocolProviderTest.java
Removed:
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapConfiguration.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapProtocolProviderTest.java
Modified:
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
    directory/apacheds/branches/bigbang/protocol-ldap/pom.xml
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AbstractLdapHandler.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/ConfigureChain.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java
    directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
    directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/diagnosticcmd/DiagnosticCommandExecutor.java
    directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/disconnectnotificationcmd/DisconnectNotificationCommandExecutor.java
    directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/exportcmd/ExportCommandExecutor.java
    directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/gracefulshutdowncmd/GracefulShutdownCommandExecutor.java
    directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java
    directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/storedprocedurecmd/StoredProcedureCommandExecutor.java
    directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerFastTest.java
    directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ssl/LdapsITest.java

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java Thu Oct 11 19:39:14 2007
@@ -20,17 +20,6 @@
 package org.apache.directory.server.kerberos.kdc;
 
 
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.kerberos.KeyDerivationInterceptor;
@@ -39,7 +28,7 @@
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
-import org.apache.directory.server.ldap.LdapConfiguration;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.protocol.shared.SocketAcceptor;
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -47,6 +36,16 @@
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.mina.util.AvailablePortFinder;
 
+import javax.naming.Context;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+
 
 /**
  * An {@link AbstractServerTest} testing SASL GSSAPI authentication
@@ -82,7 +81,7 @@
     {
         apacheDS.setAllowAnonymousAccess( false );
 
-        LdapConfiguration ldapConfig = apacheDS.getLdapConfiguration();
+        LdapServer ldapConfig = apacheDS.getLdapServer();
         ldapConfig.setSaslHost( "localhost" );
         ldapConfig.setSaslPrincipal( "ldap/localhost@EXAMPLE.COM" );
 

Modified: directory/apacheds/branches/bigbang/protocol-ldap/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/pom.xml?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/pom.xml Thu Oct 11 19:39:14 2007
@@ -57,6 +57,12 @@
 
     <dependency>
       <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-bootstrap-partition</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
       <artifactId>apacheds-protocol-shared</artifactId>
       <version>${pom.version}</version>
     </dependency>

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java Thu Oct 11 19:39:14 2007
@@ -70,5 +70,5 @@
      * 
      * @param provider the ldap protocol provider 
      */
-    void setLdapProvider( LdapProtocolProvider provider );
+    void setLdapProvider( LdapServer provider );
 }

Copied: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (from r583968, directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?p2=directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java&p1=directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java&r1=583968&r2=584030&rev=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Thu Oct 11 19:39:14 2007
@@ -21,18 +21,21 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.ldap.support.*;
+import org.apache.directory.server.ldap.support.ssl.LdapsInitializer;
+import org.apache.directory.server.protocol.shared.ServiceConfiguration;
+import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.asn1.codec.Asn1CodecDecoder;
 import org.apache.directory.shared.asn1.codec.Asn1CodecEncoder;
-import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.*;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 import org.apache.directory.shared.ldap.message.spi.BinaryAttributeDetector;
 import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.mina.common.IoFilterChain;
-import org.apache.mina.common.IoHandler;
-import org.apache.mina.common.IoSession;
+import org.apache.directory.shared.ldap.exception.LdapNamingException;
+import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
+import org.apache.mina.common.*;
 import org.apache.mina.filter.SSLFilter;
 import org.apache.mina.filter.codec.ProtocolCodecFactory;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
@@ -40,11 +43,18 @@
 import org.apache.mina.filter.codec.ProtocolEncoder;
 import org.apache.mina.handler.demux.DemuxingIoHandler;
 import org.apache.mina.util.SessionLog;
+import org.apache.mina.transport.socket.nio.SocketAcceptor;
+import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.ldap.Control;
 import java.util.*;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetSocketAddress;
 
 
 /**
@@ -54,19 +64,78 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class LdapProtocolProvider
+public class LdapServer extends ServiceConfiguration
 {
+    @SuppressWarnings ( { "UnusedDeclaration" } )
+    private static final long serialVersionUID = 3757127143811666817L;
+
+    /** logger for this class */
+    private static final Logger LOG = LoggerFactory.getLogger( LdapServer.class.getName() );
+
+    /** The default maximum size limit. */
+    private static final int MAX_SIZE_LIMIT_DEFAULT = 100;
+
+    /** The default maximum time limit. */
+    private static final int MAX_TIME_LIMIT_DEFAULT = 10000;
+
+    /**
+     * The default service pid.
+     */
+    private static final String SERVICE_PID_DEFAULT = "org.apache.directory.server.ldap";
+
+    /**
+     * The default service name.
+     */
+    private static final String SERVICE_NAME_DEFAULT = "ApacheDS LDAP Service";
+
+    /** The default IP port. */
+    private static final int IP_PORT_DEFAULT = 389;
+
     /** the constant service name of this ldap protocol provider **/
     public static final String SERVICE_NAME = "ldap";
 
     /** a set of supported controls */
     private Set<String> supportedControls;
 
-    /** configuration for the LDAP protocol provider **/
-    private LdapConfiguration ldapConfiguration;
-
     private DirectoryService directoryService;
 
+    /** The maximum size limit. */
+    private int maxSizeLimit = MAX_SIZE_LIMIT_DEFAULT; // set to default value
+
+    /** The maximum time limit. */
+    private int maxTimeLimit = MAX_TIME_LIMIT_DEFAULT; // set to default value (milliseconds)
+
+    /** Whether LDAPS is enabled. */
+    private boolean enableLdaps;
+
+    /** Whether to allow anonymous access. */
+    private boolean allowAnonymousAccess = true; // allow by default
+
+    /** The path to the certificate file. */
+    private File ldapsCertificateFile = new File( "server-work" + File.separator + "certificates" + File.separator
+        + "server.cert" );
+
+    /** The certificate password. */
+    private String ldapsCertificatePassword = "changeit";
+
+    /** The extended operation handlers. */
+    private final Collection<ExtendedOperationHandler> extendedOperationHandlers = new ArrayList<ExtendedOperationHandler>();
+
+    /** The supported authentication mechanisms. */
+    private Set<String> supportedMechanisms;
+
+    /** The name of this host, validated during SASL negotiation. */
+    private String saslHost = "ldap.example.com";
+
+    /** The service principal, used by GSSAPI. */
+    private String saslPrincipal = "ldap/ldap.example.com@EXAMPLE.COM";
+
+    /** The quality of protection (QoP), used by DIGEST-MD5 and GSSAPI. */
+    private List<String> saslQop;
+
+    /** The list of realms serviced by this host. */
+    private List<String> saslRealms;
+
     private AbandonHandler abandonHandler;
     private AddHandler addHandler;
     private BindHandler bindHandler;
@@ -78,41 +147,47 @@
     private SearchHandler searchHandler;
     private UnbindHandler unbindHandler;
 
-    private final SessionRegistry registry;
+
+    private SessionRegistry registry;
 
     /** the underlying provider codec factory */
-    private final ProtocolCodecFactory codecFactory;
+    private ProtocolCodecFactory codecFactory;
 
     /** the MINA protocol handler */
     private final LdapProtocolHandler handler = new LdapProtocolHandler();
 
+    private final SocketAcceptor socketAcceptor;
 
-    // ------------------------------------------------------------------------
-    // C O N S T R U C T O R S
-    // ------------------------------------------------------------------------
-
+    /** tracks state of the server */
+    private boolean started;
 
 
     /**
-     * Creates a MINA LDAP protocol provider.
+     * Creates an LDAP protocol provider.
      *
-     * underlying codec providers if any
-     * @param cfg the ldap configuration
-     * @param directoryService the directory service core
-     *
-     * @throws LdapNamingException if there are problems setting up the protocol provider
+     * @param socketAcceptor the mina socket acceptor wrapper
      */
-    public LdapProtocolProvider( DirectoryService directoryService, LdapConfiguration cfg ) throws LdapNamingException
+    public LdapServer( SocketAcceptor socketAcceptor  )
     {
-        this.ldapConfiguration = cfg;
-        this.directoryService = directoryService;
+        this.socketAcceptor = socketAcceptor;
+        super.setIpPort( IP_PORT_DEFAULT );
+        super.setEnabled( true );
+        super.setServicePid( SERVICE_PID_DEFAULT );
+        super.setServiceName( SERVICE_NAME_DEFAULT );
+
+        supportedMechanisms = new HashSet<String>();
+        supportedMechanisms.add( "SIMPLE" );
+        supportedMechanisms.add( "CRAM-MD5" );
+        supportedMechanisms.add( "DIGEST-MD5" );
+        supportedMechanisms.add( "GSSAPI" );
+
+        saslQop = new ArrayList<String>();
+        saslQop.add( "auth" );
+        saslQop.add( "auth-int" );
+        saslQop.add( "auth-conf" );
 
-        Hashtable<String,Object> copy = new Hashtable<String,Object>();
-        copy.put( Context.PROVIDER_URL, "" );
-        copy.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
-        copy.put( DirectoryService.JNDI_KEY, directoryService );
-
-        this.registry = new SessionRegistry( cfg, copy );
+        saslRealms = new ArrayList<String>();
+        saslRealms.add( "example.com" );
 
         this.supportedControls = new HashSet<String>();
         this.supportedControls.add( PersistentSearchControl.CONTROL_OID );
@@ -131,14 +206,141 @@
         setModifyDnHandler( new DefaultModifyDnHandler() );
         setSearchHandler( new DefaultSearchHandler() );
         setUnbindHandler( new DefaultUnbindHandler() );
+    }
 
-        this.codecFactory = new ProtocolCodecFactoryImpl( directoryService );
+
+    /**
+     * @org.apache.xbean.InitMethod
+     * @throws IOException if we cannot bind to the specified port
+     * @throws NamingException if the LDAP server cannot be started
+     */
+    public void start() throws NamingException, IOException
+    {
+        if ( ! isEnabled() )
+        {
+            return;
+        }
+
+        IoFilterChainBuilder chain;
+        if ( isEnableLdaps() )
+        {
+            char[] certPasswordChars = getLdapsCertificatePassword().toCharArray();
+            String storePath = getLdapsCertificateFile().getPath();
+            chain = LdapsInitializer.init( certPasswordChars, storePath );
+        }
+        else
+        {
+            chain = new DefaultIoFilterChainBuilder();
+            startLDAP0( getIpPort(), chain );
+        }
+
+        startLDAP0( getIpPort(), chain );
+        started = true;
     }
 
 
-    // ------------------------------------------------------------------------
-    // ProtocolProvider Methods
-    // ------------------------------------------------------------------------
+    /**
+     * @org.apache.xbean.DestroyMethod
+     */
+    public void stop()
+    {
+        try
+        {
+            // we should unbind the service before we begin sending the notice
+            // of disconnect so new connections are not formed while we process
+            List<WriteFuture> writeFutures = new ArrayList<WriteFuture>();
+
+            // If the socket has already been unbound as with a successful
+            // GracefulShutdownRequest then this will complain that the service
+            // is not bound - this is ok because the GracefulShutdown has already
+            // sent notices to to the existing active sessions
+            List<IoSession> sessions;
+
+            try
+            {
+                sessions = new ArrayList<IoSession>(
+                        socketAcceptor.getManagedSessions( new InetSocketAddress( getIpPort() ) ) );
+            }
+            catch ( IllegalArgumentException e )
+            {
+                LOG.warn( "Seems like the LDAP service (" + getIpPort() + ") has already been unbound." );
+                return;
+            }
+
+            socketAcceptor.unbind( new InetSocketAddress( getIpPort() ) );
+
+            if ( LOG.isInfoEnabled() )
+            {
+                LOG.info( "Unbind of an LDAP service (" + getIpPort() + ") is complete." );
+                LOG.info( "Sending notice of disconnect to existing clients sessions." );
+            }
+
+            // Send Notification of Disconnection messages to all connected clients.
+            if ( sessions != null )
+            {
+                for ( IoSession session:sessions )
+                {
+                    writeFutures.add( session.write( NoticeOfDisconnect.UNAVAILABLE ) );
+                }
+            }
+
+            // And close the connections when the NoDs are sent.
+            Iterator<IoSession> sessionIt = sessions.iterator();
+
+            for ( WriteFuture future:writeFutures )
+            {
+                future.join( 1000 );
+                sessionIt.next().close();
+            }
+        }
+        catch ( Exception e )
+        {
+            LOG.warn( "Failed to sent NoD.", e );
+        }
+    }
+
+
+    private void startLDAP0( int port, IoFilterChainBuilder chainBuilder )
+        throws LdapNamingException, LdapConfigurationException
+    {
+        for ( ExtendedOperationHandler h : getExtendedOperationHandlers() )
+        {
+            addExtendedOperationHandler( h );
+            LOG.info( "Added Extended Request Handler: " + h.getOid() );
+            h.setLdapProvider( this );
+            PartitionNexus nexus = directoryService.getPartitionNexus();
+            nexus.registerSupportedExtensions( h.getExtensionOids() );
+        }
+
+        try
+        {
+            SocketAcceptorConfig acceptorCfg = new SocketAcceptorConfig();
+
+            // Disable the disconnection of the clients on unbind
+            acceptorCfg.setDisconnectOnUnbind( false );
+            acceptorCfg.setReuseAddress( true );
+            acceptorCfg.setFilterChainBuilder( chainBuilder );
+            acceptorCfg.setThreadModel( ThreadModel.MANUAL );
+
+            acceptorCfg.getSessionConfig().setTcpNoDelay( true );
+
+            socketAcceptor.bind( new InetSocketAddress( port ), getHandler(), acceptorCfg );
+            started = true;
+
+            if ( LOG.isInfoEnabled() )
+            {
+                LOG.info( "Successful bind of an LDAP Service (" + port + ") is complete." );
+            }
+        }
+        catch ( IOException e )
+        {
+            String msg = "Failed to bind an LDAP service (" + port + ") to the service registry.";
+            LdapConfigurationException lce = new LdapConfigurationException( msg );
+            lce.setRootCause( e );
+            LOG.error( msg, e );
+            throw lce;
+        }
+    }
 
 
     public String getName()
@@ -159,6 +361,11 @@
     }
 
 
+    // ------------------------------------------------------------------------
+    // Configuration Methods
+    // ------------------------------------------------------------------------
+
+
     /**
      * Registeres the specified {@link ExtendedOperationHandler} to this
      * protocol provider to provide a specific LDAP extended operation.
@@ -210,6 +417,293 @@
     }
 
 
+    /**
+     * Returns <tt>true</tt> if LDAPS is enabled.
+     *
+     * @return True if LDAPS is enabled.
+     */
+    public boolean isEnableLdaps()
+    {
+        return enableLdaps;
+    }
+
+
+    /**
+     * Sets if LDAPS is enabled or not.
+     *
+     * @param enableLdaps Whether LDAPS is enabled.
+     */
+    public void setEnableLdaps( boolean enableLdaps )
+    {
+        this.enableLdaps = enableLdaps;
+    }
+
+
+    /**
+     * Returns the path of the X509 (or JKS) certificate file for LDAPS.
+     * The default value is <tt>"&lt;WORKDIR&gt;/certificates/server.cert"</tt>.
+     *
+     * @return The LDAPS certificate file.
+     */
+    public File getLdapsCertificateFile()
+    {
+        return ldapsCertificateFile;
+    }
+
+
+    /**
+     * Sets the path of the SunX509 certificate file (either PKCS12 or JKS format)
+     * for LDAPS.
+     *
+     * @param ldapsCertificateFile The path to the SunX509 certificate.
+     */
+    public void setLdapsCertificateFile( File ldapsCertificateFile )
+    {
+        if ( ldapsCertificateFile == null )
+        {
+            throw new ServiceConfigurationException( "LdapsCertificateFile cannot be null." );
+        }
+        this.ldapsCertificateFile = ldapsCertificateFile;
+    }
+
+
+    /**
+     * Returns the password which is used to load the the SunX509 certificate file
+     * (either PKCS12 or JKS format).
+     * The default value is <tt>"changeit"</tt>.  This is the same value with what
+     * <a href="http://jakarta.apache.org/tomcat/">Apache Jakarta Tomcat</a> uses by
+     * default.
+     *
+     * @return The LDAPS certificate password.
+     */
+    public String getLdapsCertificatePassword()
+    {
+        return ldapsCertificatePassword;
+    }
+
+
+    /**
+     * Sets the password which is used to load the LDAPS certificate file.
+     *
+     * @param ldapsCertificatePassword The certificate password.
+     */
+    public void setLdapsCertificatePassword( String ldapsCertificatePassword )
+    {
+        if ( ldapsCertificatePassword == null )
+        {
+            throw new ServiceConfigurationException( "LdapsCertificatePassword cannot be null." );
+        }
+        this.ldapsCertificatePassword = ldapsCertificatePassword;
+    }
+
+
+    /**
+     * Returns <code>true</code> if anonymous access is allowed.
+     *
+     * @return True if anonymous access is allowed.
+     */
+    public boolean isAllowAnonymousAccess()
+    {
+        return allowAnonymousAccess;
+    }
+
+
+    /**
+     * Sets whether to allow anonymous access or not.
+     *
+     * @param enableAnonymousAccess Set <code>true</code> to allow anonymous access.
+     */
+    public void setAllowAnonymousAccess( boolean enableAnonymousAccess )
+    {
+        this.allowAnonymousAccess = enableAnonymousAccess;
+    }
+
+
+    /**
+     * Sets the maximum size limit in number of entries to return for search.
+     *
+     * @param maxSizeLimit the maximum number of entries to return for search
+     */
+    public void setMaxSizeLimit( int maxSizeLimit )
+    {
+        this.maxSizeLimit = maxSizeLimit;
+    }
+
+
+    /**
+     * Returns the maximum size limit in number of entries to return for search.
+     *
+     * @return The maximum size limit.
+     */
+    public int getMaxSizeLimit()
+    {
+        return maxSizeLimit;
+    }
+
+
+    /**
+     * Sets the maximum time limit in miliseconds to conduct a search.
+     *
+     * @param maxTimeLimit the maximum length of time in milliseconds for search
+     */
+    public void setMaxTimeLimit( int maxTimeLimit )
+    {
+        this.maxTimeLimit = maxTimeLimit;
+    }
+
+
+    /**
+     * Returns the maximum time limit in milliseonds to conduct a search.
+     *
+     * @return The maximum time limit in milliseconds for search
+     */
+    public int getMaxTimeLimit()
+    {
+        return maxTimeLimit;
+    }
+
+
+    /**
+     * Gets the {@link ExtendedOperationHandler}s.
+     *
+     * @return A collection of {@link ExtendedOperationHandler}s.
+     */
+    public Collection<ExtendedOperationHandler> getExtendedOperationHandlers()
+    {
+        return new ArrayList<ExtendedOperationHandler>( extendedOperationHandlers );
+    }
+
+
+    /**
+     * Sets the {@link ExtendedOperationHandler}s.
+     *
+     * @org.apache.xbean.Property nestedType="org.apache.directory.server.ldap.ExtendedOperationHandler"
+     *
+     * @param handlers A collection of {@link ExtendedOperationHandler}s.
+     */
+    public void setExtendedOperationHandlers( Collection<ExtendedOperationHandler> handlers )
+    {
+        this.extendedOperationHandlers.clear();
+        this.extendedOperationHandlers.addAll( handlers );
+    }
+
+
+    /**
+     * Returns the FQDN of this SASL host, validated during SASL negotiation.
+     *
+     * @return The FQDN of this SASL host, validated during SASL negotiation.
+     */
+    public String getSaslHost()
+    {
+        return saslHost;
+    }
+
+
+    /**
+     * Sets the FQDN of this SASL host, validated during SASL negotiation.
+     *
+     * @param saslHost The FQDN of this SASL host, validated during SASL negotiation.
+     */
+    public void setSaslHost( String saslHost )
+    {
+        this.saslHost = saslHost;
+    }
+
+
+    /**
+     * Returns the Kerberos principal name for this LDAP service, used by GSSAPI.
+     *
+     * @return The Kerberos principal name for this LDAP service, used by GSSAPI.
+     */
+    public String getSaslPrincipal()
+    {
+        return saslPrincipal;
+    }
+
+
+    /**
+     * Sets the Kerberos principal name for this LDAP service, used by GSSAPI.
+     *
+     * @param saslPrincipal The Kerberos principal name for this LDAP service, used by GSSAPI.
+     */
+    public void setSaslPrincipal( String saslPrincipal )
+    {
+        this.saslPrincipal = saslPrincipal;
+    }
+
+
+    /**
+     * Returns the desired quality-of-protection, used by DIGEST-MD5 and GSSAPI.
+     *
+     * @return The desired quality-of-protection, used by DIGEST-MD5 and GSSAPI.
+     */
+    public List<String> getSaslQop()
+    {
+        return saslQop;
+    }
+
+
+    /**
+     * Sets the desired quality-of-protection, used by DIGEST-MD5 and GSSAPI.
+     *
+     * @org.apache.xbean.Property nestedType="java.lang.String"
+     *
+     * @param saslQop The desired quality-of-protection, used by DIGEST-MD5 and GSSAPI.
+     */
+    public void setSaslQop( List<String> saslQop )
+    {
+        this.saslQop = saslQop;
+    }
+
+
+    /**
+     * Returns the realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
+     *
+     * @return The realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
+     */
+    public List getSaslRealms()
+    {
+        return saslRealms;
+    }
+
+
+    /**
+     * Sets the realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
+     *
+     * @org.apache.xbean.Property nestedType="java.lang.String"
+     *
+     * @param saslRealms The realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI.
+     */
+    public void setSaslRealms( List<String> saslRealms )
+    {
+        this.saslRealms = saslRealms;
+    }
+
+
+    /**
+     * Returns the list of supported authentication mechanisms.
+     *
+     * @return The list of supported authentication mechanisms.
+     */
+    public Set<String> getSupportedMechanisms()
+    {
+        return supportedMechanisms;
+    }
+
+
+    /**
+     * Sets the list of supported authentication mechanisms.
+     *
+     * @org.apache.xbean.Property propertyEditor="ListEditor" nestedType="java.lang.String"
+     *
+     * @param supportedMechanisms The list of supported authentication mechanisms.
+     */
+    public void setSupportedMechanisms( Set<String> supportedMechanisms )
+    {
+        this.supportedMechanisms = supportedMechanisms;
+    }
+
+
     public DirectoryService getDirectoryService()
     {
         return directoryService;
@@ -224,6 +718,13 @@
         {
             this.bindHandler.setDirectoryService( directoryService );
         }
+        this.codecFactory = new ProtocolCodecFactoryImpl( directoryService );
+        Hashtable<String,Object> copy = new Hashtable<String,Object>();
+        copy.put( Context.PROVIDER_URL, "" );
+        copy.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
+        copy.put( DirectoryService.JNDI_KEY, directoryService );
+        this.registry = new SessionRegistry( this, copy );
+
     }
 
 
@@ -409,6 +910,18 @@
     }
 
 
+    public boolean isStarted()
+    {
+        return started;
+    }
+
+
+    public void setStarted( boolean started )
+    {
+        this.started = started;
+    }
+
+
     /**
      * A snickers based BER Decoder factory.
      */
@@ -454,7 +967,7 @@
     {
         public void sessionCreated( IoSession session ) throws Exception
         {
-            session.setAttribute( LdapConfiguration.class.toString(), ldapConfiguration );
+            session.setAttribute( LdapServer.class.toString(), this );
             IoFilterChain filters = session.getFilterChain();
             filters.addLast( "codec", new ProtocolCodecFilter( codecFactory ) );
         }

Propchange: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Thu Oct 11 19:39:14 2007
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java Thu Oct 11 19:39:14 2007
@@ -57,17 +57,19 @@
     private Hashtable<String, Object> env;
 
     /** the configuration associated with this SessionRegistry */
-    private LdapConfiguration cfg;
+    private LdapServer ldapServer;
 
 
     /**
      * Creates a singleton session state object for the system.
      *
      * @param env the properties associated with this SessionRegistry
-     * @param cfg the ldap configuration
+     * @param ldapServer the ldap configuration
      */
-    public SessionRegistry( LdapConfiguration cfg, Hashtable<String, Object> env )
+    public SessionRegistry( LdapServer ldapServer, Hashtable<String, Object> env )
     {
+        this.ldapServer = ldapServer;
+
         if ( env == null )
         {
             this.env = new Hashtable<String, Object>();
@@ -79,15 +81,6 @@
             this.env = env;
             this.env.put( Context.PROVIDER_URL, "" );
         }
-
-        if ( cfg == null )
-        {
-            this.cfg = new LdapConfiguration();
-        }
-        else
-        {
-            this.cfg = cfg;
-        }
     }
 
 
@@ -262,7 +255,7 @@
         if ( ctx == null && allowAnonymous )
         {
             // if configuration says disable anonymous binds we throw exception
-            if ( !cfg.isAllowAnonymousAccess() )
+            if ( !ldapServer.isAllowAnonymousAccess() )
             {
                 throw new LdapNoPermissionException( "Anonymous binds have been disabled!" );
             }
@@ -306,7 +299,7 @@
 
             // if the user principal is anonymous and the configuration does not allow anonymous binds we
             // prevent the operation by blowing a NoPermissionsException
-            if ( isAnonymousUser && !cfg.isAllowAnonymousAccess() )
+            if ( isAnonymousUser && !ldapServer.isAllowAnonymousAccess() )
             {
                 throw new LdapNoPermissionException( "Anonymous binds have been disabled!" );
             }

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AbstractLdapHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AbstractLdapHandler.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AbstractLdapHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AbstractLdapHandler.java Thu Oct 11 19:39:14 2007
@@ -20,7 +20,7 @@
 package org.apache.directory.server.ldap.support;
 
 
-import org.apache.directory.server.ldap.LdapProtocolProvider;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.SessionRegistry;
 import org.apache.directory.shared.ldap.message.Message;
 import org.apache.directory.shared.ldap.message.MutableControl;
@@ -38,24 +38,24 @@
  */
 public abstract class AbstractLdapHandler implements MessageHandler
 {
-    private LdapProtocolProvider protocolProvider;
+    private LdapServer ldapServer;
 
 
-    public final LdapProtocolProvider getProtocolProvider()
+    public final LdapServer getProtocolProvider()
     {
-        return protocolProvider;
+        return ldapServer;
     }
 
 
-    public final void setProtocolProvider( LdapProtocolProvider provider )
+    public final void setProtocolProvider( LdapServer provider )
     {
-        this.protocolProvider = provider;
+        this.ldapServer = provider;
     }
 
 
     public final SessionRegistry getSessionRegistry()
     {
-        return this.protocolProvider.getRegistry();
+        return this.ldapServer.getRegistry();
     }
 
 

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java Thu Oct 11 19:39:14 2007
@@ -22,7 +22,7 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
-import org.apache.directory.server.ldap.LdapConfiguration;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.support.bind.BindHandlerChain;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.message.*;
@@ -217,10 +217,11 @@
      */
     private void handleSimpleAuth( IoSession session, BindRequest bindRequest ) throws NamingException
     {
-        LdapConfiguration config = ( LdapConfiguration ) session.getAttribute( LdapConfiguration.class.toString() );
+        LdapServer ldapServer = ( LdapServer )
+                session.getAttribute( LdapServer.class.toString() );
 
         @SuppressWarnings( "unchecked" )
-        Set<String> supportedMechanisms = config.getSupportedMechanisms();
+        Set<String> supportedMechanisms = ldapServer.getSupportedMechanisms();
         LdapResult bindResult = bindRequest.getResultResponse().getLdapResult();
 
         // First, deal with Simple Authentication

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java Thu Oct 11 19:39:14 2007
@@ -20,21 +20,9 @@
 package org.apache.directory.server.ldap.support;
 
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.ReferralException;
-import javax.naming.directory.SearchControls;
-import javax.naming.ldap.LdapContext;
-
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.ldap.LdapConfiguration;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -48,6 +36,17 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.ReferralException;
+import javax.naming.directory.SearchControls;
+import javax.naming.ldap.LdapContext;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+
 
 /**
  * A handler for processing search requests.
@@ -135,7 +134,8 @@
      */
     public void searchMessageReceived( IoSession session, SearchRequest req ) throws Exception
     {
-        LdapConfiguration cfg = ( LdapConfiguration ) session.getAttribute(  LdapConfiguration.class.toString() );
+        LdapServer ldapServer = ( LdapServer )
+                session.getAttribute(  LdapServer.class.toString() );
 
     	if ( IS_DEBUG )
     	{
@@ -217,7 +217,7 @@
             // Handle annonymous binds
             // ===============================================================
 
-            boolean allowAnonymousBinds = cfg.isAllowAnonymousAccess();
+            boolean allowAnonymousBinds = ldapServer.isAllowAnonymousAccess();
             boolean isAnonymousUser = ctx.getPrincipal().getName().trim().equals( "" );
 
             if ( isAnonymousUser && !allowAnonymousBinds && !isRootDSESearch )
@@ -235,8 +235,8 @@
             // Set search limits differently based on user's identity
             // ===============================================================
 
-            int maxSize = cfg.getMaxSizeLimit();
-            int maxTime = cfg.getMaxTimeLimit();
+            int maxSize = ldapServer.getMaxSizeLimit();
+            int maxTime = ldapServer.getMaxTimeLimit();
 
             SearchControls controls;
             if ( isAnonymousUser )

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/ConfigureChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/ConfigureChain.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/ConfigureChain.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/ConfigureChain.java Thu Oct 11 19:39:14 2007
@@ -20,29 +20,11 @@
 package org.apache.directory.server.ldap.support.bind;
 
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.ldap.InitialLdapContext;
-import javax.security.auth.Subject;
-import javax.security.auth.kerberos.KerberosKey;
-import javax.security.auth.kerberos.KerberosPrincipal;
-import javax.security.sasl.Sasl;
-
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
 import org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal;
-import org.apache.directory.server.ldap.LdapConfiguration;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.constants.SupportedSASLMechanisms;
 import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
 import org.apache.directory.server.protocol.shared.store.ContextOperation;
@@ -51,6 +33,16 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.InitialLdapContext;
+import javax.security.auth.Subject;
+import javax.security.auth.kerberos.KerberosKey;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.sasl.Sasl;
+import java.util.*;
+
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -58,36 +50,37 @@
  */
 public class ConfigureChain implements IoHandlerCommand
 {
-    private static final Logger log = LoggerFactory.getLogger( ConfigureChain.class );
+    private static final Logger LOG = LoggerFactory.getLogger( ConfigureChain.class );
 
     private DirContext ctx;
 
 
     public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        LdapConfiguration config = ( LdapConfiguration ) session.getAttribute( LdapConfiguration.class.toString() );
+        LdapServer ldapServer = ( LdapServer )
+                session.getAttribute( LdapServer.class.toString() );
 
         Map<String, String> saslProps = new HashMap<String, String>();
-        saslProps.put( Sasl.QOP, getActiveQop( config ) );
-        saslProps.put( "com.sun.security.sasl.digest.realm", getActiveRealms( config ) );
+        saslProps.put( Sasl.QOP, getActiveQop( ldapServer ) );
+        saslProps.put( "com.sun.security.sasl.digest.realm", getActiveRealms( ldapServer ) );
         session.setAttribute( "saslProps", saslProps );
 
-        session.setAttribute( "saslHost", config.getSaslHost() );
-        session.setAttribute( "baseDn", config.getSearchBaseDn() );
+        session.setAttribute( "saslHost", ldapServer.getSaslHost() );
+        session.setAttribute( "baseDn", ldapServer.getSearchBaseDn() );
 
-        Set activeMechanisms = getActiveMechanisms( config );
+        Set activeMechanisms = getActiveMechanisms( ldapServer );
 
         if ( activeMechanisms.contains( "GSSAPI" ) )
         {
             try
             {
-                Subject saslSubject = getSubject( config );
+                Subject saslSubject = getSubject( ldapServer );
                 session.setAttribute( "saslSubject", saslSubject );
             }
             catch ( ServiceConfigurationException sce )
             {
                 activeMechanisms.remove( "GSSAPI" );
-                log.warn( sce.getMessage() );
+                LOG.warn( sce.getMessage() );
             }
         }
 
@@ -97,7 +90,7 @@
     }
 
 
-    private Set getActiveMechanisms( LdapConfiguration config )
+    private Set getActiveMechanisms( LdapServer ldapServer )
     {
         List<String> supportedMechanisms = new ArrayList<String>();
         supportedMechanisms.add( SupportedSASLMechanisms.SIMPLE );
@@ -107,10 +100,8 @@
 
         Set<String> activeMechanisms = new HashSet<String>();
 
-        Iterator it = config.getSupportedMechanisms().iterator();
-        while ( it.hasNext() )
+        for ( String desiredMechanism : ldapServer.getSupportedMechanisms() )
         {
-            String desiredMechanism = ( String ) it.next();
             if ( supportedMechanisms.contains( desiredMechanism ) )
             {
                 activeMechanisms.add( desiredMechanism );
@@ -121,7 +112,7 @@
     }
 
 
-    private String getActiveQop( LdapConfiguration config )
+    private String getActiveQop( LdapServer ldapServer )
     {
         List<String> supportedQop = new ArrayList<String>();
         supportedQop.add( "auth" );
@@ -130,7 +121,7 @@
 
         StringBuilder saslQop = new StringBuilder();
 
-        Iterator it = config.getSaslQop().iterator();
+        Iterator it = ldapServer.getSaslQop().iterator();
         while ( it.hasNext() )
         {
             String desiredQopLevel = ( String ) it.next();
@@ -150,11 +141,11 @@
     }
 
 
-    private String getActiveRealms( LdapConfiguration config )
+    private String getActiveRealms( LdapServer ldapServer )
     {
         StringBuilder realms = new StringBuilder();
 
-        Iterator it = config.getSaslRealms().iterator();
+        Iterator it = ldapServer.getSaslRealms().iterator();
         while ( it.hasNext() )
         {
             String realm = ( String ) it.next();
@@ -171,9 +162,9 @@
     }
 
 
-    private Subject getSubject( LdapConfiguration config ) throws ServiceConfigurationException
+    private Subject getSubject( LdapServer ldapServer ) throws ServiceConfigurationException
     {
-        String servicePrincipalName = config.getSaslPrincipal();
+        String servicePrincipalName = ldapServer.getSaslPrincipal();
 
         KerberosPrincipal servicePrincipal = new KerberosPrincipal( servicePrincipalName );
         GetPrincipal getPrincipal = new GetPrincipal( servicePrincipal );
@@ -182,19 +173,19 @@
 
         try
         {
-            entry = ( PrincipalStoreEntry ) execute( config, getPrincipal );
+            entry = ( PrincipalStoreEntry ) execute( ldapServer, getPrincipal );
         }
         catch ( Exception e )
         {
             String message = "Service principal " + servicePrincipalName + " not found at search base DN "
-                + config.getSearchBaseDn() + ".";
+                + ldapServer.getSearchBaseDn() + ".";
             throw new ServiceConfigurationException( message, e );
         }
 
         if ( entry == null )
         {
             String message = "Service principal " + servicePrincipalName + " not found at search base DN "
-                + config.getSearchBaseDn() + ".";
+                + ldapServer.getSearchBaseDn() + ".";
             throw new ServiceConfigurationException( message );
         }
 
@@ -211,9 +202,9 @@
     }
 
 
-    private Object execute( LdapConfiguration config, ContextOperation operation ) throws Exception
+    private Object execute( LdapServer ldapServer, ContextOperation operation ) throws Exception
     {
-        Hashtable<String, Object> env = getEnvironment( config );
+        Hashtable<String, Object> env = getEnvironment( ldapServer );
 
         if ( ctx == null )
         {
@@ -223,7 +214,7 @@
             }
             catch ( NamingException ne )
             {
-                String message = "Failed to get initial context " + ( String ) env.get( Context.PROVIDER_URL );
+                String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
                 throw new ServiceConfigurationException( message, ne );
             }
         }
@@ -232,14 +223,14 @@
     }
 
 
-    private Hashtable<String, Object> getEnvironment( LdapConfiguration config )
+    private Hashtable<String, Object> getEnvironment( LdapServer ldapServer )
     {
         Hashtable<String, Object> env = new Hashtable<String, Object>();
-        env.put( Context.INITIAL_CONTEXT_FACTORY, config.getInitialContextFactory() );
-        env.put( Context.PROVIDER_URL, config.getSearchBaseDn() );
-        env.put( Context.SECURITY_AUTHENTICATION, config.getSecurityAuthentication() );
-        env.put( Context.SECURITY_CREDENTIALS, config.getSecurityCredentials() );
-        env.put( Context.SECURITY_PRINCIPAL, config.getSecurityPrincipal() );
+        env.put( Context.INITIAL_CONTEXT_FACTORY, ldapServer.getInitialContextFactory() );
+        env.put( Context.PROVIDER_URL, ldapServer.getSearchBaseDn() );
+        env.put( Context.SECURITY_AUTHENTICATION, ldapServer.getSecurityAuthentication() );
+        env.put( Context.SECURITY_CREDENTIALS, ldapServer.getSecurityCredentials() );
+        env.put( Context.SECURITY_PRINCIPAL, ldapServer.getSecurityPrincipal() );
 
         return env;
     }

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java Thu Oct 11 19:39:14 2007
@@ -24,7 +24,7 @@
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
-import org.apache.directory.server.ldap.LdapProtocolProvider;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.SessionRegistry;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -335,7 +335,7 @@
     }
 
 
-    public void setLdapProvider( LdapProtocolProvider provider )
+    public void setLdapProvider( LdapServer provider )
     {
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java Thu Oct 11 19:39:14 2007
@@ -40,7 +40,7 @@
 import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
 import org.apache.directory.server.core.partition.impl.btree.gui.PartitionFrame;
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
-import org.apache.directory.server.ldap.LdapProtocolProvider;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.SessionRegistry;
 import org.apache.directory.server.ldap.gui.SessionsFrame;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
@@ -66,7 +66,7 @@
         EXTENSION_OIDS = Collections.unmodifiableSet( set );
     }
 
-    private LdapProtocolProvider ldapProvider;
+    private LdapServer ldapProvider;
 
 
     public String getOid()
@@ -158,7 +158,7 @@
     }
 
 
-    public void setLdapProvider( LdapProtocolProvider provider )
+    public void setLdapProvider( LdapServer provider )
     {
         this.ldapProvider = provider;
     }

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java Thu Oct 11 19:39:14 2007
@@ -42,7 +42,7 @@
 import org.apache.directory.server.core.sp.StoredProcExecutionManager;
 import org.apache.directory.server.core.sp.java.JavaStoredProcEngineConfig;
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
-import org.apache.directory.server.ldap.LdapProtocolProvider;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.SessionRegistry;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
@@ -169,7 +169,7 @@
     }
 
     
-	public void setLdapProvider(LdapProtocolProvider provider) 
+	public void setLdapProvider( LdapServer provider)
     {
 	}
 }

Copied: directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java (from r583968, directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapProtocolProviderTest.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java?p2=directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java&p1=directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapProtocolProviderTest.java&r1=583968&r2=584030&rev=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapProtocolProviderTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java Thu Oct 11 19:39:14 2007
@@ -27,7 +27,18 @@
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.*;
+import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
+import org.apache.mina.common.SimpleByteBufferAllocator;
+import org.apache.mina.filter.executor.ExecutorFilter;
+import org.apache.mina.transport.socket.nio.SocketAcceptor;
+import org.apache.mina.util.AvailablePortFinder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
 
 
 /**
@@ -37,8 +48,83 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class LdapProtocolProviderTest extends TestCase
+public class LdapServerTest extends TestCase
 {
+    private static final Logger LOG = LoggerFactory.getLogger( LdapServerTest.class.getName() );
+    LdapServer ldapServer;
+    DirectoryService directoryService;
+    ExecutorService ioExecutor;
+    ExecutorService logicExecutor;
+    SocketAcceptor tcpAcceptor;
+
+
+    public void setUp() throws Exception
+    {
+        directoryService = new DefaultDirectoryService();
+        directoryService.startup();
+
+        if ( getName().equals( "testAlternativeConfiguration" ) )
+        {
+            ldapServer.setAbandonHandler( new BogusAbandonHandler() );
+            ldapServer.setAddHandler( new BogusAddHandler() );
+            ldapServer.setBindHandler( new BogusBindHandler() );
+            ldapServer.setCompareHandler( new BogusCompareHandler() );
+            ldapServer.setDeleteHandler( new BogusDeleteHandler() );
+            ldapServer.setModifyDnHandler( new BogusModifyDnHandler() );
+            ldapServer.setModifyHandler( new BogusModifyHandler() );
+            ldapServer.setSearchHandler( new BogusSearchHandler() );
+            ldapServer.setUnbindHandler( new BogusUnbindHandler() );
+        }
+
+        ByteBuffer.setAllocator( new SimpleByteBufferAllocator() );
+        ByteBuffer.setUseDirectBuffers( false );
+        ioExecutor = Executors.newCachedThreadPool();
+        logicExecutor = Executors.newFixedThreadPool( 8 );
+        tcpAcceptor = new SocketAcceptor( Runtime.getRuntime().availableProcessors(), ioExecutor );
+        tcpAcceptor.getFilterChain().addLast( "executor", new ExecutorFilter( logicExecutor ) );
+
+        ldapServer = new LdapServer( tcpAcceptor );
+        ldapServer.setIpPort( AvailablePortFinder.getNextAvailable( 1024 ) );
+        ldapServer.setDirectoryService( directoryService );
+        System.err.println( "********** => " + ldapServer.getIpPort() );
+        ldapServer.start();
+    }
+
+
+    public void tearDown() throws Exception
+    {
+        ldapServer.stop();
+        logicExecutor.shutdown();
+        for (;;) {
+            try {
+                if ( logicExecutor.awaitTermination( Integer.MAX_VALUE, TimeUnit.SECONDS ) )
+                {
+                    break;
+                }
+            }
+            catch ( InterruptedException e )
+            {
+                LOG.error( "Failed to terminate logic executor", e );
+            }
+        }
+
+        ioExecutor.shutdown();
+        for (;;) {
+            try {
+                if ( ioExecutor.awaitTermination( Integer.MAX_VALUE, TimeUnit.SECONDS ) )
+                {
+                    break;
+                }
+            }
+            catch ( InterruptedException e )
+            {
+                LOG.error( "Failed to terminate io executor", e );
+            }
+        }
+        directoryService.shutdown();
+    }
+
+
     /**
      * Tests to make sure all the default handlers are kicking in properly with
      * the right request type.
@@ -48,10 +134,17 @@
      */
     public void testDefaultOperation() throws LdapNamingException
     {
-        DirectoryService directoryService = new DefaultDirectoryService();
-        LdapProtocolProvider provider = new LdapProtocolProvider( directoryService, new LdapConfiguration() );
-        assertNotNull( provider.getCodecFactory() );
-        assertEquals( provider.getName(), LdapProtocolProvider.SERVICE_NAME );
+        assertEquals( ldapServer.getAbandonHandler().getClass(), BogusAbandonHandler.class  );
+        assertEquals( ldapServer.getAddHandler().getClass(), BogusAddHandler.class  );
+        assertEquals( ldapServer.getBindHandler().getClass(), BogusBindHandler.class  );
+        assertEquals( ldapServer.getCompareHandler().getClass(), BogusCompareHandler.class  );
+        assertEquals( ldapServer.getDeleteHandler().getClass(), BogusDeleteHandler.class  );
+        assertEquals( ldapServer.getModifyDnHandler().getClass(), BogusModifyDnHandler.class  );
+        assertEquals( ldapServer.getModifyHandler().getClass(), BogusModifyHandler.class  );
+        assertEquals( ldapServer.getSearchHandler().getClass(), BogusSearchHandler.class  );
+        assertEquals( ldapServer.getUnbindHandler().getClass(), BogusUnbindHandler.class  );
+        assertNotNull( ldapServer.getCodecFactory() );
+        assertEquals( ldapServer.getName(), LdapServer.SERVICE_NAME );
     }
 
 
@@ -64,20 +157,8 @@
      */
     public void testAlternativeConfiguration() throws LdapNamingException
     {
-        DirectoryService directoryService = new DefaultDirectoryService();
-        LdapProtocolProvider provider = new LdapProtocolProvider( directoryService, new LdapConfiguration() );
-        provider.setAbandonHandler( new BogusAbandonHandler() );
-        provider.setAddHandler( new BogusAddHandler() );
-        provider.setBindHandler( new BogusBindHandler() );
-        provider.setCompareHandler( new BogusCompareHandler() );
-        provider.setDeleteHandler( new BogusDeleteHandler() );
-        provider.setModifyDnHandler( new BogusModifyDnHandler() );
-        provider.setModifyHandler( new BogusModifyHandler() );
-        provider.setSearchHandler( new BogusSearchHandler() );
-        provider.setUnbindHandler( new BogusUnbindHandler() );
-
-        assertNotNull( provider.getCodecFactory() );
-        assertEquals( provider.getName(), LdapProtocolProvider.SERVICE_NAME );
+        assertNotNull( ldapServer.getCodecFactory() );
+        assertEquals( ldapServer.getName(), LdapServer.SERVICE_NAME );
     }
 
     public static class BogusAbandonHandler extends AbandonHandler

Propchange: directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/branches/bigbang/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Thu Oct 11 19:39:14 2007
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java (original)
+++ directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java Thu Oct 11 19:39:14 2007
@@ -23,10 +23,8 @@
 import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
-import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -42,33 +40,18 @@
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.jndi.ServerContextFactory;
-import org.apache.directory.server.ldap.ExtendedOperationHandler;
-import org.apache.directory.server.ldap.LdapConfiguration;
-import org.apache.directory.server.ldap.LdapProtocolProvider;
-import org.apache.directory.server.ldap.support.ssl.LdapsInitializer;
+import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
 import org.apache.directory.server.protocol.shared.store.LdifLoadFilter;
-import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
-import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.common.IoFilterChainBuilder;
-import org.apache.mina.common.IoSession;
 import org.apache.mina.common.SimpleByteBufferAllocator;
-import org.apache.mina.common.ThreadModel;
-import org.apache.mina.common.WriteFuture;
 import org.apache.mina.filter.executor.ExecutorFilter;
-import org.apache.mina.transport.socket.nio.DatagramAcceptor;
 import org.apache.mina.transport.socket.nio.SocketAcceptor;
-import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -99,37 +82,29 @@
     private File ldifDirectory;
     private final List<LdifLoadFilter> ldifFilters = new ArrayList<LdifLoadFilter>();
 
-    private LdapConfiguration ldapConfiguration = new LdapConfiguration();
-    private LdapConfiguration ldapsConfiguration = new LdapConfiguration();
+    private LdapServer ldapServer;
+    private LdapServer ldapsServer;
     private DirectoryService directoryService = new DefaultDirectoryService();
 
-    private IoAcceptor tcpAcceptor;
-    protected IoAcceptor udpAcceptor;
+    private SocketAcceptor tcpAcceptor;
     protected ExecutorService ioExecutor;
     protected ExecutorService logicExecutor;
-    private boolean ldapsStarted;
-    private boolean ldapStarted;
 
+    
     public ApacheDS()
     {
-        environment.put( JNDI_KEY, this );
-        environment.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.toString() );
-        environment.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        ldapConfiguration.setEnabled( true );
+        ldapServer.setEnabled( true );
 
         ByteBuffer.setAllocator( new SimpleByteBufferAllocator() );
         ByteBuffer.setUseDirectBuffers( false );
-
         ioExecutor = Executors.newCachedThreadPool();
         logicExecutor = Executors.newFixedThreadPool( maxThreads );
-        udpAcceptor = new DatagramAcceptor();
-        udpAcceptor.getFilterChain().addLast( "executor", new ExecutorFilter( logicExecutor ) );
         tcpAcceptor = new SocketAcceptor( Runtime.getRuntime().availableProcessors(), ioExecutor );
         tcpAcceptor.getFilterChain().addLast( "executor", new ExecutorFilter( logicExecutor ) );
     }
 
 
-    public void startup() throws NamingException
+    public void startup() throws NamingException, IOException
     {
         loadLdifs();
 
@@ -137,35 +112,45 @@
         {
             directoryService.startup();
         }
-        environment.put( JndiPropertyConstants.JNDI_LDAP_ATTRIBUTES_BINARY,
-                directoryService.getEnvironment().get( JndiPropertyConstants.JNDI_LDAP_ATTRIBUTES_BINARY ) );        
-        
-        if ( enableNetworking )
+
+        if ( ldapServer == null )
+        {
+            ldapServer = new LdapServer( tcpAcceptor );
+        }
+
+        if ( ldapsServer == null )
         {
-            startLDAP();
-            startLDAPS();
+            ldapsServer = new LdapServer( tcpAcceptor );
+        }
+
+        if ( ! ldapServer.isStarted() )
+        {
+            ldapServer.start();
+        }
+
+        if ( ldapsServer != null && ! ldapsServer.isStarted() )
+        {
+            ldapsServer.start();
         }
     }
 
 
     public boolean isStarted()
     {
-        return ldapStarted || ldapsStarted;
+        return ldapServer.isStarted() || ldapsServer.isStarted();
     }
     
 
     public void shutdown() throws NamingException
     {
-        if ( ldapStarted )
+        if ( ldapServer.isStarted() )
         {
-            stopLDAP0( ldapConfiguration.getIpPort() );
-            ldapStarted = false;
+            ldapServer.stop();
         }
 
-        if ( ldapsStarted )
+        if ( ldapsServer.isStarted() )
         {
-            stopLDAP0( ldapsConfiguration.getIpPort() );
-            ldapsStarted = false;
+            ldapsServer.stop();
         }
 
         logicExecutor.shutdown();
@@ -200,27 +185,27 @@
     }
 
 
-    public LdapConfiguration getLdapConfiguration()
+    public LdapServer getLdapServer()
     {
-        return ldapConfiguration;
+        return ldapServer;
     }
 
 
-    public void setLdapConfiguration( LdapConfiguration ldapConfiguration )
+    public void setLdapServer( LdapServer ldapServer )
     {
-        this.ldapConfiguration = ldapConfiguration;
+        this.ldapServer = ldapServer;
     }
 
 
-    public LdapConfiguration getLdapsConfiguration()
+    public LdapServer getLdapsServer()
     {
-        return ldapsConfiguration;
+        return ldapsServer;
     }
 
 
-    public void setLdapsConfiguration( LdapConfiguration ldapsConfiguration )
+    public void setLdapsServer( LdapServer ldapsServer )
     {
-        this.ldapsConfiguration = ldapsConfiguration;
+        this.ldapsServer = ldapsServer;
     }
 
     public DirectoryService getDirectoryService()
@@ -295,8 +280,8 @@
     public void setAllowAnonymousAccess( boolean allowAnonymousAccess )
     {
         this.directoryService.setAllowAnonymousAccess( allowAnonymousAccess );
-        this.ldapConfiguration.setAllowAnonymousAccess( allowAnonymousAccess );
-        this.ldapsConfiguration.setAllowAnonymousAccess( allowAnonymousAccess );
+        this.ldapServer.setAllowAnonymousAccess( allowAnonymousAccess );
+        this.ldapsServer.setAllowAnonymousAccess( allowAnonymousAccess );
     }
 
 
@@ -323,11 +308,6 @@
         return tcpAcceptor;
     }
 
-    public IoAcceptor getUdpAcceptor()
-    {
-        return udpAcceptor;
-    }
-
     // ----------------------------------------------------------------------
     // From ServerContextFactory: presently in intermediate step but these
     // methods will be moved to the appropriate protocol service eventually.
@@ -506,149 +486,6 @@
             int count = loader.execute();
             LOG.info( "Loaded " + count + " entries from LDIF file '" + getCanonical( ldifFile ) + "'" );
             addFileEntry( root, ldifFile );
-        }
-    }
-
-
-    /**
-     * Starts up the LDAP protocol provider to service LDAP requests
-     *
-     * @throws NamingException if there are problems starting the LDAP provider
-     */
-    private void startLDAP() throws NamingException
-    {
-        // Skip if disabled
-        if ( ! ldapConfiguration.isEnabled() )
-        {
-            return;
-        }
-
-        DefaultIoFilterChainBuilder chain = new DefaultIoFilterChainBuilder();
-        startLDAP0( ldapConfiguration, ldapConfiguration.getIpPort(), chain );
-    }
-
-
-    /**
-     * Starts up the LDAPS protocol provider to service LDAPS requests
-     *
-     * @throws NamingException if there are problems starting the LDAPS provider
-     */
-    private void startLDAPS() throws NamingException
-    {
-        // Skip if disabled
-        if ( !( ldapsConfiguration.isEnabled() && ldapsConfiguration.isEnableLdaps() ) )
-        {
-            return;
-        }
-
-        char[] certPasswordChars = ldapsConfiguration.getLdapsCertificatePassword().toCharArray();
-        String storePath = ldapsConfiguration.getLdapsCertificateFile().getPath();
-
-        IoFilterChainBuilder chain = LdapsInitializer.init( certPasswordChars, storePath );
-        ldapsStarted = true;
-
-        startLDAP0( ldapsConfiguration, ldapsConfiguration.getIpPort(), chain );
-    }
-
-
-    private void startLDAP0( LdapConfiguration ldapConfig, int port, IoFilterChainBuilder chainBuilder )
-        throws LdapNamingException, LdapConfigurationException
-    {
-        // Register all extended operation handlers.
-        LdapProtocolProvider protocolProvider = new LdapProtocolProvider( directoryService, ldapConfig );
-
-        for ( ExtendedOperationHandler h : ldapConfig.getExtendedOperationHandlers() )
-        {
-            protocolProvider.addExtendedOperationHandler( h );
-            LOG.info( "Added Extended Request Handler: " + h.getOid() );
-            h.setLdapProvider( protocolProvider );
-            PartitionNexus nexus = directoryService.getPartitionNexus();
-            nexus.registerSupportedExtensions( h.getExtensionOids() );
-        }
-
-        try
-        {
-            SocketAcceptorConfig acceptorCfg = new SocketAcceptorConfig();
-
-            // Disable the disconnection of the clients on unbind
-            acceptorCfg.setDisconnectOnUnbind( false );
-            acceptorCfg.setReuseAddress( true );
-            acceptorCfg.setFilterChainBuilder( chainBuilder );
-            acceptorCfg.setThreadModel( ThreadModel.MANUAL );
-
-            acceptorCfg.getSessionConfig().setTcpNoDelay( true );
-
-            tcpAcceptor.bind( new InetSocketAddress( port ), protocolProvider.getHandler(), acceptorCfg );
-            ldapStarted = true;
-
-            if ( LOG.isInfoEnabled() )
-            {
-                LOG.info( "Successful bind of an LDAP Service (" + port + ") is complete." );
-            }
-        }
-        catch ( IOException e )
-        {
-            String msg = "Failed to bind an LDAP service (" + port + ") to the service registry.";
-            LdapConfigurationException lce = new LdapConfigurationException( msg );
-            lce.setRootCause( e );
-            LOG.error( msg, e );
-            throw lce;
-        }
-    }
-
-    private void stopLDAP0( int port )
-    {
-        try
-        {
-            // we should unbind the service before we begin sending the notice
-            // of disconnect so new connections are not formed while we process
-            List<WriteFuture> writeFutures = new ArrayList<WriteFuture>();
-
-            // If the socket has already been unbound as with a successful
-            // GracefulShutdownRequest then this will complain that the service
-            // is not bound - this is ok because the GracefulShutdown has already
-            // sent notices to to the existing active sessions
-            List<IoSession> sessions;
-
-            try
-            {
-                sessions = new ArrayList<IoSession>( tcpAcceptor.getManagedSessions( new InetSocketAddress( port ) ) );
-            }
-            catch ( IllegalArgumentException e )
-            {
-                LOG.warn( "Seems like the LDAP service (" + port + ") has already been unbound." );
-                return;
-            }
-
-            tcpAcceptor.unbind( new InetSocketAddress( port ) );
-
-            if ( LOG.isInfoEnabled() )
-            {
-                LOG.info( "Unbind of an LDAP service (" + port + ") is complete." );
-                LOG.info( "Sending notice of disconnect to existing clients sessions." );
-            }
-
-            // Send Notification of Disconnection messages to all connected clients.
-            if ( sessions != null )
-            {
-                for ( IoSession session:sessions )
-                {
-                    writeFutures.add( session.write( NoticeOfDisconnect.UNAVAILABLE ) );
-                }
-            }
-
-            // And close the connections when the NoDs are sent.
-            Iterator<IoSession> sessionIt = sessions.iterator();
-
-            for ( WriteFuture future:writeFutures )
-            {
-                future.join( 1000 );
-                sessionIt.next().close();
-            }
-        }
-        catch ( Exception e )
-        {
-            LOG.warn( "Failed to sent NoD.", e );
         }
     }
 

Modified: directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/diagnosticcmd/DiagnosticCommandExecutor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/diagnosticcmd/DiagnosticCommandExecutor.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/diagnosticcmd/DiagnosticCommandExecutor.java (original)
+++ directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/diagnosticcmd/DiagnosticCommandExecutor.java Thu Oct 11 19:39:14 2007
@@ -197,7 +197,7 @@
         }
         else if ( getApacheDS() != null )
         {
-            port = getApacheDS().getLdapConfiguration().getIpPort();
+            port = getApacheDS().getLdapServer().getIpPort();
 
             if ( isDebugEnabled() )
             {

Modified: directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/disconnectnotificationcmd/DisconnectNotificationCommandExecutor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/disconnectnotificationcmd/DisconnectNotificationCommandExecutor.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/disconnectnotificationcmd/DisconnectNotificationCommandExecutor.java (original)
+++ directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/disconnectnotificationcmd/DisconnectNotificationCommandExecutor.java Thu Oct 11 19:39:14 2007
@@ -210,7 +210,7 @@
         }
         else if ( getApacheDS() != null )
         {
-            port = getApacheDS().getLdapConfiguration().getIpPort();
+            port = getApacheDS().getLdapServer().getIpPort();
 
             if ( isDebugEnabled() )
             {

Modified: directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/exportcmd/ExportCommandExecutor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/exportcmd/ExportCommandExecutor.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/exportcmd/ExportCommandExecutor.java (original)
+++ directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/exportcmd/ExportCommandExecutor.java Thu Oct 11 19:39:14 2007
@@ -420,7 +420,7 @@
         }
         else if ( getApacheDS() != null )
         {
-            port = getApacheDS().getLdapConfiguration().getIpPort();
+            port = getApacheDS().getLdapServer().getIpPort();
 
             if ( isDebugEnabled() )
             {

Modified: directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/gracefulshutdowncmd/GracefulShutdownCommandExecutor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/gracefulshutdowncmd/GracefulShutdownCommandExecutor.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/gracefulshutdowncmd/GracefulShutdownCommandExecutor.java (original)
+++ directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/gracefulshutdowncmd/GracefulShutdownCommandExecutor.java Thu Oct 11 19:39:14 2007
@@ -254,7 +254,7 @@
         }
         else if ( getApacheDS() != null )
         {
-            port = getApacheDS().getLdapConfiguration().getIpPort();
+            port = getApacheDS().getLdapServer().getIpPort();
 
             if ( isDebugEnabled() )
             {

Modified: directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java (original)
+++ directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java Thu Oct 11 19:39:14 2007
@@ -706,7 +706,7 @@
         }
         else if ( getApacheDS() != null )
         {
-            port = getApacheDS().getLdapConfiguration().getIpPort();
+            port = getApacheDS().getLdapServer().getIpPort();
 
             if ( isDebugEnabled() )
             {

Modified: directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/storedprocedurecmd/StoredProcedureCommandExecutor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/storedprocedurecmd/StoredProcedureCommandExecutor.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/storedprocedurecmd/StoredProcedureCommandExecutor.java (original)
+++ directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/storedprocedurecmd/StoredProcedureCommandExecutor.java Thu Oct 11 19:39:14 2007
@@ -206,7 +206,7 @@
         }
         else if ( getApacheDS() != null )
         {
-            port = getApacheDS().getLdapConfiguration().getIpPort();
+            port = getApacheDS().getLdapServer().getIpPort();
 
             if ( isDebugEnabled() )
             {

Modified: directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerFastTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerFastTest.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerFastTest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerFastTest.java Thu Oct 11 19:39:14 2007
@@ -202,7 +202,7 @@
     {
         doDelete( apacheDS.getDirectoryService().getWorkingDirectory() );
         port = AvailablePortFinder.getNextAvailable( 1024 );
-        apacheDS.getLdapConfiguration().setIpPort( port );
+        apacheDS.getLdapServer().setIpPort( port );
         apacheDS.getDirectoryService().setShutdownHookEnabled( false );
         apacheDS.startup();
         

Modified: directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Thu Oct 11 19:39:14 2007
@@ -218,7 +218,7 @@
 
         doDelete( apacheDS.getDirectoryService().getWorkingDirectory() );
         port = AvailablePortFinder.getNextAvailable( 1024 );
-        apacheDS.getLdapConfiguration().setIpPort( port );
+        apacheDS.getLdapServer().setIpPort( port );
         apacheDS.getDirectoryService().setShutdownHookEnabled( false );
         apacheDS.startup();
         

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java?rev=584030&r1=584029&r2=584030&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java Thu Oct 11 19:39:14 2007
@@ -107,7 +107,7 @@
 
         doDelete( apacheDS.getDirectoryService().getWorkingDirectory() );
         port = AvailablePortFinder.getNextAvailable( 1024 );
-        apacheDS.getLdapConfiguration().setIpPort( port );
+        apacheDS.getLdapServer().setIpPort( port );
         apacheDS.getDirectoryService().setShutdownHookEnabled( false );
 
         super.setUp();