copyright The Portico Project 2008.

org.portico.lrc.handlers
Class REQ_InteractionHandler

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

public class REQ_InteractionHandler
extends LRCMessageHandler

This class handles requests to send an interaction.


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_InteractionHandler()
           
 
Method Summary
 void processMessage(com.lbf.commons.messaging.MessageContext context)
          This method will first perform any necessary state validity checks.
 ICMetadata validateICPublished(int classHandle, Set<Integer> parameters)
          This method will validate that the given interaction class exists in the FOM and is being published by the federate associated with this LRC.
private  void validateRegion(ICMetadata interactionClass, int regionToken)
          Validate that the region is known to the federate, and that it is valid for the class of interaction that is being sent.
 
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_InteractionHandler

public REQ_InteractionHandler()
Method Detail

processMessage

public void processMessage(com.lbf.commons.messaging.MessageContext context)
                    throws Exception
This method will first perform any necessary state validity checks. If the message is timestamped, it will ensure that the associated time is not less that the current LBTS for the sending federate. After this, it will validate that the federate is a publisher of the interaction class and should it be so, it will hand the request off to the RTI.

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

validateRegion

private void validateRegion(ICMetadata interactionClass,
                            int regionToken)
                     throws JRegionNotKnown,
                            JInvalidRegionContext
Validate that the region is known to the federate, and that it is valid for the class of interaction that is being sent. If all is OK, this method will return without incident, if not, an exception will be thrown.

Throws:
JRegionNotKnown - If the regionToken doesn't correspond to a region that was created by the federate and is known to it.
JInvalidRegionContext - If the space associated with the region is different to the space that the FOM associates with the interaction class (or there is no space associated with the interaction class in the FOM).

validateICPublished

public ICMetadata validateICPublished(int classHandle,
                                      Set<Integer> parameters)
                               throws JInteractionClassNotPublished,
                                      JInteractionClassNotDefined,
                                      JInteractionParameterNotDefined
This method will validate that the given interaction class exists in the FOM and is being published by the federate associated with this LRC. It will also check that each of the given parameter handles are valid within the FOM. Finally, it will return the ICMetadata instance for the interaction so that it is available for use in other checks.

Parameters:
classHandle - The handle of the interaction class
parameters - The set of parameter handles that have been supplied with the interaction
Returns:
The ICMetadata instance representing the interaction class for later use
Throws:
JInteractionClassNotPublished
JInteractionClassNotDefined
JInteractionParameterNotDefined

copyright The Portico Project 2008.