View RSS Feed

JNDI

Listing the Children of a JNDI Context

Rate this Entry
by , 07-07-2012 at 04:13 PM (1300 Views)
One common operation of JNDI is nameís list retrieval of the children. E.g, Enterprise JavaBeans names could be obtained by an application to check if one of them is running or childer names list of InitialContext so that Swing JTree component could be populated. Objectís children names are listed by the help of list() method.
Java Code:
NamingEnumeration children = initialContext.list("");
Javax.naming.NameClassPair objectís javax.naming.NamingEnumeration is returned by list() method where class & name of one single Context child is present in every NameClassPair. It shall be noted that NameClassPair is itself not the child. This is method getName() which ables us to learn the child name and getClassName() allow us to access the class name of child.

Interface java.util.Enumeration is implemented by the NamingEnumeration therefore loop is allowed via the calling list() results by usage of familiar methods of enumeration. NamingEnumeration is used by JNDI as naming operationís return type; in enumeration the actual object would be varying based upon operations.

Submit "Listing the Children of a JNDI Context" to Facebook Submit "Listing the Children of a JNDI Context" to Digg Submit "Listing the Children of a JNDI Context" to del.icio.us Submit "Listing the Children of a JNDI Context" to StumbleUpon Submit "Listing the Children of a JNDI Context" to Google

Tags: jndi context Add / Edit Tags
Categories
Tutorial

Comments