com.ibm.ws.container.service.naming
Class JavaColonNamespaceBindings<T>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<java.lang.String,T>
com.ibm.ws.container.service.naming.JavaColonNamespaceBindings<T>
- Type Parameters:
T
- the binding object
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,T>
public class JavaColonNamespaceBindings<T>
- extends java.util.HashMap<java.lang.String,T>
Manages the bindings for a #JavaColonNamingHelper
. This object is
not thread-safe: accesses to the HashMap.put(K, V)
and HashMap.remove(java.lang.Object)
methods
must be protected by a write lock, and access to all other methods must be
protected by a read lock.
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Method Summary |
void |
bind(java.lang.String name,
T binding)
Adds a binding. |
boolean |
hasObjectWithPrefix(java.lang.String contextName)
|
java.util.Collection<? extends javax.naming.NameClassPair> |
listInstances(java.lang.String contextName)
|
T |
lookup(java.lang.String name)
Looks up a binding. |
void |
unbind(java.lang.String name)
Removes a binding. |
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
JavaColonNamespaceBindings
public JavaColonNamespaceBindings(NamingConstants.JavaColonNamespace namespace,
JavaColonNamespaceBindings.ClassNameProvider<T> nameProvider)
bind
public void bind(java.lang.String name,
T binding)
- Adds a binding.
- Parameters:
name
- the namespace name (e.g., "jdbc/ds")binding
- the binding object
unbind
public void unbind(java.lang.String name)
- Removes a binding.
- Parameters:
name
- the namespace name (e.g., "jdbc/ds")
lookup
public T lookup(java.lang.String name)
throws javax.naming.NamingException
- Looks up a binding.
- Parameters:
name
- the name passed to bind(java.lang.String, T)
- Returns:
- the binding, or null if unavailable
- Throws:
javax.naming.NotContextException
- if a lookup attempts to use a binding as a
context name
javax.naming.NamingException
hasObjectWithPrefix
public boolean hasObjectWithPrefix(java.lang.String contextName)
throws javax.naming.NamingException
- Throws:
javax.naming.NamingException
- See Also:
JavaColonNamingHelper.hasObjectWithPrefix(com.ibm.ws.container.service.naming.NamingConstants.JavaColonNamespace, java.lang.String)
listInstances
public java.util.Collection<? extends javax.naming.NameClassPair> listInstances(java.lang.String contextName)
throws javax.naming.NamingException
- Throws:
javax.naming.NotContextException
- if a lookup attempts to use a binding as a
context name
javax.naming.NamingException
- See Also:
JavaColonNamingHelper.listInstances(com.ibm.ws.container.service.naming.NamingConstants.JavaColonNamespace, java.lang.String)