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