org.apache.ldap.server.jndi
Class AbstractContextFactory

java.lang.Object
  extended byorg.apache.ldap.server.jndi.AbstractContextFactory
All Implemented Interfaces:
ContextFactoryServiceListener, javax.naming.spi.InitialContextFactory
Direct Known Subclasses:
CoreContextFactory

public abstract class AbstractContextFactory
extends java.lang.Object
implements javax.naming.spi.InitialContextFactory, ContextFactoryServiceListener

A server-side JNDI provider implementation of InitialContextFactory. This class can be utilized via JNDI API in the standard fashion:

Hashtable env = new Hashtable(); env.put( Context.PROVIDER_URL, "ou=system" ); env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.ldap.server.jndi.CoreContextFactory" ); InitialContext initialContext = new InitialContext( env );

Unfortunately, InitialContext creates a new instance of InitialContextFactory implementation everytime it is instantiated, so this factory maintains only a static, singleton instance of ContextFactoryService, which provides actual implementation. Please note that you'll also have to maintain any stateful information as using singleton pattern if you're going to extend this factory.

This class implements ContextFactoryServiceListener. This means that you can listen to the changes occurs to ContextFactoryService, and react to it (e.g. executing additional business logic).

Version:
$Rev: 264732 $, $Date: 2005-08-30 04:04:51 -0400 (Tue, 30 Aug 2005) $
Author:
Apache Directory Project
See Also:
InitialContextFactory

Constructor Summary
protected AbstractContextFactory()
          Creates a new instance.
 
Method Summary
 javax.naming.Context getInitialContext(java.util.Hashtable env)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ldap.server.jndi.ContextFactoryServiceListener
afterShutdown, afterStartup, afterSync, beforeShutdown, beforeStartup, beforeSync
 

Constructor Detail

AbstractContextFactory

protected AbstractContextFactory()
Creates a new instance.

Method Detail

getInitialContext

public final javax.naming.Context getInitialContext(java.util.Hashtable env)
                                             throws javax.naming.NamingException
Specified by:
getInitialContext in interface javax.naming.spi.InitialContextFactory
Throws:
javax.naming.NamingException