Top Description Fields Constructors Methods
org.apache.naming

public Class ContextBindings

extends Object
Class Inheritance
Imports
java.util.Map, java.util.concurrent.ConcurrentHashMap, javax.naming.Context, .NamingException

Handles the associations : The objects are typically Catalina Server or Context objects.
Author
Remy Maucherat

Field Summary

Modifier and TypeField and Description
private static final Map<ClassLoader, Context>
clBindings

Bindings class loader - naming context.

private static final Map<ClassLoader, Object>
clObjectBindings

Bindings class loader - object.

private static final Map<Object, Context>
objectBindings

Bindings object - naming context.

protected static final StringManager
sm

The string manager for this package.

private static final Map<Thread, Context>
threadBindings

Bindings thread - naming context.

private static final Map<Thread, Object>
threadObjectBindings

Bindings thread - object.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
bindClassLoader(Object
Object bound to the required naming context
obj
,
Object
Security token
token
,
ClassLoader
The class loader to bind to the naming context
classLoader
)

Binds a naming context to a class loader.

public static void
bindContext(Object
Object to bind with naming context
obj
,
Context
Associated naming context instance
context
)

Binds an object and a naming context.

public static void
bindContext(Object
Object to bind with naming context
obj
,
Context
Associated naming context instance
context
,
Object
Security token
token
)

Binds an object and a naming context.

public static void
bindThread(Object
Object bound to the required naming context
obj
,
Object
Security token
token
)

Binds a naming context to a thread.

public static Context

Returns:

the naming context bound to current class loader or one of its parents
getClassLoader
()

Retrieves the naming context bound to a class loader.

pack-priv static String
getClassLoaderName()

Retrieves the name of the object bound to the naming context that is also bound to the thread context class loader.

pack-priv static Context
getContext(Object
Object bound to the required naming context
obj
)

Retrieve a naming context.

public static Context

Returns:

The naming context bound to the current thread.
getThread
()

Retrieves the naming context bound to the current thread.

pack-priv static String
getThreadName()

Retrieves the name of the object bound to the naming context that is also bound to the current thread.

public static boolean

Returns:

true if the thread context class loader or one of its parents is bound to a naming context, otherwise false
isClassLoaderBound
()

Tests if the thread context class loader is bound to a context.

public static boolean

Returns:

true if the current thread is bound to a naming context, otherwise false
isThreadBound
()

Tests if current thread is bound to a naming context.

public static void
unbindClassLoader(Object
Object bound to the required naming context
obj
,
Object
Security token
token
,
ClassLoader
The class loader bound to the naming context
classLoader
)

Unbinds a naming context and a class loader.

public static void
unbindContext(Object
Object to unbind
obj
,
Object
Security token
token
)

Unbinds an object and a naming context.

public static void
unbindThread(Object
Object bound to the required naming context
obj
,
Object
Security token
token
)

Unbinds a thread and a naming context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clBindingsback to summary
private static final Map<ClassLoader, Context> clBindings

Bindings class loader - naming context. Keyed by class loader.

clObjectBindingsback to summary
private static final Map<ClassLoader, Object> clObjectBindings

Bindings class loader - object. Keyed by class loader.

objectBindingsback to summary
private static final Map<Object, Context> objectBindings

Bindings object - naming context. Keyed by object.

smback to summary
protected static final StringManager sm

The string manager for this package.

threadBindingsback to summary
private static final Map<Thread, Context> threadBindings

Bindings thread - naming context. Keyed by thread.

threadObjectBindingsback to summary
private static final Map<Thread, Object> threadObjectBindings

Bindings thread - object. Keyed by thread.

Constructor Detail

ContextBindingsback to summary
public ContextBindings()

Method Detail

bindClassLoaderback to summary
public static void bindClassLoader(Object obj, Object token, ClassLoader classLoader) throws NamingException

Binds a naming context to a class loader.

Parameters
obj:Object

Object bound to the required naming context

token:Object

Security token

classLoader:ClassLoader

The class loader to bind to the naming context

Exceptions
NamingException:
If no naming context is bound to the provided object
bindContextback to summary
public static void bindContext(Object obj, Context context)

Binds an object and a naming context.

Parameters
obj:Object

Object to bind with naming context

context:Context

Associated naming context instance

bindContextback to summary
public static void bindContext(Object obj, Context context, Object token)

Binds an object and a naming context.

Parameters
obj:Object

Object to bind with naming context

context:Context

Associated naming context instance

token:Object

Security token

bindThreadback to summary
public static void bindThread(Object obj, Object token) throws NamingException

Binds a naming context to a thread.

Parameters
obj:Object

Object bound to the required naming context

token:Object

Security token

Exceptions
NamingException:
If no naming context is bound to the provided object
getClassLoaderback to summary
public static Context getClassLoader() throws NamingException

Retrieves the naming context bound to a class loader.

Returns:Context

the naming context bound to current class loader or one of its parents

Exceptions
NamingException:
If no naming context was bound
getClassLoaderNameback to summary
pack-priv static String getClassLoaderName() throws NamingException

Retrieves the name of the object bound to the naming context that is also bound to the thread context class loader.

getContextback to summary
pack-priv static Context getContext(Object obj)

Retrieve a naming context.

Parameters
obj:Object

Object bound to the required naming context

getThreadback to summary
public static Context getThread() throws NamingException

Retrieves the naming context bound to the current thread.

Returns:Context

The naming context bound to the current thread.

Exceptions
NamingException:
If no naming context is bound to the current thread
getThreadNameback to summary
pack-priv static String getThreadName() throws NamingException

Retrieves the name of the object bound to the naming context that is also bound to the current thread.

isClassLoaderBoundback to summary
public static boolean isClassLoaderBound()

Tests if the thread context class loader is bound to a context.

Returns:boolean

true if the thread context class loader or one of its parents is bound to a naming context, otherwise false

isThreadBoundback to summary
public static boolean isThreadBound()

Tests if current thread is bound to a naming context.

Returns:boolean

true if the current thread is bound to a naming context, otherwise false

unbindClassLoaderback to summary
public static void unbindClassLoader(Object obj, Object token, ClassLoader classLoader)

Unbinds a naming context and a class loader.

Parameters
obj:Object

Object bound to the required naming context

token:Object

Security token

classLoader:ClassLoader

The class loader bound to the naming context

unbindContextback to summary
public static void unbindContext(Object obj, Object token)

Unbinds an object and a naming context.

Parameters
obj:Object

Object to unbind

token:Object

Security token

unbindThreadback to summary
public static void unbindThread(Object obj, Object token)

Unbinds a thread and a naming context.

Parameters
obj:Object

Object bound to the required naming context

token:Object

Security token