1 /*
2 * JBoss, the OpenSource J2EE webOS
3 *
4 * Distributable under LGPL license.
5 * See terms of license at gnu.org.
6 */
7 package org.jboss.naming;
8
9 import java.util.Hashtable;
10 import javax.naming.Context;
11 import javax.naming.NamingException;
12
13 /** A variation of the org.jnp.interfaces.NamingContextFactory
14 * InitialContextFactory implementation that maintains the last envrionment
15 * used to create an InitialContext in a thread local variable for
16 * access within the scope of the InitialContext. This can be used by
17 * the EJB handles to save the context that should be used to perform the
18 * looks when the handle is restored.
19 *
20 * @see org.jnp.interfaces.NamingContextFactory
21 *
22 * @author Scott.Stark@jboss.org
23 * @version $Revision: 1.1.2.1 $
24 */
25 public class NamingContextFactory extends org.jnp.interfaces.NamingContextFactory
26 {
27 public static final ThreadLocal lastInitialContextEnv = new ThreadLocal();
28
29 // InitialContextFactory implementation --------------------------
30 public Context getInitialContext(Hashtable env)
31 throws NamingException
32 {
33 lastInitialContextEnv.set(env);
34 return super.getInitialContext(env);
35 }
36 }