JNDI API

The main JNDI API package is the javax.naming package, which contains one key class, InitialContext, and two key interfaces, Context and Name.

In using JNDI, a client first establishes a connection to the JNDI service (sometimes called the JNDI tree). After the client is connected, a context is created to facilitate the access to system components and resources. Context is a fundamental concept in the JNDI model. A context is a set of name-to-object bindings within a naming service that all share the same naming convention.

All naming operations in JNDI are performed within a context. Therefore, establishing a context is the initial step prior to any operation. The javax.naming.InitialContext class implements the javax.naming.Context interface. Clients use this class to establish a connection, and create a Context object as a result:

Context ctx = new InitialContext();

Some naming services provide a subcontext, which is similar to a subdirectory in a file system. The tree-like structure of JNDI is a natural to support subcontexts. The Context class also provides methods for creating and destroying subcontexts.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.65.130