Methods Summary |
---|
public static void | bindClassLoader(java.lang.Object name)Binds a naming context to a class loader.
bindClassLoader(name, null);
|
public static void | bindClassLoader(java.lang.Object name, java.lang.Object token)Binds a naming context to a thread.
bindClassLoader
(name, token, Thread.currentThread().getContextClassLoader());
|
public static void | bindClassLoader(java.lang.Object name, java.lang.Object token, java.lang.ClassLoader classLoader)Binds a naming context to a thread.
if (ContextAccessController.checkSecurityToken(name, token)) {
Context context = (Context) contextNameBindings.get(name);
if (context == null)
throw new NamingException
(sm.getString("contextBindings.unknownContext", name));
clBindings.put(classLoader, context);
clNameBindings.put(classLoader, name);
}
|
public static void | bindContext(java.lang.Object name, javax.naming.Context context)Binds a context name.
// --------------------------------------------------------- Public Methods
bindContext(name, context, null);
|
public static void | bindContext(java.lang.Object name, javax.naming.Context context, java.lang.Object token)Binds a context name.
if (ContextAccessController.checkSecurityToken(name, token))
contextNameBindings.put(name, context);
|
public static void | bindThread(java.lang.Object name)Binds a naming context to a thread.
bindThread(name, null);
|
public static void | bindThread(java.lang.Object name, java.lang.Object token)Binds a naming context to a thread.
if (ContextAccessController.checkSecurityToken(name, token)) {
Context context = (Context) contextNameBindings.get(name);
if (context == null)
throw new NamingException
(sm.getString("contextBindings.unknownContext", name));
threadBindings.put(Thread.currentThread(), context);
threadNameBindings.put(Thread.currentThread(), name);
}
|
public static javax.naming.Context | getClassLoader()Retrieves the naming context bound to a class loader.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Context context = null;
do {
context = (Context) clBindings.get(cl);
if (context != null) {
return context;
}
} while ((cl = cl.getParent()) != null);
throw new NamingException
(sm.getString("contextBindings.noContextBoundToCL"));
|
static java.lang.Object | getClassLoaderName()Retrieves the naming context name bound to a class loader.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Object name = null;
do {
name = clNameBindings.get(cl);
if (name != null) {
return name;
}
} while ((cl = cl.getParent()) != null);
throw new NamingException
(sm.getString("contextBindings.noContextBoundToCL"));
|
static javax.naming.Context | getContext(java.lang.Object name)Retrieve a naming context.
return (Context) contextNameBindings.get(name);
|
public static javax.naming.Context | getThread()Retrieves the naming context bound to a thread.
Context context =
(Context) threadBindings.get(Thread.currentThread());
if (context == null)
throw new NamingException
(sm.getString("contextBindings.noContextBoundToThread"));
return context;
|
static java.lang.Object | getThreadName()Retrieves the naming context name bound to a thread.
Object name = threadNameBindings.get(Thread.currentThread());
if (name == null)
throw new NamingException
(sm.getString("contextBindings.noContextBoundToThread"));
return name;
|
public static boolean | isClassLoaderBound()Tests if current class loader is bound to a context.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
do {
if (clBindings.containsKey(cl)) {
return true;
}
} while ((cl = cl.getParent()) != null);
return false;
|
public static boolean | isThreadBound()Tests if current thread is bound to a context.
return (threadBindings.containsKey(Thread.currentThread()));
|
public static void | unbindClassLoader(java.lang.Object name)Unbinds a naming context to a class loader.
unbindClassLoader(name, null);
|
public static void | unbindClassLoader(java.lang.Object name, java.lang.Object token)Unbinds a naming context to a class loader.
unbindClassLoader(name, token,
Thread.currentThread().getContextClassLoader());
|
public static void | unbindClassLoader(java.lang.Object name, java.lang.Object token, java.lang.ClassLoader classLoader)Unbinds a naming context to a class loader.
if (ContextAccessController.checkSecurityToken(name, token)) {
Object n = clNameBindings.get(classLoader);
if ((n==null) || !(n.equals(name))) {
return;
}
clBindings.remove(classLoader);
clNameBindings.remove(classLoader);
}
|
public static void | unbindContext(java.lang.Object name)Unbind context name.
unbindContext(name, null);
|
public static void | unbindContext(java.lang.Object name, java.lang.Object token)Unbind context name.
if (ContextAccessController.checkSecurityToken(name, token))
contextNameBindings.remove(name);
|
public static void | unbindThread(java.lang.Object name)Unbinds a naming context to a thread.
unbindThread(name, null);
|
public static void | unbindThread(java.lang.Object name, java.lang.Object token)Unbinds a naming context to a thread.
if (ContextAccessController.checkSecurityToken(name, token)) {
threadBindings.remove(Thread.currentThread());
threadNameBindings.remove(Thread.currentThread());
}
|