copyright The Portico Project 2008.

org.portico.lrc.handlers
Class REQ_RegisterObjectHandler

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

public class REQ_RegisterObjectHandler
extends LRCMessageHandler

This class handles the registration of new objects.


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_RegisterObjectHandler()
           
 
Method Summary
 void checkDDM(RTI_RegisterObject request, OCMetadata objectClass)
          This method will run DDM related checks on the provided information.
private  OCMetadata checkPublished(int classHandle)
          This method will try to find the OCMetadata for the object class with the given handle, validate that this federate is publishing that class and then return the metadata.
 void processMessage(com.lbf.commons.messaging.MessageContext context)
          This method does some state validity checks and then ensures that the handle of the class that the federate is attempting to register an instance of is actually contained within the FOM.
 
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_RegisterObjectHandler

public REQ_RegisterObjectHandler()
Method Detail

processMessage

public void processMessage(com.lbf.commons.messaging.MessageContext context)
                    throws Exception
This method does some state validity checks and then ensures that the handle of the class that the federate is attempting to register an instance of is actually contained within the FOM. The method then makes sure the federate is publishing that object class before passing the request on to the RTI for further processing.

If the RTI responds with a sucess message, the newly created OCInstance representing the object is extracted and stored in the LRCInstanceRepository for later processing.

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

checkPublished

private OCMetadata checkPublished(int classHandle)
                           throws JObjectClassNotDefined,
                                  JObjectClassNotPublished,
                                  JRTIinternalError
This method will try to find the OCMetadata for the object class with the given handle, validate that this federate is publishing that class and then return the metadata.

Throws:
JObjectClassNotDefined
JObjectClassNotPublished
JRTIinternalError

checkDDM

public void checkDDM(RTI_RegisterObject request,
                     OCMetadata objectClass)
              throws JAttributeNotDefined,
                     JAttributeNotPublished,
                     JRegionNotKnown,
                     JInvalidRegionContext
This method will run DDM related checks on the provided information. It will validate that each of the attributes exists, that each of the regions is known and can be associated with attributes of the type it is trying to be linked with, and will remove redundant information from the lists (e.g. if there are multiple entries for a single attribute, all but the first will be removed).

Throws:
JAttributeNotDefined
JAttributeNotPublished
JRegionNotKnown
JInvalidRegionContext

copyright The Portico Project 2008.