Home > Store

JNDI API Tutorial and Reference: Building Directory-Enabled Java? Applications

Register your product to gain access to bonus material or receive a coupon.

JNDI API Tutorial and Reference: Building Directory-Enabled Java? Applications

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2000
  • Dimensions: 7-3/8" x 9-1/4"
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-70502-8
  • ISBN-13: 978-0-201-70502-7

Directory services are the key applications which provide a means to locate and organize users and resources on a network. Directories are repositories (like a phone book) containing information on users such as email addresses, phone numbers, security passwords and access rights to things like printers and servers. Using Sun's Java Naming and Directory Interface (JNDI), Java developers and network professionals can build powerful and portable applications throughout the enterprise. Now, JNDI's architect and one of its lead developers team up to present the first comprehensive JNDI tutorial and reference: everything developers need to build world-class directory-enabled applications with Java. Starting from the basic foundations, the book introduces key JNDI concepts and techniques needed to write, compile, and run JNDI applications. The tutorial then moves to more sophisticated topics, walking developers through building their own service providers, accounting for security, and creating schema and attributes. There are detailed comparisons between JNDI and LDAP, as well as practical techniques for integrating with DNS, NDS, NIS+, and other directory services. The book also contains a comprehensive JNDI reference covering every element of the API.

Sample Content

Table of Contents



List of Figures.


List of Tables.


Preface.


Tutorial.


Getting Started.

Lesson 1 Naming and Directory Concepts.

Lesson 2 JNDI Overview.

Lesson 3 Examples.

