This sounds great Emmanuel thanks!

Alex

On 10/19/07, Emmanuel Lecharny <elecharny@gmail.com> wrote:
Hi,

while removing the SASL chain, I had some problem with some access to
DirectoryService instance. As the BindHandler were initialized in the
LdapServer constructor, the DirectoryService is null as it is
initialized after.

What I suggest is to initialize the default handler in the
LdapServer.start() method,
just before the server launch :

...
        /*
         * The serveur is now initialized, we can
         * install the default requests handlers, which need
         * access to the DirectoryServer instance.
         */
        installDefaultHandlers();

        startLDAP0( getIpPort(), chain );

        started = true;
    }

Here, the installDefauktHandlers() method will install the default
handlers if no specific handler has been installed :

    /**
     * Install the LDAP request handlers.
     */
    private void installDefaultHandlers()
    {
        if ( getAbandonHandler() == null )
        {
            setAbandonHandler( new DefaultAbandonHandler() );
        }

...

I have tested this approach, and it works perfectly well, and let the
user define its own handler in a embedded server.

I will commit this code in bigbang branch, but if anyone has a better
solution, I would be glad to revert this code !

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com