copyright The Portico Project 2008.

org.portico.lrc.handlers
Class REQ_PublishInteractionHandler

java.lang.Object
  extended by com.lbf.commons.messaging.AbstractMessageHandler
      extended by org.portico.lrc.handlers.LRCMessageHandler
          extended by org.portico.lrc.handlers.REQ_PublishInteractionHandler
All Implemented Interfaces:
com.lbf.commons.messaging.IMessageHandler

public class REQ_PublishInteractionHandler
extends LRCMessageHandler

This handler manages interaction publish/unpublish requests. It will make all the appropriate checks before sending the request on to the RTI, and it will store the relevant information once it has been returned from the RTI.

Before *ANY* request is processed, the processMessage() method will check to make sure the federate is an execution member and that a save or restore is not currently in progress.


Field Summary
 
Fields inherited from class org.portico.lrc.handlers.LRCMessageHandler
interests, logger, lrc, regions, repository, state
 
Fields inherited from class com.lbf.commons.messaging.AbstractMessageHandler
augmentable, name
 
Constructor Summary
REQ_PublishInteractionHandler()
           
 
Method Summary
 void processMessage(com.lbf.commons.messaging.MessageContext context)
          Processes an incoming message and depending on the type, delegates it to the appropriate private handling method.
private  void publish(com.lbf.commons.messaging.MessageContext context)
          Attempt to inform the RTI that the federate wishes to publish the given interaction class.
private  void unpublish(com.lbf.commons.messaging.MessageContext context)
          Attempt to inform the RTI that the federate wishes to no longer publish the given interaction class.
private  void validate(int classHandle)
          This method will verify that the interaction class exists in the FOM.
private  void validatePublished(int classHandle)
          This method validates that the given interaction class is published by this federate
 
Methods inherited from class org.portico.lrc.handlers.LRCMessageHandler
error, error, getConnection, getFOM, initialize, sendMessage, success, success, success
 
Methods inherited from class com.lbf.commons.messaging.AbstractMessageHandler
getName, isAugmentable, setAugmentable, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

REQ_PublishInteractionHandler

public REQ_PublishInteractionHandler()
Method Detail

processMessage

public void processMessage(com.lbf.commons.messaging.MessageContext context)
                    throws Exception
Processes an incoming message and depending on the type, delegates it to the appropriate private handling method.

Specified by:
processMessage in interface com.lbf.commons.messaging.IMessageHandler
Specified by:
processMessage in class LRCMessageHandler
Throws:
Exception

publish

private void publish(com.lbf.commons.messaging.MessageContext context)
              throws Exception
Attempt to inform the RTI that the federate wishes to publish the given interaction class. Once the interaction handle has been validated (to make sure it exists in the FOM), the request is sent to the RTI. It a success response is received, the publication interest is recorded in the LRCInterestManager.

Throws:
Exception

unpublish

private void unpublish(com.lbf.commons.messaging.MessageContext context)
                throws Exception
Attempt to inform the RTI that the federate wishes to no longer publish the given interaction class. Once the interaction handle has been validated (to make sure it exists in the FOM), and the method has ensured that the interaction class is currently being published by the federate, the request is sent to the RTI. It a success response is received, the publication interest is removed from the LRCInterestManager.

Throws:
Exception

validate

private void validate(int classHandle)
               throws JInteractionClassNotDefined,
                      JRTIinternalError
This method will verify that the interaction class exists in the FOM.

Throws:
JInteractionClassNotDefined - If the classHandle doesn't represent a class in the FOM
JRTIinternalError - If there is a problem locating the FOM

validatePublished

private void validatePublished(int classHandle)
                        throws JInteractionClassNotPublished
This method validates that the given interaction class is published by this federate

Throws:
JObjectClassNotPublished - If the object class is not currently published
JInteractionClassNotPublished

copyright The Portico Project 2008.