Package org.wildfly.naming.client
Class AbstractContext
- java.lang.Object
-
- org.wildfly.naming.client.AbstractContext
-
- All Implemented Interfaces:
AutoCloseable,Context
- Direct Known Subclasses:
AbstractFederatingContext,RelativeContext
public abstract class AbstractContext extends Object implements Context, AutoCloseable
An abstractContextimplementation which does not support federation of naming systems (i.e. binding contexts from other naming systems). Such contexts can use names that do not follow the composite name syntax constraints, and may perform better.- Author:
- David M. Lloyd
-
-
Field Summary
-
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 protectedAbstractContext()Construct a new instance.protectedAbstractContext(FastHashtable<String,Object> environment)Construct a new instance.
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.AutoCloseable
close
-
Methods inherited from interface javax.naming.Context
close, getNameInNamespace
-
-
-
-
Constructor Detail
-
AbstractContext
protected AbstractContext(FastHashtable<String,Object> environment)
Construct a new instance. The given environment map is used directly; the caller is responsible for creating a copy if a copy is needed.- Parameters:
environment- the environment map to use
-
AbstractContext
protected AbstractContext()
Construct a new instance. A new, empty environment map is created for this context.
-
-
Method Detail
-
getNativeNameParser
public NameParser getNativeNameParser()
Get the native name parser for this context. The name parser should always yield a compound name; returning a composite name may cause undefined results or infinite loops or recursion. The default implementation returns a name parser forSimpleNameinstances but may be overridden as desired.- Returns:
- the name parser
-
lookup
public Object lookup(String name) throws NamingException
- Specified by:
lookupin interfaceContext- Throws:
NamingException
-
lookup
public Object lookup(Name name) throws NamingException
- Specified by:
lookupin interfaceContext- Throws:
NamingException
-
lookupNative
protected abstract Object lookupNative(Name name) throws NamingException
Look up a compound name within this naming system. The given name is guaranteed not to be aCompositeName.- Parameters:
name- the (compound) name (notnull)- Returns:
- the binding value
- Throws:
NamingException- if an error occurs
-
lookupLink
public Object lookupLink(String name) throws NamingException
- Specified by:
lookupLinkin interfaceContext- Throws:
NamingException
-
lookupLink
public Object lookupLink(Name name) throws NamingException
- Specified by:
lookupLinkin interfaceContext- Throws:
NamingException
-
lookupLinkNative
protected abstract Object lookupLinkNative(Name name) throws NamingException
- Throws:
NamingException
-
bind
public void bind(String name, Object obj) throws NamingException
- Specified by:
bindin interfaceContext- Throws:
NamingException
-
bind
public void bind(Name name, Object obj) throws NamingException
- Specified by:
bindin interfaceContext- Throws:
NamingException
-
bindNative
protected void bindNative(Name name, Object obj) throws NamingException
- Throws:
NamingException
-
rebind
public void rebind(String name, Object obj) throws NamingException
- Specified by:
rebindin interfaceContext- Throws:
NamingException
-
rebind
public void rebind(Name name, Object obj) throws NamingException
- Specified by:
rebindin interfaceContext- Throws:
NamingException
-
rebindNative
protected void rebindNative(Name name, Object obj) throws NamingException
- Throws:
NamingException
-
unbind
public void unbind(String name) throws NamingException
- Specified by:
unbindin interfaceContext- Throws:
NamingException
-
unbind
public void unbind(Name name) throws NamingException
- Specified by:
unbindin interfaceContext- Throws:
NamingException
-
unbindNative
protected void unbindNative(Name name) throws NamingException
- Throws:
NamingException
-
rename
public void rename(String oldName, String newName) throws NamingException
- Specified by:
renamein interfaceContext- Throws:
NamingException
-
rename
public void rename(Name oldName, Name newName) throws NamingException
- Specified by:
renamein interfaceContext- Throws:
NamingException
-
renameNative
protected void renameNative(Name oldName, Name newName) throws NamingException
- Throws:
NamingException
-
list
public CloseableNamingEnumeration<NameClassPair> list(String name) throws NamingException
- Specified by:
listin interfaceContext- Throws:
NamingException
-
list
public CloseableNamingEnumeration<NameClassPair> list(Name name) throws NamingException
- Specified by:
listin interfaceContext- Throws:
NamingException
-
listNative
protected abstract CloseableNamingEnumeration<NameClassPair> listNative(Name name) throws NamingException
- Throws:
NamingException
-
listBindings
public CloseableNamingEnumeration<Binding> listBindings(String name) throws NamingException
- Specified by:
listBindingsin interfaceContext- Throws:
NamingException
-
listBindings
public CloseableNamingEnumeration<Binding> listBindings(Name name) throws NamingException
- Specified by:
listBindingsin interfaceContext- Throws:
NamingException
-
listBindingsNative
protected abstract CloseableNamingEnumeration<Binding> listBindingsNative(Name name) throws NamingException
- Throws:
NamingException
-
destroySubcontext
public void destroySubcontext(String name) throws NamingException
- Specified by:
destroySubcontextin interfaceContext- Throws:
NamingException
-
destroySubcontext
public void destroySubcontext(Name name) throws NamingException
- Specified by:
destroySubcontextin interfaceContext- Throws:
NamingException
-
destroySubcontextNative
protected void destroySubcontextNative(Name name) throws NamingException
- Throws:
NamingException
-
createSubcontext
public Context createSubcontext(String name) throws NamingException
- Specified by:
createSubcontextin interfaceContext- Throws:
NamingException
-
createSubcontext
public Context createSubcontext(Name name) throws NamingException
- Specified by:
createSubcontextin interfaceContext- Throws:
NamingException
-
createSubcontextNative
protected Context createSubcontextNative(Name name) throws NamingException
- Throws:
NamingException
-
composeName
public Name composeName(Name name, Name prefix) throws NamingException
- Specified by:
composeNamein interfaceContext- Throws:
NamingException
-
composeName
public String composeName(String name, String prefix) throws NamingException
- Specified by:
composeNamein interfaceContext- Throws:
NamingException
-
getNameParser
public NameParser getNameParser(Name name) throws NamingException
- Specified by:
getNameParserin interfaceContext- Throws:
NamingException
-
getNameParser
public NameParser getNameParser(String name) throws NamingException
- Specified by:
getNameParserin interfaceContext- Throws:
NamingException
-
decomposeName
protected Name decomposeName(CompositeName compositeName) throws NamingException
- Throws:
NamingException
-
addToEnvironment
public Object addToEnvironment(String propName, Object propVal)
- Specified by:
addToEnvironmentin interfaceContext
-
removeFromEnvironment
public Object removeFromEnvironment(String propName)
- Specified by:
removeFromEnvironmentin interfaceContext
-
getEnvironment
public FastHashtable<String,Object> getEnvironment() throws NamingException
- Specified by:
getEnvironmentin interfaceContext- Throws:
NamingException
-
nameNotFound
protected static NamingException nameNotFound(Name name)
-
readOnlyContext
protected static NoPermissionException readOnlyContext()
-
notSupported
protected static OperationNotSupportedException notSupported()
-
-