com.ibm.ws.container.service.naming
Class JavaColonNamespaceBindings<T>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,T>
          extended by 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 Class Summary
static interface JavaColonNamespaceBindings.ClassNameProvider<T>
          Provides the type names for the bindings.
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
JavaColonNamespaceBindings(NamingConstants.JavaColonNamespace namespace, JavaColonNamespaceBindings.ClassNameProvider<T> nameProvider)
           
 
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
 

Constructor Detail

JavaColonNamespaceBindings

public JavaColonNamespaceBindings(NamingConstants.JavaColonNamespace namespace,
                                  JavaColonNamespaceBindings.ClassNameProvider<T> nameProvider)
Method Detail

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)