|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A naming context creates and manages names
.
The role of a naming context is to create and manage names, ensuring that each of the names it manages unambiguously designates a given object interface.
We must first clarify the sense of the terms "object" and "interface" in Jonathan, since they are a bit different from their usual sense in the Java language. The "objects" of interest when developping an application or a library are conceptual entities of the application or library that may be of an arbitrary complexity and granularity. They can be thought of as components encapsulating a state and information processing. These components, which we call "objects", may be accessed from their environment at specific points that we call interfaces, each of them having its own identity. These objects (components) may be implemented using one or several Java objects. Some of these Java objects, accessible from the component environment, will represent its interfaces. In all the Jonathan documentation, the term "object" designates these components, and the term "interface" or "object interface" designates an identified access point to a component.
In Jonathan, naming contexts may take several forms. For instance, the first example of a naming context is the Java virtual machine itself, that unambiguously designates the objects by their address in memory. The value of an address is not accessible to the Java programmer, but the object identity is manifested to the programmer through an object reference. The problem is that the validity of that reference is limited to the virtual machine, and it cannot be used, e.g., in a persistent or distributed context.
Jonathan also defines special types for different kinds of naming contexts:
NamingContext
to manage
names of type Identifier
, used
to designate
applicative object interfaces that need to be designated in specific ways
(e.g., distributed or persistent);
Protocol
to manage
names of type
SessionIdentifier
, used
to designate interfaces at the protocol level.
Method Summary | |
name |
export(name name)
The role of an export method is to create a name in a given context. |
name |
resolve(name name)
resolve is the dual operation of export : Given a name, say
b.a.ref, it returns the next name in the referencing chain, in this
case, a.ref. |
Method Detail |
public name export(name name)
To be usable in a distributed context, an object reference must be exported to another naming context that will create and manage another name for it. If we call the object reference ref, we can call the new name a.ref to manifest the fact that the new name is built from ref. This new name may be re-exported to a third naming context, able to manage names with other properties, and this name may be represented by something like b.a.ref. This process may be continued as many times as necessary, thus resulting in reference chains of arbitrary length.
No generic export operation is defined in Jonathan: such a method
may take very different forms, depending on the type of designated object
interface, and
possible extra parameters. Usually, naming contexts provide one or several
export methods. However, in some specific cases, like, e.g., if the
naming context is a factory that creates objects and directly associates them
with an identifier, it is possible that no public export method be
provided. Export operations may in particular raise
ExportExceptions
that indicate that an error occurred in the export process.
public name resolve(name name)
export
: Given a name, say
b.a.ref, it returns the next name in the referencing chain, in this
case, a.ref. In the same way, "resolving" a.ref results in
ref.
Note that it is not always possible to implement this operation, since the "resolved" name may not have a valid representation in the context where the resolve operation is performed. For instance, if a.ref is a distributed identifier, and if the resolve operation is called in a virtual machine that is not the original virtual machine for ref, ref cannot be returned.
The resolve operation may be borne directly by the name to which it
is applied, like e.g., in
this case
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |