Java Reference
In-Depth Information
the object itself. The Binding class is actually a subclass of NameClassPair ,
which consists simply of the object's name and the object's class name.
The NameClassPair is useful when you only want information about the
object's class and do not want to pay the extra cost of getting the object.
Objects are stored in naming and directory services in different ways.
If an object store supports storing objects it might store that object in
its serialized form. However, some naming and directory services do not
support the storing of such objects. Furthermore, for some objects in
the directory, Java programs are just one group of applications that ac-
cess them. In this case, a serialized object might not be the most appro-
priate representation. JNDI defines a Reference that contains information
on how to construct a copy of the object. JNDI will attempt to turn ref-
erences looked up from the directory into the objects they represent so
that JNDI clients have the illusion that what is stored in the directory are
objects.
In JNDI , all naming and directory operations are performed relative to
a contextthere are no absolute roots. Therefore, JNDI defines an Ini-
tialContext class that provides a starting point for naming and directory
operations. Once you have an initial context, you can use it to look up
other contexts and objects.
The DirContext interface represents a directory context. It defines meth-
ods 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). You can add, replace, or remove attributes and/
or attribute values with the modifyAttributes method .
DirContext also behaves as a naming context by extending the Context
interface. This means that any directory object can also provide a nam-
ing context. For example, the directory object for a person might con-
tain the attributes of that person, and also provide a context for naming
objects relative to that person such as 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 attributespossibly with specific valuesto
 
Search WWH ::




Custom Search