All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jive.erlang.EReceiver

java.lang.Object
   |
   +----jive.erlang.EReceiver

public class EReceiver
extends Object
implements Runnable
EReceiver is a class that reads messages sent from the server to the client. The class will read each message, find out who should receive the message and then deliver the message to the recipient.

Each class that wants to receive messages from the Erlang server should implement the EReceive interface and then register itself to the EReceiver object.

Author:
Kaj Nygren (kaj@medialab.ericsson.se), Joakim Grebenö (jocke@erix.ericsson.se)

Method Index

 o connect()
Connects the client to the server.
 o connected()
Returns whether or not the client is connected to the server.
 o disconnect()
Disconnects the client from the server.
 o init(Socket, Unpacker, EProcess)
Called from the ESock object when the socket connection has been opened.
 o register(EReceive)
Registers an EReceive object.
 o remove(EInteger)
Unregisters an EReceive object given the corresponding EInteger targetID.
 o remove(EReceive)
Unregisters an EReceive object.
 o run()
The main loop of this thread.
 o self()
Returns the EProcess that represents the Erlang process that sends messages to this client.
 o toID(EReceive)
Converts an EReceive target to the corresponding targetID.
 o toTarget(EInteger)
Converts an EInteger targetID to the corresponding EReceive target.

Methods

 o connect
 public void connect() throws JiveIOException
Connects the client to the server.

Throws: JiveIOException
If a connection error occurred.
 o disconnect
 public void disconnect()
Disconnects the client from the server.

 o connected
 public boolean connected()
Returns whether or not the client is connected to the server.

 o init
 protected void init(Socket s,
                     Unpacker unpacker,
                     EProcess self)
Called from the ESock object when the socket connection has been opened.

The method is inherently synchronized since it's called from ESock.initReceiver which is synchronized.

 o run
 public void run()
The main loop of this thread. It waits until a message has been delivered. Then it will parse the message and deliver it to the recipient.

 o self
 protected EProcess self() throws JiveIOException
Returns the EProcess that represents the Erlang process that sends messages to this client. The self process should be supplied to all Erlang processes that should be able to communicate with an EReceive object on the client.

Throws: JiveIOException
If the client isn't connected.
 o register
 public EInteger register(EReceive target)
Registers an EReceive object. The EReceive object can then receive messages that are sent from an Erlang process. The method returns an EInteger which should be sent to the Erlang process wanting to communicate with the EReceive object.

 o remove
 public void remove(EReceive target)
Unregisters an EReceive object.

 o remove
 public void remove(EInteger targetID)
Unregisters an EReceive object given the corresponding EInteger targetID.

 o toID
 public EInteger toID(EReceive target)
Converts an EReceive target to the corresponding targetID. This method assumes that the EReceive target is registered.

 o toTarget
 public EReceive toTarget(EInteger targetID)
Converts an EInteger targetID to the corresponding EReceive target. This method assumes that the EReceive target is registered.


All Packages  Class Hierarchy  This Package  Previous  Next  Index