javax.naming
package to provide functionality
for accessing directory services.
This package defines the directory operations of the Java Naming and Directory Interface (JNDI). JNDI provides naming and directory functionality to applications written in the Java programming language. It is designed to be independent of any specific naming or directory service implementation. Thus a variety of services--new, emerging, and already deployed ones--can be accessed in a common way.
This package allows applications to retrieve and update attributes associated with objects stored in a directory, and to search for objects using specified attributes.
DirContext
interface represents a directory context.
It defines methods for examining and updating attributes associated with a
directory object, or directory entry as it is sometimes
called.
You use getAttributes()
to retrieve the attributes
associated with a directory object (for which you supply the name).
Attributes are modified using modifyAttributes()
.
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
interface in the javax.naming
package.
This means that any directory object can also provide
a naming context.
For example, the directory object for a person might contain
the attributes of that person, and at the same time provide
a context for naming objects relative to that person
such as his printers and home directory.
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()
method.
There are other overloaded forms of search()
that support more sophisticated search filters.