org.codehaus.spice.jndikit.memory
Class MemoryInitialContextFactory
java.lang.Object
org.codehaus.spice.jndikit.memory.MemoryInitialContextFactory
- All Implemented Interfaces:
- InitialContextFactory
public class MemoryInitialContextFactory
- extends Object
- implements InitialContextFactory
Initial context factory for memorycontext.
WARNING: This class should never be use used in a real
system. It is is just a class that demonstrates how to write a
basic InitialContextFactory
for MemeoryContext.
However this factory creates a new Context every time which is
rarely desired behaviour.
In a real application you may want the policy of Context
creation to be specific application. Some strategies include.
- ClassLoader-wide. ie Every user who is in same ClassLoader
or loaded from a Child ClassLoader will see same JNDI tree.
In this case the InitialContextFactory should cache root
context in a static variable.
- Thread-specific. ie Give out initial context based on which
thread the caller is in. In this case the InitialContextFactory
should cache root context in a [Inheritable]ThreadLocal
variable.
- Parameter-specific. ie Give out initial context based on
a parameter passed in. The parameter could be passed in as
PROVIDER_URL or another standard context property. In this
case the InitialContextFactory should cache root context(s)
in a static map variable that maps between parameter and
context.
- Version:
- $Revision: 1.1 $
- Author:
- Peter Donald
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MemoryInitialContextFactory
public MemoryInitialContextFactory()
getInitialContext
public Context getInitialContext(Hashtable environment)
throws NamingException
- Specified by:
getInitialContext
in interface InitialContextFactory
- Throws:
NamingException
Copyright © 1999-2012 Codehaus. All Rights Reserved.