Previous | Next | Trail Map | Getting Started | JNDI Overview

Directory Package

The javax.naming.directory(in the API reference documentation) package extends the javax.naming(in the API reference documentation) package to provide functionality for accessing directory services in addition to naming services. This package allows applications to retrieve attributes associated with objects stored in the directory and to search for objects using specified attributes.

The Directory Context

The DirContext(in the API reference documentation) interface represents a directory context. It defines methods for examining and updating attributes associated with a directory object.

You use getAttributes()(in the API reference documentation) to retrieve the attributes associated with a directory object (for which you supply the name). Attributes are modified using modifyAttributes()(in the API reference documentation). You can add, replace, or remove attributes and/or attribute values using this operation.

DirContext also behaves as a naming context by extending the Context(in the API reference documentation) interface. This means that any directory object can also provide a naming context. For example, a directory object for a person might contain attributes about that person as well as provide a context for naming objects, such as the person's printers and file system relative to that person directory object.

Searches

DirContext contains methods for performing content-based searching of the directory. In the simplest and most common form of usage, the application specifies a set of attributes--possibly with specific values--to match and submits this attribute set to the search()(in the API reference documentation) method. Other overloaded forms of search()(in the API reference documentation) support more sophisticated search filters.


Previous | Next | Trail Map | Getting Started | JNDI Overview