copyright The Portico Project 2008.

org.portico.lrc
Class LRCConnection

java.lang.Object
  extended by org.portico.lrc.LRCConnection
Direct Known Subclasses:
JSOPClientConnection, JVMClientConnection

public abstract class LRCConnection
extends Object

The LRC needs an entry point into each communications binding. That entry point should be a subclass of LRCConnection. This class provides some helper methods designed to make the job of concrete implementations easier.

Each communications binding must provide an implemetation of the sendMessage(MessageContext) method that takes the message and sends it to the RTI. The receiveCallback(FED_CallbackMessage) and receiveCallback(MessageContext) methods are provides as helpers, and should be invoked by the connection any time it receives a callback.

Each connection implementation also needs to implement two lifecycle methods: startup() and close(). It can also optionally implement a third method called configure(Bag) that will allow it to perform any pre-startup initialization.


Field Summary
protected  org.apache.log4j.Logger logger
           
protected  LRC lrc
           
 
Constructor Summary
protected LRCConnection()
           
 
Method Summary
abstract  void close()
          This method is called when the connection should be closed.
 void configure(com.lbf.commons.utils.Bag<String,?> properties)
          This method will check the given properties for the LRC.KEY_LRC, which should be bound to an instance of the LRC that this connection is to be associated with.
 void receiveCallback(FED_CallbackMessage message)
          The same as receiveCallback(MessageContext) except that it works with a callback message rather than a context.
 void receiveCallback(com.lbf.commons.messaging.MessageContext context)
          This method will drop the provided message on the callback queue.
abstract  void sendMessage(com.lbf.commons.messaging.MessageContext context)
          Any connection implementation must implement this method in the manner appropriate for the connection type.
abstract  void startup()
          This method is called when the connection is first started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lrc

protected LRC lrc

logger

protected org.apache.log4j.Logger logger
Constructor Detail

LRCConnection

protected LRCConnection()
Method Detail

configure

public void configure(com.lbf.commons.utils.Bag<String,?> properties)
               throws com.lbf.commons.config.ConfigurationException
This method will check the given properties for the LRC.KEY_LRC, which should be bound to an instance of the LRC that this connection is to be associated with. If that property is missing, an exception will be thrown.

Throws:
com.lbf.commons.config.ConfigurationException

startup

public abstract void startup()
                      throws JRTIinternalError
This method is called when the connection is first started. It will always be called only once: after configure(Bag), but before the connection is asked to send any messages.

Throws:
JRTIinternalError

close

public abstract void close()
                    throws JRTIinternalError
This method is called when the connection should be closed. The various implementations need to put any cleanup logic in here.

Throws:
JRTIinternalError

sendMessage

public abstract void sendMessage(com.lbf.commons.messaging.MessageContext context)
                          throws Exception
Any connection implementation must implement this method in the manner appropriate for the connection type. It should take the given message and send it to the RTI.

Throws:
Exception

receiveCallback

public void receiveCallback(com.lbf.commons.messaging.MessageContext context)
                     throws JRTIinternalError
This method will drop the provided message on the callback queue. It is expected that the request portion of the message context be of the type FED_CallbackMessage. If it is not, a JRTIinternalError will be thrown.

Throws:
JRTIinternalError

receiveCallback

public void receiveCallback(FED_CallbackMessage message)
                     throws Exception
The same as receiveCallback(MessageContext) except that it works with a callback message rather than a context.

Throws:
Exception

copyright The Portico Project 2008.