The Java Naming and Directory Interface (JNDI) is a directory service based API to allow the clients to discover and lookup data and objects via a name. JNDI is independent of the underlying implementation similar to all Java APIs that interface with host systems. Moreover, it indicates a service provider interface (SPI) that allows directory service implementations plugged into the framework. Vendor is free to choose either for a server or for a flat file or for a database for implementation.
RMI and Java EE uses the JNDI API to lookup the objects in a network. E.g. Jini does not use the JNDI API and has its own lookup service.
The API provides:
The SPI portion supports any kind of practical naming or directory services including:
JNDI hierarchally organizes its name, these name can be any string type like "com.mydomain.ejb.MyBean" or it can also be object name that supports the Name interface, but string is the most common way to naming an object. An object is associated with a name in the directory either by storing the object or a reference to the object in the directory service identified by the name.
The JNDI API defines a context indicating the location to look for an object. The initial context is mainly used as a starting point.
Posted on: December 18, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles