org.robokind.api.messaging
Interface MessageReceiver<Msg,Rec,L extends org.robokind.api.common.utils.Listener<Msg>>

Type Parameters:
Msg - type of Message received
Rec - type of Record received
L - type of Listener notified of new Messages
All Known Implementing Classes:
DefaultMessageReceiver

public interface MessageReceiver<Msg,Rec,L extends org.robokind.api.common.utils.Listener<Msg>>

High-Level Message Receiver. Contains a RecordReceiver for receiving Records. Contains an Adapter for converting Records back to Messages. Notifies Listeners of Messages Received.

Author:
Matthew Stevenson

Method Summary
 void addMessageListener(L listener)
          Adds a Listener to be notified when a Message has been received.
 void pause()
          Pauses a MessageReceiver.
 void removeMessageListener(L listener)
          Removes a Listener from being notified.
 void resume()
          Resumes a paused MessageReceiver.
 void setAdapter(org.robokind.api.common.utils.Adapter<Rec,Msg> adapter)
          Sets the Adapter used to convert Records to Messages.
 void setRecordReceiver(RecordReceiver<Rec> service)
          Sets the RecordReceiver used to receive Records.
 void start()
          Initializes and connects the MessageReceiver, and begins receiving Messages.
 void stop()
          Stops the MessageReceiver, making it unable to receive Messages.
 

Method Detail

setRecordReceiver

void setRecordReceiver(RecordReceiver<Rec> service)
Sets the RecordReceiver used to receive Records.

Parameters:
service - theRecordReceiver to set

setAdapter

void setAdapter(org.robokind.api.common.utils.Adapter<Rec,Msg> adapter)
Sets the Adapter used to convert Records to Messages.

Parameters:
adapter - the Adapter to set

start

void start()
           throws Exception
Initializes and connects the MessageReceiver, and begins receiving Messages.

Throws:
Exception - if there is an error starting

pause

void pause()
Pauses a MessageReceiver.


resume

void resume()
Resumes a paused MessageReceiver.


stop

void stop()
Stops the MessageReceiver, making it unable to receive Messages.


addMessageListener

void addMessageListener(L listener)
Adds a Listener to be notified when a Message has been received.

Parameters:
listener - the Listener to be notified

removeMessageListener

void removeMessageListener(L listener)
Removes a Listener from being notified.

Parameters:
listener - the Listener to remove


Copyright © 2011. All Rights Reserved.