public class URLPreferringContextDecorator extends Object implements Context, ContextDecorator, Serializable
Context implementation that
prefers to use an URL context for some operation if the JNDI name contains
a scheme rather than the original. This is the behavior of InitialContext
which we need to restore in the contexts created by the AccessCheckingInitialContextFactoryBuilder
(which an InitialContext uses exclusively if the builder is set).
This is important because RHQ server has its own initial context factory
builder that creates factories that in turn create contexts. If the default
InitialContext implementation was used, we'd never be able to lookup
scheme-based names because the default implementation of the InitialContext
always uses the default context of the builder if one is installed no matter
the scheme in the name.
The AccessCheckingInitialContextFactoryBuilder wraps the context returned
by the factory in an instance of this class and thus is restoring the original
intended behavior of the InitialContext. It looks at the name being looked
up (bound or whatever) and prefers to use the URL context factories if the name
contains the scheme (as does the InitialContext if no builder is installed).
If the name doesn't contain a scheme, the provided default context factory is used to
look up the name.
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES| Constructor and Description |
|---|
URLPreferringContextDecorator() |
URLPreferringContextDecorator(Context ctx) |
public URLPreferringContextDecorator()
public URLPreferringContextDecorator(Context ctx)
public void init(Context context)
init in interface ContextDecoratorprotected Context getOriginal() throws NamingException
NamingExceptionprotected Context getURLOrDefaultInitCtx(Name name) throws NamingException
NamingExceptionprotected Context getURLOrDefaultInitCtx(String name) throws NamingException
NamingExceptionpublic Object lookup(Name name) throws NamingException
lookup in interface ContextNamingExceptionpublic Object lookup(String name) throws NamingException
lookup in interface ContextNamingExceptionpublic void bind(Name name, Object obj) throws NamingException
bind in interface ContextNamingExceptionpublic void bind(String name, Object obj) throws NamingException
bind in interface ContextNamingExceptionpublic void rebind(Name name, Object obj) throws NamingException
rebind in interface ContextNamingExceptionpublic void rebind(String name, Object obj) throws NamingException
rebind in interface ContextNamingExceptionpublic void unbind(Name name) throws NamingException
unbind in interface ContextNamingExceptionpublic void unbind(String name) throws NamingException
unbind in interface ContextNamingExceptionpublic void rename(Name oldName, Name newName) throws NamingException
rename in interface ContextNamingExceptionpublic void rename(String oldName, String newName) throws NamingException
rename in interface ContextNamingExceptionpublic NamingEnumeration<NameClassPair> list(Name name) throws NamingException
list in interface ContextNamingExceptionpublic NamingEnumeration<NameClassPair> list(String name) throws NamingException
list in interface ContextNamingExceptionpublic NamingEnumeration<Binding> listBindings(Name name) throws NamingException
listBindings in interface ContextNamingExceptionpublic NamingEnumeration<Binding> listBindings(String name) throws NamingException
listBindings in interface ContextNamingExceptionpublic void destroySubcontext(Name name) throws NamingException
destroySubcontext in interface ContextNamingExceptionpublic void destroySubcontext(String name) throws NamingException
destroySubcontext in interface ContextNamingExceptionpublic Context createSubcontext(Name name) throws NamingException
createSubcontext in interface ContextNamingExceptionpublic Context createSubcontext(String name) throws NamingException
createSubcontext in interface ContextNamingExceptionpublic Object lookupLink(Name name) throws NamingException
lookupLink in interface ContextNamingExceptionpublic Object lookupLink(String name) throws NamingException
lookupLink in interface ContextNamingExceptionpublic NameParser getNameParser(Name name) throws NamingException
getNameParser in interface ContextNamingExceptionpublic NameParser getNameParser(String name) throws NamingException
getNameParser in interface ContextNamingExceptionpublic Name composeName(Name name, Name prefix) throws NamingException
composeName in interface ContextNamingExceptionpublic String composeName(String name, String prefix) throws NamingException
composeName in interface ContextNamingExceptionpublic Object addToEnvironment(String propName, Object propVal) throws NamingException
addToEnvironment in interface ContextNamingExceptionpublic Object removeFromEnvironment(String propName) throws NamingException
removeFromEnvironment in interface ContextNamingExceptionpublic Hashtable<?,?> getEnvironment() throws NamingException
getEnvironment in interface ContextNamingExceptionpublic void close()
throws NamingException
close in interface ContextNamingExceptionpublic String getNameInNamespace() throws NamingException
getNameInNamespace in interface ContextNamingExceptionCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.