Lesson 4 Common Problems (and Their Solutions.



The Basics.

Lesson 5 Preparations.

Lesson 6 Naming Operations.

Lesson 7 Directory Operations.



Beyond the Basics.

Lesson 8 What's in a Name?

Lesson 9 Environment Properties

Lesson 10 Event Notification

Lesson 11 URLs

Lesson 12 Federation

Lesson 13 Miscellaneous



Java Objects in the Directory

Lesson 14 Storing Objects in the Directory

Lesson 15 State Factories

Lesson 16 Reading Objects from the Directory

Lesson 17 Object Factories

Lesson 18 Representation in the Directory



Tips for LDAP Users

Lesson 19 Comparison of the LDAP and JNDI Models

Lesson 20 Security

Lesson 21 Miscellaneous

Lesson 22 Searches

Lesson 23 Referrals

Lesson 24 Schema

Lesson 25 Controls and Extensions

Lesson 26 Frequently Asked Questions



Building a Service Provider

Lesson 27 The Big Picture

Lesson 28 The Ground Rules

Lesson 29 The Essential Components

Lesson 30 Adding Directory Support

Lesson 31 Adding URL Support

Lesson 32 Adding Federation Support

Lesson 33 Miscellaneous



Class Libraries Reference


Package Overviews

javax.naming

javax.naming.directory

javax.naming.event

javax.naming.ldap

javax.naming.spi



Alphabetical Reference of Classes

Attribute

AttributeInUseException

AttributeModificationException

Attributes

AuthenticationException

AuthenticationNotSupportedException

BasicAttribute

BasicAttributes

BinaryRefAddr

Binding

CannotProceedException

CommunicationException

CompositeName

CompoundName

ConfigurationException

Context

ContextNotEmptyException

Control

ControlFactory

DirContext

DirectoryManager

DirObjectFactory

DirStateFactory

DirStateFactory.Result

EventContext

EventDirContext

ExtendedRequest

ExtendedResponse

HasControls

InitialContext

InitialContextFactory

InitialContextFactoryBuilder

InitialDirContext

InitialLdapContext

InsufficientResourcesException

InterruptedNamingException

InvalidAttributeIdentifierException

InvalidAttributesException

InvalidAttributeValueException

InvalidNameException

InvalidSearchControlsException

InvalidSearchFilterException

LdapContext

LdapReferralException

LimitExceededException

LinkException

LinkLoopException

LinkRef

MalformedLinkException

ModificationItem

Name

NameAlreadyBoundException

NameClassPair

NameNotFoundException

NameParser

NamespaceChangeListener

NamingEnumeration

NamingEvent

NamingException

NamingExceptionEvent

NamingListener

NamingManager

NamingSecurityException

NoInitialContextException

NoPermissionException

NoSuchAttributeException

NotContextException

ObjectChangeListener

ObjectFactory

ObjectFactoryBuilder

OperationNotSupportedException

PartialResultException

RefAddr

Reference

Referenceable

ReferralException

Resolver

ResolveResult

SchemaViolationException

SearchControls

SearchResult

ServiceUnavailableException

SizeLimitExceededException

StateFactory

StringRefAddr

TimeLimitExceededException

UnsolicitedNotification

UnsolicitedNotificationEvent

UnsolicitedNotificationListener



Appendix: LDAP Schemas


Index 0201705028T04062001

Preface

How to Use This Book

This book teaches you how to write directory-enabled Java™ applications by using the Java Naming and Directory Interface™ (JNDI). It is divided into two parts: a tutorial and a reference.

It is intended as a tutorial and reference only for the JNDI and not for the rest of the Java Platform. For a tutorial-style presentation of the class libraries in the rest of the Java Platform, see The Jav™ Tutorial and The JFC Swing Tutorial, by Mary Campione and Kathy Walrath, and The Java™ Tutorial Continued, by Mary Campione, Kathy Walrath, Allison Huml, and the Tutorial team. For a reference-style presentation of the class libraries in other parts of the Java Platform, see The Java™ Class Libraries books by Patrick Chan, Rosanna Lee, and Douglas Kramer. This book also does not explain any part of the Java programming language. Several books are available for learning the language. These include The Java™ Programming Language, by Ken Arnold and James Gosling, and The Java™ Language Specification, by James Gosling, Bill Joy, and Guy Steele.

Following is an overview of this book.

Tutorial

The first part of this book is a tutorial. It is modeled after The Java Tutorial, by Mary Campione and Kathy Walrath.

Trails and Lessons

The tutorial consists of six trails-programming lessons grouped together by topic. To learn about a certain topic, go to the Table of Contents, decide which trail meets your needs, and go through the lessons in that trail. For example, if you are interested in writing a service provider, select the Building a Service Provider trail.

You can read the tutorial sequentially or select trails in any order. However, some of the beginner trails are prerequisites for the more advanced trails.

The first page of a trail contains a high-level overview of the trail. It lists, describes, and provides references to all of the lessons on the trail. It also provides a detailed table of contents of the lessons in the trail.

Each lesson begins with an introduction to the material in the lesson. Most lessons contain many examples. Trying the examples as you go along will help you to understand the concepts discussed in each lesson.

Links

The online version of this tutorial is filled with hyperlinks to sections inside and outside of the tutorial. In this hardcopy version of the tutorial, these hyperlinks have been handled as follows.

  • A link to a section, lesson, or trail within the tutorial is replaced by a cross reference, annotated by a page number.
  • A link to a method, class, interface, or package in the JNDI has been removed. Use instead the reference part of this book to look up the item.
  • A link to an Internet RFC or Internet-draft has been removed. These documents may be accessed both from the CD that accompanies this book and the Web site at http://www.ietf.org.
  • A link to an external document or software has been replaced by the item's URL. These files may also be found on the accompanying CD.
  • A link to a sample program or configuration file has been removed. Simply find the file on the accompanying CD (see later in this Preface for instructions).

Examples

All of the code examples in the tutorial have been compiled and run by using the following software.

  • The FCS version of the Java™ 2 SDK, Standard Edition, v1.2 on either Solaris or Windows NT or both
  • The 1.2.1 version of the JNDI class libraries
  • The 1.2.2 version of the LDAP service provider
  • The 1.2 Beta 2 version of the file system service provider

Most of the complete examples are available both online from the JNDI Web site (http://java.sun.com/products/jndi/tutorial) and on the accompanying CD. This tutorial is located in the Tutorials/jndi directory on the CD. Each trail resides in its own directory, under which are located subdirectories for each lesson within the trail. The examples and related files used in a lesson are found in the src subdirectory of the lesson's directory. For example, the examples in the Naming Operations lesson in The Basics trail are found in the Tutorials/jndi/basics/naming/src directory. Tools and utilities for configuring the examples are found in the directories Tutorials/jndi/config/fs and Tutorials/jndi/config/LDAP.

We strongly encourage you to try the examples that accompany this tutorial as you go along. To do that, you will need the JNDI classes and a v1.1.2 or higher version of the Java Platform software, such as the JDK software (http://java.sun.com/products/jdk). The JDK provides a compiler that you can use to compile Java programs. It also provides an interpreter for running Java applications. To run Java applets, you can use the JDK Applet Viewer or any Java-compatible Web browser, such as the HotJava™ browser.

Online Version

The complete online tutorial is available both on the accompanying CD and from the JNDI Web site. The title page of each lesson contains a URL for the corresponding lesson online.

Reference

The second part of this book is a reference. Its format is similar to a dictionary's in that it is designed to optimize the time that it takes for you to look up information about a class or class member.

Package Overviews

The package overviews briefly describe each package and its classes. Each overview includes a general description about the package, as well as diagrams that show the inheritance hierarchy of its classes.

Alphabetical Reference of Classes

This part covers the alphabetical listing of the classes from the following five packages:

javax.naming
javax.naming.directory
javax.naming.event
javax.naming.ldap
javax.naming.spi

The classes are ordered alphabetically without regard to package. Each is described in its own chapter that contains a picture of the class hierarchy, a class description, a member summary, and descriptions for each member. Most examples for the class or items within the class are found in the tutorial part of this book.

Class Hierarchy Diagram

Each chapter starts with a class diagram like that shown in Figure i. This diagram shows all of the ancestors of the class, its siblings, its immediate descendents, and any interfaces that it implements. In these diagrams, if a package name precedes a class or interface name, then the class or interface is not in the same package as the current class.

In the diagrams, the different kinds of Java entities are distinguished visually as follows:

  • The interface: A rounded rectangle
  • The class: A rectangle
  • The abstract class: A rectangle with an empty dot
  • The final class: A rectangle with a black dot
  • Classes with subclasses: A rectangle with a small black triangle in the lower-right corner

The class or interface being described in the current chapter is shaded grey. A solid line represents extends and a dotted line represents implements.

Class Description

In the class description, we describe all of the properties of the class. For example, the discussion of the properties of the Context interface includes information on how names and environment properties are treated. Describing in one place all of a class's available properties and how they behave makes learning all of the class's capabilities much easier than if that data is scattered throughout the member descriptions.

Any terminology used in the member descriptions is introduced and described in the class descriptions. For more information at any time, you should go to the class description.

Member Summary

The member summary is intended to help you quickly grasp the key points of the class. It groups the members into categories that are specific to that class. For example, in the Name interface the Update Methods category lists all methods concerning updates. It is intended as a quick summary of the class's members, so it does not contain any syntax information other than the name of the member.

As an example, following is the member summary for Attributes. Notice that all overloads of a method or constructor share the same entry.

MEMBER SUMMARY

Update Methods

put() Adds a new attribute to this attribute set.
remove() Removes an attribute from this attribute set.
Copy Method
clone() Makes a copy of this attribute set.
Query and Access Methods
get() Retrieves the attribute with the given attribute identifier from this attribute set.

getAll()

Retrieves an enumeration of the attributes in this attribute set.
getIDs() Retrieves an enumeration of the identifiers of the attributes in this attribute set.
isCaseIgnored() Determines whether the attribute set ignores the case of attribute identifiers when retrieving or adding attributes.
size() Retrieves the number of attributes in this attribute set.
Member Descriptions

The member descriptions appear in alphabetical order within a class chapter regardless of what kind of method or field they are. This is done to make locating a member proceed as fast as possible.

Overloaded methods are grouped in one member description because they share very similar functionality. The different overloaded forms are typically provided as a convenience for the programmer when specifying parameters. For instance, some overloads eliminate parameters by providing common defaults. To describe overloads with missing parameters, we use a phrase of the form "if the parameter p is not specified, then it defaults to the value 3.14." Other overloads take different representations of a value. For example, one overload could take a particular parameter as an integer, whereas another could take the same parameter as a string that contains an integer.

Each member description contains some or all of the following fields.

PURPOSE A brief description of the purpose of this member
SYNTAX The syntactic declaration of this member
DESCRIPTION A full description of this member
PARAMETERS The parameters accepted by this member, if any, listed in alphabetical order
RETURNS The value and its range returned by this member, if any
EXCEPTIONS The exceptions and errors thrown by this member, if any, listed in alphabetical order

SEE ALSO

Other related classes or members, if any, listed in alphabetical order
OVERRIDES The method that this member overrides, if any
EXAMPLE A code example that illustrates how this member is used (usually a reference to an example in the tutorial part of this book)

Typographical Conventions Used in This Book

Lucida Sans Typewriter is used for examples, syntax declarations, class names, method names, values, and field names. Italic is used when defining a new term and for emphasis.

Additional Information about This Book

Errata and additional information about this book and other books in the Java Series are available at the following URL:

http://java.sun.com/docs/books/

Please send feedback about this book to the following:

jndi-book@java.sun.com



0201705028P04062001

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020