JNDI Tutorial

Naming Concepts

A fundamental facility in any computing system is thenaming service–the means by which names are associated with objects and objects are found based on their names. When using almost any computer program or system, you are always naming one object or another. For example, when you use an electronic mail system, you must provide the name of the recipient to whom you want to send mail. To access a file in the computer, you must supply its name. A naming service allows you to look up an object given its name.

) to a file handle that a program can use to access the contents of the file. These two examples also illustrate the wide range of scale at which naming services exist–from naming an object on the Internet to naming a file on the local file system.

Names

To look up an object in a naming system, you supply it thenameof the object. The naming system determines the syntax that the name must follow. This syntax is sometimes called the naming system’snaming convention.

, which is located in the root of the file system.

entry.

. The LDAP has the further rule that each component of the name must be a name/value pair with the name and value separated by an equals character (“=”).

Bindings

The association of a name with an object is called abinding. For example, a file name isboundto a file.

The DNS contains bindings that map machine names to IP addresses. An LDAP name is bound to an LDAP entry.

References and Addresses

Depending on the naming service, some objects cannot be stored directly; that is, a copy of the object cannot be placed inside the naming service. Instead, they must be stored by reference; that is, apointerorreferenceto the object is placed inside the naming service. A reference is information about how to access an object. Typically, it is a much more compact representation that can be used to communicate with the object, while the object itself might contain more state information. Using the reference, you can contact the object and obtain more information about the object.

For example, an airplane object might contain a list of the airplane’s passengers and crew, its flight plan, and fuel and instrument status, and its flight number and departure time. By contrast, an airplane object reference might contain only its flight number and departure time. The reference is a much more compact representation of information about the airplane object and can be used to obtain additional information. A file object, for example, is accessed using afile reference, also called afile handle. A printer object, for example, might contain the state of the printer, such as its current queue and the amount of paper in the paper tray. A printer object reference, on the other hand, might contain only information on how to reach the printer, such as its print server name and printing protocol.

Although in general a reference can contain any arbitrary information, it is useful to refer to its contents asaddresses(or communication end points): specific information about how to access the object.

For simplicity, this tutorial uses “object” to refer to both objects and object references when a distinction between the two is not required.

Context

Acontextis a set of name-to-object bindings. Every context has an associated naming convention. A context provides a lookup (resolution) operation that returns the object and may provide operations such as those for binding names, unbinding names, and listing bound names. A name in one context object can be bound to another context object (called asubcontext) that has the same naming convention.

.

.

Naming Systems and Namespaces

Anaming systemis a connected set of contexts of the same type (they have the same naming convention) and provides a common set of operations.

For example, a system that implements the DNS is a naming system. A system that communicates using the LDAP is a naming system.

A naming system provides anaming serviceto its customers for performing naming-related operations. A naming service is accessed through its own interface. For example, the DNS offers a naming service that maps machine names to IP addresses. The LDAP offers a naming service that maps LDAP names to LDAP entries. A file system offers a naming service that maps filenames to files and directories.

Anamespaceis the set of names in a naming system. For example, the UNIX file system has a namespace consisting of all of the names of files and directories in that file system. The DNS namespace contains names of DNS domains and entries. The LDAP namespace contains names of LDAP entries.

Directory Concepts

那么前世我的目光一定一刻都没从你身上离开过吧!

JNDI Tutorial

相关文章:

你感兴趣的文章:

标签云: