org.objectweb.jonathan.binding.api
Interface Identifier

All Known Implementing Classes:
EBinder.EId

public interface Identifier

An identifier uniquely identifies an applicative object interface in a given naming context. It is a specific kind of name.


Method Summary
 Object bind(Identifier[] ref, org.objectweb.jonathan.apis.kernel.Context hints)
          The bind operation returns an object giving access to the object interface referenced by the target identifier.
 byte[] encode()
          Encodes the target identifier in an array of bytes.
 void encode(Marshaller m)
          Encodes the target identifier in a marshaller.
 NamingContext getContext()
          Returns the naming context associated with the target identifier.
 boolean isValid()
          Tests the validity of the target identifier.
 Object resolve()
          Returns the next name in the referencing chain.
 void unexport()
          Unexporting an identifier means that the target identifier no longer designates the object interface it was created for (by some export method).
 

Method Detail

getContext

NamingContext getContext()
Returns the naming context associated with the target identifier. An identifier is always associated the naming context that created it.

Returns:
the naming context associated with the target identifier.

bind

Object bind(Identifier[] ref,
            org.objectweb.jonathan.apis.kernel.Context hints)
            throws ForwardException,
                   BindException,
                   org.objectweb.jonathan.apis.kernel.JonathanException
The bind operation returns an object giving access to the object interface referenced by the target identifier.

The returned object may be a direct reference to the object interface that was used to create the identifier (at export-time), or it may be a surrogate (a proxy) for that object interface.

If this operation is implemented, it means that the related naming context is not only a naming context but also a binder.

This operation may in particular raise two types of exceptions:

All parameters are optional (they may be null).

Parameters:
ref - a set of identifiers of the seeked object interface;
hints - a context containing extra information that may be useful;
Returns:
a reference to the seeked interface.
Throws:
ForwardException - if the target has moved;
BindException - if an error occurs in the binding process;
org.objectweb.jonathan.apis.kernel.JonathanException - if something else goes wrong.
See Also:
org.objectweb.jonathan.model.binder#bind(org.objectweb.jonathan.model.name)

unexport

void unexport()
Unexporting an identifier means that the target identifier no longer designates the object interface it was created for (by some export method). An identifier must no longer be used after it has been "unexported".


isValid

boolean isValid()
Tests the validity of the target identifier. A false return means that a call to either bind or resolve will fail. If so, the target identifier must no longer be used.

Returns:
false if calls to either bind or resolve certainly fail.

resolve

Object resolve()
Returns the next name in the referencing chain.

If the naming context that has built the target identifier is an intermediate naming context, this method should return the next "name" in the referencing chain, or null if no such name can be found or created.

Such a name may be of type Identifier, Reference, or of any other type, provided that it really designates the right interface, and that its type is clear from the context.

Returns:
the next name in the referencing chain.
See Also:
org.objectweb.jonathan.model.naming_context#resolve(org.objectweb.jonathan.model.name)

encode

byte[] encode()
              throws org.objectweb.jonathan.apis.kernel.JonathanException
Encodes the target identifier in an array of bytes.

Since identifiers are likely to be transmitted on the net, they may have to be encoded and decoded. The corresponding decoding method is borne by the NamingContext interface.

Returns:
an array of bytes encoding the target identifier.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

encode

void encode(Marshaller m)
            throws org.objectweb.jonathan.apis.kernel.JonathanException
Encodes the target identifier in a marshaller.

Parameters:
the - marshaller to be used for encoding.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.