Package org.apache.naming
Class ContextBindings
- java.lang.Object
-
- org.apache.naming.ContextBindings
-
public class ContextBindings extends java.lang.ObjectHandles the associations :- Object with a NamingContext
- Calling thread with a NamingContext
- Calling thread with object bound to the same naming context
- Thread context class loader with a NamingContext
- Thread context class loader with object bound to the same NamingContext
- Author:
- Remy Maucherat
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringManagersmThe string manager for this package.
-
Constructor Summary
Constructors Constructor Description ContextBindings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbindClassLoader(java.lang.Object obj, java.lang.Object token, java.lang.ClassLoader classLoader)Binds a naming context to a class loader.static voidbindContext(java.lang.Object obj, javax.naming.Context context)Binds an object and a naming context.static voidbindContext(java.lang.Object obj, javax.naming.Context context, java.lang.Object token)Binds an object and a naming context.static voidbindThread(java.lang.Object obj, java.lang.Object token)Binds a naming context to a thread.static javax.naming.ContextgetClassLoader()Retrieves the naming context bound to a class loader.static javax.naming.ContextgetThread()Retrieves the naming context bound to the current thread.static booleanisClassLoaderBound()Tests if the thread context class loader is bound to a context.static booleanisThreadBound()Tests if current thread is bound to a naming context.static voidunbindClassLoader(java.lang.Object obj, java.lang.Object token, java.lang.ClassLoader classLoader)Unbinds a naming context and a class loader.static voidunbindContext(java.lang.Object obj, java.lang.Object token)Unbinds an object and a naming context.static voidunbindThread(java.lang.Object obj, java.lang.Object token)Unbinds a thread and a naming context.
-
-
-
Field Detail
-
sm
protected static final StringManager sm
The string manager for this package.
-
-
Method Detail
-
bindContext
public static void bindContext(java.lang.Object obj, javax.naming.Context context)Binds an object and a naming context.- Parameters:
obj- Object to bind with naming contextcontext- Associated naming context instance
-
bindContext
public static void bindContext(java.lang.Object obj, javax.naming.Context context, java.lang.Object token)Binds an object and a naming context.- Parameters:
obj- Object to bind with naming contextcontext- Associated naming context instancetoken- Security token
-
unbindContext
public static void unbindContext(java.lang.Object obj, java.lang.Object token)Unbinds an object and a naming context.- Parameters:
obj- Object to unbindtoken- Security token
-
bindThread
public static void bindThread(java.lang.Object obj, java.lang.Object token) throws javax.naming.NamingExceptionBinds a naming context to a thread.- Parameters:
obj- Object bound to the required naming contexttoken- Security token- Throws:
javax.naming.NamingException- If no naming context is bound to the provided object
-
unbindThread
public static void unbindThread(java.lang.Object obj, java.lang.Object token)Unbinds a thread and a naming context.- Parameters:
obj- Object bound to the required naming contexttoken- Security token
-
getThread
public static javax.naming.Context getThread() throws javax.naming.NamingExceptionRetrieves the naming context bound to the current thread.- Returns:
- The naming context bound to the current thread.
- Throws:
javax.naming.NamingException- If no naming context is bound to the current thread
-
isThreadBound
public static boolean isThreadBound()
Tests if current thread is bound to a naming context.- Returns:
trueif the current thread is bound to a naming context, otherwisefalse
-
bindClassLoader
public static void bindClassLoader(java.lang.Object obj, java.lang.Object token, java.lang.ClassLoader classLoader) throws javax.naming.NamingExceptionBinds a naming context to a class loader.- Parameters:
obj- Object bound to the required naming contexttoken- Security tokenclassLoader- The class loader to bind to the naming context- Throws:
javax.naming.NamingException- If no naming context is bound to the provided object
-
unbindClassLoader
public static void unbindClassLoader(java.lang.Object obj, java.lang.Object token, java.lang.ClassLoader classLoader)Unbinds a naming context and a class loader.- Parameters:
obj- Object bound to the required naming contexttoken- Security tokenclassLoader- The class loader bound to the naming context
-
getClassLoader
public static javax.naming.Context getClassLoader() throws javax.naming.NamingExceptionRetrieves the naming context bound to a class loader.- Returns:
- the naming context bound to current class loader or one of its parents
- Throws:
javax.naming.NamingException- If no naming context was bound
-
isClassLoaderBound
public static boolean isClassLoaderBound()
Tests if the thread context class loader is bound to a context.- Returns:
trueif the thread context class loader or one of its parents is bound to a naming context, otherwisefalse
-
-