org.objectweb.jonathan.libs.binding.echannel
Class EBinder.EId

java.lang.Object
  extended byorg.objectweb.jonathan.libs.binding.echannel.EBinder.EId
All Implemented Interfaces:
Identifier
Enclosing class:
EBinder

public class EBinder.EId
extends java.lang.Object
implements Identifier

EId is an indentifier representing an event channel of a given type and relying on a given multicast address and port.

See Also:
Identifier

Constructor Summary
EBinder.EId(byte[] encoded, int offset, int length)
          Builds a new EId representing an event channel by decoding the information supplied in a byte array
EBinder.EId(java.lang.String address, int port, java.lang.String type)
          Builds a new EId representing an event channel of a given type relying on a given multicast address and port
EBinder.EId(UnMarshaller unmarshaller)
          Builds a new EId representing an event channel by decoding the information supplied in an unmarshaller.
 
Method Summary
 java.lang.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 marshaller)
          Encodes the target identifier in a marshaller.
 NamingContext getContext()
          Returns the naming context associated with the target identifier.
 ProtocolGraph getProtocolGraph()
          Returns a session identifier for the event channel represented by this EId
 SessionIdentifier getSessionIdentifier()
          Returns a session identifier for the event channel represented by this EId
 boolean isValid()
          Tests the validity of the target identifier.
 java.lang.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).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EBinder.EId

public EBinder.EId(java.lang.String address,
                   int port,
                   java.lang.String type)
Builds a new EId representing an event channel of a given type relying on a given multicast address and port

Parameters:
address - the IP multicast address to be used by the channel
port - the port number to be used by the channel
type - the type of the channel

EBinder.EId

public EBinder.EId(byte[] encoded,
                   int offset,
                   int length)
            throws org.objectweb.jonathan.apis.kernel.JonathanException
Builds a new EId representing an event channel by decoding the information supplied in a byte array

Parameters:
encoded - the byte array containing the marshalled EId
offset - the offset in bytes from which to start the decoding
length - the length in bytes of the portion of the byte array to decode
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - thrown if the unmarshalling fails

EBinder.EId

public EBinder.EId(UnMarshaller unmarshaller)
            throws org.objectweb.jonathan.apis.kernel.JonathanException
Builds a new EId representing an event channel by decoding the information supplied in an unmarshaller.

Parameters:
unmarshaller - an unmarshaller.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - thrown if the unmarshalling fails
Method Detail

getSessionIdentifier

public SessionIdentifier getSessionIdentifier()
                                       throws org.objectweb.jonathan.apis.kernel.JonathanException
Returns a session identifier for the event channel represented by this EId

Returns:
the session identifier
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - thrown if a session identifier cannot be created

getProtocolGraph

public ProtocolGraph getProtocolGraph()
                               throws org.objectweb.jonathan.apis.kernel.JonathanException
Returns a session identifier for the event channel represented by this EId

Returns:
the session identifier
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - thrown if a session identifier cannot be created

bind

public java.lang.Object bind(Identifier[] ref,
                             org.objectweb.jonathan.apis.kernel.Context hints)
                      throws org.objectweb.jonathan.apis.kernel.JonathanException
Description copied from interface: Identifier
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).

Specified by:
bind in interface Identifier
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:
org.objectweb.jonathan.apis.kernel.JonathanException - if something else goes wrong.
See Also:
binder.bind(org.objectweb.jonathan.model.name)

getContext

public NamingContext getContext()
Description copied from interface: Identifier
Returns the naming context associated with the target identifier. An identifier is always associated the naming context that created it.

Specified by:
getContext in interface Identifier
Returns:
the naming context associated with the target identifier.

encode

public byte[] encode()
              throws org.objectweb.jonathan.apis.kernel.JonathanException
Description copied from interface: Identifier
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.

Specified by:
encode in interface Identifier
Returns:
an array of bytes encoding the target identifier.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

encode

public void encode(Marshaller marshaller)
            throws org.objectweb.jonathan.apis.kernel.JonathanException
Description copied from interface: Identifier
Encodes the target identifier in a marshaller.

Specified by:
encode in interface Identifier
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

resolve

public java.lang.Object resolve()
Description copied from interface: Identifier
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.

Specified by:
resolve in interface Identifier
Returns:
the next name in the referencing chain.
See Also:
naming_context.resolve(org.objectweb.jonathan.model.name)

isValid

public boolean isValid()
Description copied from interface: Identifier
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.

Specified by:
isValid in interface Identifier
Returns:
false if calls to either bind or resolve certainly fail.

unexport

public void unexport()
Description copied from interface: Identifier
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".

Specified by:
unexport in interface Identifier