org.apache.directory.server.core.jndi
Class AbstractContextFactory
java.lang.Object
org.apache.directory.server.core.jndi.AbstractContextFactory
- All Implemented Interfaces:
- javax.naming.spi.InitialContextFactory, DirectoryServiceListener
- Direct Known Subclasses:
- CoreContextFactory
public abstract class AbstractContextFactory
- extends java.lang.Object
- implements javax.naming.spi.InitialContextFactory, DirectoryServiceListener
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.directory.server.core.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
DirectoryService
, 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 DirectoryServiceListener
. This means that
you can listen to the changes occurs to DirectoryService
, and
react to it (e.g. executing additional business logic).
- Version:
- $Rev: 434579 $, $Date: 2006-08-24 20:19:11 -0400 (Thu, 24 Aug 2006) $
- Author:
- Apache Directory Project
- See Also:
InitialContextFactory
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractContextFactory
protected AbstractContextFactory()
- Creates a new instance.
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
getProviderUrl
public static java.lang.String getProviderUrl(java.util.Hashtable env)
getAuthentication
public static java.lang.String getAuthentication(java.util.Hashtable env)
getCredential
public static byte[] getCredential(java.util.Hashtable env)
throws javax.naming.ConfigurationException
- Throws:
javax.naming.ConfigurationException
getPrincipal
public static java.lang.String getPrincipal(java.util.Hashtable env)