org.objectweb.jeremie.libs.binding.echannel
Class EventChannelFactory

java.lang.Object
  extended byorg.objectweb.jeremie.libs.binding.echannel.EventChannelFactory
All Implemented Interfaces:
NamingContext, StubFactory

public class EventChannelFactory
extends java.lang.Object
implements NamingContext, StubFactory

The EventChannelFactory service allows the construction of EventChannels providing best-effort unreliable and unordered event dissemination. It relies on the RTP protocol on top of IP multicast.


Constructor Summary
EventChannelFactory(ChunkFactory chunk_factory, MarshallerFactory marshaller_factory)
           
 
Method Summary
 void bindConsumer(java.lang.Object consumer, EBinder.EId id)
          Binds a consumer object to the event channel represented by the given identifier.
 Identifier decode(byte[] data, int offset, int length)
          Decode an indentifier representing an event channel out of the supplied array of bytes.
 Identifier decode(UnMarshaller u)
          Decodes an identifier from the provided unmarshaller.
 Identifier export(java.lang.Object itf, org.objectweb.jonathan.apis.kernel.Context hints)
          This operation has no meaning in this context: an InternalException is always thrown.
 EventChannel newEventChannel(java.lang.String address, int port, java.lang.String type)
          Constructs and returns a new EventChannel
 java.lang.Object newStub(SessionIdentifier ep, Identifier[] ids, org.objectweb.jonathan.apis.kernel.Context hints)
          Builds a new stub adapted for one-way event generation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventChannelFactory

public EventChannelFactory(ChunkFactory chunk_factory,
                           MarshallerFactory marshaller_factory)
Method Detail

export

public Identifier export(java.lang.Object itf,
                         org.objectweb.jonathan.apis.kernel.Context hints)
This operation has no meaning in this context: an InternalException is always thrown.

Specified by:
export in interface NamingContext
Parameters:
itf -
hints -
Returns:
never.
See Also:
naming_context.export(org.objectweb.jonathan.model.name)

newStub

public java.lang.Object newStub(SessionIdentifier ep,
                                Identifier[] ids,
                                org.objectweb.jonathan.apis.kernel.Context hints)
                         throws org.objectweb.jonathan.apis.kernel.JonathanException
Builds a new stub adapted for one-way event generation

Specified by:
newStub in interface StubFactory
Parameters:
ep - the protocol SessionIdentifier of the event channel
ids - the set of indentifiers for the stubs
hints - a String containing the type of the EventChannel
Returns:
a stub
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong

newEventChannel

public EventChannel newEventChannel(java.lang.String address,
                                    int port,
                                    java.lang.String type)
                             throws org.objectweb.jonathan.apis.kernel.JonathanException
Constructs and returns a new EventChannel

Parameters:
address - the IP multicast address to use
port - the port number to use
type - the type of the EventChannel
Returns:
an EventChannel
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - thrown if something goes wrong

bindConsumer

public void bindConsumer(java.lang.Object consumer,
                         EBinder.EId id)
                  throws org.objectweb.jonathan.apis.kernel.JonathanException
Binds a consumer object to the event channel represented by the given identifier.

Parameters:
consumer - the consumer object to add to the channel
id - the identifier of the EventChannel
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - thrown if something goes wrong

decode

public Identifier decode(byte[] data,
                         int offset,
                         int length)
                  throws org.objectweb.jonathan.apis.kernel.JonathanException
Decode an indentifier representing an event channel out of the supplied array of bytes.

Specified by:
decode in interface NamingContext
Parameters:
data - the array of bytes from which to decode the identifier
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
Returns:
an identifier representing the event channel
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - thrown if the decoding fails

decode

public Identifier decode(UnMarshaller u)
                  throws org.objectweb.jonathan.apis.kernel.JonathanException
Decodes an identifier from the provided unmarshaller.

Specified by:
decode in interface NamingContext
Parameters:
u - an unmarhaller;
Returns:
an identifier managed by the target naming context;
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.