org.apache.directory.server.core.jndi
Class AbstractContextFactory

java.lang.Object
  extended by 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: 471430 $, $Date: 2006-11-05 15:02:03 +0100 (Sun, 05 Nov 2006) $
Author:
Apache Directory Project
See Also:
InitialContextFactory

Constructor Summary
protected AbstractContextFactory()
          Creates a new instance.
 
Method Summary
static java.lang.String getAuthentication(java.util.Hashtable env)
           
static byte[] getCredential(java.util.Hashtable env)
           
 javax.naming.Context getInitialContext(java.util.Hashtable env)
           
static java.lang.String getPrincipal(java.util.Hashtable env)
           
static java.lang.String getProviderUrl(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.directory.server.core.DirectoryServiceListener
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

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)


Copyright © 2003-2010 Apache Software Foundation. All Rights Reserved.