Q&A
-
Why is a Name Service so important?
-
Without JNDI, it would be a lot harder to provide services such as those implemented using J2EE objects like datasources, message queues, and EJBs. Each vendor would choose their own mechanism for defining how a client program should gain access to the J2EE objects. Some might do this by distributing configuration files, others by using TCP/IP broadcast network packets. Using a Name Service provides a consistent means of providing network services in a portable and platform-independent manner. Not only that, you can move an implementation of a service from one machine to another. In this instance, the server simply updates the Name Service entry to reflect its new location, and the whole process is transparent to the client.
-
Why is JNDI so large? Surely all I need to do is map a name onto a Java object?
-
If all you want to do is support J2EE objects, JNDI could be as simple as a name-to-object mapping service. But Sun Microsystems designed JNDI to interoperate with established Directory Services, such as NDS, LDAP, and DNS. By providing Java programming support for these services, the designers of JNDI have ensured it will not be used as a proprietary product with J2EE servers, but as a general interface to fully functional directory services. This design philosophy also provides programmers with a mechanism for developing interfaces to NDS and LDAP in Java rather than some other language, such as C++ or C#.