Package org.apache.camel.support.jndi
Class JndiContext
- java.lang.Object
-
- org.apache.camel.support.jndi.JndiContext
-
- All Implemented Interfaces:
Serializable
,Context
public class JndiContext extends Object implements Context, Serializable
A default JNDI context- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static NameParser
NAME_PARSER
static String
SEPARATOR
-
Fields inherited from interface javax.naming.Context
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 Summary
Constructors Modifier Constructor Description JndiContext()
JndiContext(Hashtable<String,Object> env)
JndiContext(Hashtable<String,Object> environment, Map<String,Object> bindings)
JndiContext(Hashtable<String,Object> environment, Map<String,Object> bindings, String nameInNamespace)
protected
JndiContext(JndiContext clone, Hashtable<String,Object> env)
protected
JndiContext(JndiContext clone, Hashtable<String,Object> env, String nameInNamespace)
-
Method Summary
-
-
-
Field Detail
-
SEPARATOR
public static final String SEPARATOR
- See Also:
- Constant Field Values
-
NAME_PARSER
protected static final NameParser NAME_PARSER
-
-
Constructor Detail
-
JndiContext
public JndiContext(Hashtable<String,Object> environment, Map<String,Object> bindings)
-
JndiContext
public JndiContext(Hashtable<String,Object> environment, Map<String,Object> bindings, String nameInNamespace)
-
JndiContext
protected JndiContext(JndiContext clone, Hashtable<String,Object> env)
-
JndiContext
protected JndiContext(JndiContext clone, Hashtable<String,Object> env, String nameInNamespace)
-
-
Method Detail
-
createBindingsMapFromEnvironment
public static Map<String,Object> createBindingsMapFromEnvironment(Hashtable<String,Object> env) throws Exception
A helper method to create the JNDI bindings from the input environment properties using $foo.class to point to a class name with $foo.* being properties set on the injected bean- Throws:
Exception
-
freeze
public void freeze()
-
internalBind
protected Map<String,Object> internalBind(String name, Object value) throws NamingException
internalBind is intended for use only during setup or possibly by suitably synchronized superclasses. It binds every possible lookup into a map in each context. To do this, each context strips off one name segment and if necessary creates a new context for it. Then it asks that context to bind the remaining name. It returns a map containing all the bindings from the next context, plus the context it just created (if it in fact created it). (the names are suitably extended by the segment originally lopped off).- Throws:
NamingException
-
newContext
protected JndiContext newContext()
-
addToEnvironment
public Object addToEnvironment(String propName, Object propVal) throws NamingException
- Specified by:
addToEnvironment
in interfaceContext
- Throws:
NamingException
-
getEnvironment
public Hashtable<String,Object> getEnvironment() throws NamingException
- Specified by:
getEnvironment
in interfaceContext
- Throws:
NamingException
-
removeFromEnvironment
public Object removeFromEnvironment(String propName) throws NamingException
- Specified by:
removeFromEnvironment
in interfaceContext
- Throws:
NamingException
-
lookup
public Object lookup(String name) throws NamingException
- Specified by:
lookup
in interfaceContext
- Throws:
NamingException
-
lookup
public Object lookup(Name name) throws NamingException
- Specified by:
lookup
in interfaceContext
- Throws:
NamingException
-
lookupLink
public Object lookupLink(String name) throws NamingException
- Specified by:
lookupLink
in interfaceContext
- Throws:
NamingException
-
composeName
public Name composeName(Name name, Name prefix) throws NamingException
- Specified by:
composeName
in interfaceContext
- Throws:
NamingException
-
composeName
public String composeName(String name, String prefix) throws NamingException
- Specified by:
composeName
in interfaceContext
- Throws:
NamingException
-
list
public NamingEnumeration<NameClassPair> list(String name) throws NamingException
- Specified by:
list
in interfaceContext
- Throws:
NamingException
-
listBindings
public NamingEnumeration<Binding> listBindings(String name) throws NamingException
- Specified by:
listBindings
in interfaceContext
- Throws:
NamingException
-
lookupLink
public Object lookupLink(Name name) throws NamingException
- Specified by:
lookupLink
in interfaceContext
- Throws:
NamingException
-
list
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException
- Specified by:
list
in interfaceContext
- Throws:
NamingException
-
listBindings
public NamingEnumeration<Binding> listBindings(Name name) throws NamingException
- Specified by:
listBindings
in interfaceContext
- Throws:
NamingException
-
bind
public void bind(Name name, Object value) throws NamingException
- Specified by:
bind
in interfaceContext
- Throws:
NamingException
-
bind
public void bind(String name, Object value) throws NamingException
- Specified by:
bind
in interfaceContext
- Throws:
NamingException
-
close
public void close() throws NamingException
- Specified by:
close
in interfaceContext
- Throws:
NamingException
-
createSubcontext
public Context createSubcontext(Name name) throws NamingException
- Specified by:
createSubcontext
in interfaceContext
- Throws:
NamingException
-
createSubcontext
public Context createSubcontext(String name) throws NamingException
- Specified by:
createSubcontext
in interfaceContext
- Throws:
NamingException
-
destroySubcontext
public void destroySubcontext(Name name) throws NamingException
- Specified by:
destroySubcontext
in interfaceContext
- Throws:
NamingException
-
destroySubcontext
public void destroySubcontext(String name) throws NamingException
- Specified by:
destroySubcontext
in interfaceContext
- Throws:
NamingException
-
getNameInNamespace
public String getNameInNamespace() throws NamingException
- Specified by:
getNameInNamespace
in interfaceContext
- Throws:
NamingException
-
getNameParser
public NameParser getNameParser(Name name) throws NamingException
- Specified by:
getNameParser
in interfaceContext
- Throws:
NamingException
-
getNameParser
public NameParser getNameParser(String name) throws NamingException
- Specified by:
getNameParser
in interfaceContext
- Throws:
NamingException
-
rebind
public void rebind(Name name, Object value) throws NamingException
- Specified by:
rebind
in interfaceContext
- Throws:
NamingException
-
rebind
public void rebind(String name, Object value) throws NamingException
- Specified by:
rebind
in interfaceContext
- Throws:
NamingException
-
rename
public void rename(Name oldName, Name newName) throws NamingException
- Specified by:
rename
in interfaceContext
- Throws:
NamingException
-
rename
public void rename(String oldName, String newName) throws NamingException
- Specified by:
rename
in interfaceContext
- Throws:
NamingException
-
unbind
public void unbind(Name name) throws NamingException
- Specified by:
unbind
in interfaceContext
- Throws:
NamingException
-
unbind
public void unbind(String name) throws NamingException
- Specified by:
unbind
in interfaceContext
- Throws:
NamingException
-
-