Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 2 of 4
Second, as you shall see, JNDI's ability to directly store Java objects allows it to integrate almost transparently into Java applications.
To use JNDI, you need a naming and directory service and a JNDI service provider. Sun supplies several providers of common naming and directory services (COS naming, NIS, the RMI registry, LDAP, and more). I've settled on LDAP.
LDAP (Lightweight Directory Access Protocol) has the dual advantages of being widely implemented (both in commercial and free forms) and being reasonably easy to use. Its features are also well supported by Sun's LDAP service provider and JNDI.
Since obtaining and configuring an LDAP server isn't really a Java subject matter, I'll only get you headed in the right direction and supply you with references to Internet resources.
Numerous LDAP implementations are available. Many are commercial products such as the Netscape Directory Server and IBM's Secure Way Directory. Some are packaged as part of larger offerings (Microsoft's Active Directory is part of Windows 2000). If you have access to such an implementation, you can skip most of this section. Otherwise, I'm going to describe OpenLDAP -- a freely available implementation of LDAP based on the University of Michigan's reference implementation -- as well as its installation and configuration.
OpenLDAP is available from the OpenLDAP Foundation (see Resources). Its license is based on Perl's "artistic license," which means that OpenLDAP is free (or open source) software. Prepackaged binaries are available for various flavors of Linux (Debian, Red Hat) as well as BSD Unix. Work is under way on a port to Windows NT.
If you plan to install OpenLDAP, you should read the SLAPD and SLURPD Administrator's Guide (slapd is the name of the LDAP server executable and slurpd is the name of the LDAP replication server; see Resources for the location).
I have one final suggestion to make your entire experience more pleasing: no matter which LDAP implementation you use, turn schema checking off. An LDAP schema, like a database schema, defines constraints on the stored information. In normal use, schema checking helps ensure that entries (think of address book entries) conform to the correct format. However, since you'll probably be playing rather than building something of lasting significance, schema checking will just get in the way. Take my word for it.
In previous articles, I tried to avoid explaining in detail how to interact with a JNDI service provider such as the LDAP service provider. I mentioned that you need an initial context to do JNDI operations, but I didn't spend much time telling you how to get one. Let me fill in the gaps. (For more on initial contexts, see the first two articles in this series.)
Before you can do anything with JNDI, you need an initial context. All operations are performed relative to the context or one of its subcontexts.
Obtaining an initial context requires three steps: