13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

21.3 What’s in a Name? An Introducti<strong>on</strong> to JNDI48721.3.2.4 Novell Directory Service (NDS)Novell, the folks behind Netware, came up with NDS, which provides full directoryservices like LDAP/X.500, but (according to the computer press—letus c<strong>on</strong>fess right now that we have never directly used NDS or Microsoft’s ActiveDirectory) with a simpler API and easier administrati<strong>on</strong>. We d<strong>on</strong>’t knowenough about it to comment <strong>on</strong> it. But we do know that JNDI can access it.21.3.2.5 Microsoft’s Active DirectoryWe have to do the same hand-waving here. Active Directory provides similarfuncti<strong>on</strong>ality to NDS and LDAP. We d<strong>on</strong>’t know enough about it to comment<strong>on</strong> it. But, again, JNDI can talk to it.21.3.3 Putting a Face to a Name: JNDIThe Java Naming and Directory Interface package is designed to provide acomm<strong>on</strong> way to access all of these disparate naming and directory services.The JNDI architecture c<strong>on</strong>sists of the JNDI API, which provides a c<strong>on</strong>sistentAPI, and a Service Provider Interface (SPI), which requires an instanceto c<strong>on</strong>nect to each naming service (such as DNS, LDAP, the RMI registry,and so <strong>on</strong>).Basic naming system functi<strong>on</strong>ality is obtained through the javax.namingpackage. Directory services are provided by the javax.naming.directorypackage.Since JNDI can span multiple naming and directory systems, there are noabsolute root c<strong>on</strong>texts, so the InitialC<strong>on</strong>text class exists to provide a basefrom which all other names and directories may be looked up.21.3.3.1 A Sample JNDI ProgramThe next couple of secti<strong>on</strong>s describe a very simple JNDI applicati<strong>on</strong> that usesthe DNS Service Provider Interface to do directory operati<strong>on</strong>s <strong>on</strong> a DNSdomain. The source code for the class is shown in Example 21.1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!