|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lbf.commons.messaging.AbstractMessageHandler
org.portico.lrc.handlers.LRCMessageHandler
org.portico.lrc.handlers.REQ_SubscribeObjectHandler
public class REQ_SubscribeObjectHandler
This handler manages object attribute subscribe/unsubscribe 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, theprocessMessage()
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_SubscribeObjectHandler()
|
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 |
subscribe(com.lbf.commons.messaging.MessageContext context)
Handle a request to subscribe to a set of attributes for a specific object class. |
private void |
subscribeWithDDM(com.lbf.commons.messaging.MessageContext context,
RTI_SubscribeObjectClass request)
This method handles subscription requests that include DDM information. |
private void |
unsubscribe(com.lbf.commons.messaging.MessageContext context)
This method handles requests to remove a subscription for a specific object class (or a subset of attributes within that class). |
private void |
unsubscribeDDM(com.lbf.commons.messaging.MessageContext context,
RTI_UnsubscribeObjectClass request)
This method handles an unsubscribe request when DDM information is used. |
private void |
unsubscribeImplicit(com.lbf.commons.messaging.MessageContext context,
int classHandle,
String target)
This method converts a previous subscription request that contained 0-attributes into an unsubscribe request ( RTI_UnsubscribeObjectClass ) for the identified class. |
private void |
unsubscribeImplicitDDM(com.lbf.commons.messaging.MessageContext context,
int classHandle,
String target,
int regionToken)
Same as unsubscribeImplicit(MessageContext, int, String) except that it can include
region data. |
private void |
validateDDM(int classHandle,
int regionToken,
Set<Integer> attributes)
This method will validate the DDM related parts of a subscription request. |
private void |
validateHandles(int classHandle,
Set<Integer> attributes)
This method will verify that the object class exists in the FOM, and that each of the attribute handles represents an attribute that exists for the object class. |
private void |
validateRegion(int regionToken)
Makes sure the region is valid (that we know about it). |
private void |
validateSubscribed(int classHandle)
Validates that the given object class is subscribed 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 |
---|
public REQ_SubscribeObjectHandler()
Method Detail |
---|
public void processMessage(com.lbf.commons.messaging.MessageContext context) throws Exception
processMessage
in interface com.lbf.commons.messaging.IMessageHandler
processMessage
in class LRCMessageHandler
Exception
private void subscribe(com.lbf.commons.messaging.MessageContext context) throws Exception
LRCInterestManager
.
If the provided set of attribute handles is empty, the request is taken to be an implicit
unpublication request for all attributes of the object class. In that case, processing is
turned over to #unsubscribeOCImplicit(MessageContext, int, String)
.
Exception
private void subscribeWithDDM(com.lbf.commons.messaging.MessageContext context, RTI_SubscribeObjectClass request) throws Exception
Exception
private void unsubscribeImplicit(com.lbf.commons.messaging.MessageContext context, int classHandle, String target) throws Exception
RTI_UnsubscribeObjectClass
) for the identified class. It then
passes this request to the #unsubscribeOC(MessageContext)
method for processing.
Exception
private void unsubscribeImplicitDDM(com.lbf.commons.messaging.MessageContext context, int classHandle, String target, int regionToken) throws Exception
unsubscribeImplicit(MessageContext, int, String)
except that it can include
region data. If you don't want to include a region, either call the other method or pass
PorticoConstants.NULL_HANDLE
as the regionToken.
Exception
private void unsubscribe(com.lbf.commons.messaging.MessageContext context) throws Exception
LRCInterestManager
If the unsubscription request includes a specific set of attributes that should be
unsubscribed (rather than the entire class), the method will validate that each of the
attribute handles exists in the FOM before allowing the message to travel to the RTI.
Exception
private void unsubscribeDDM(com.lbf.commons.messaging.MessageContext context, RTI_UnsubscribeObjectClass request) throws Exception
Exception
private void validateHandles(int classHandle, Set<Integer> attributes) throws JObjectClassNotDefined, JAttributeNotDefined, JRTIinternalError
JObjectClassNotDefined
- If the classHandle doesn't represent a class in the FOM
JAttributeNotDefined
- If an attribute handle doesn't represent an attribute in
the defined object class
JRTIinternalError
- If there is a problem locating the FOMprivate void validateSubscribed(int classHandle) throws JObjectClassNotSubscribed
JObjectClassNotSubscribed
- If the object class is not currently subscribed toprivate void validateDDM(int classHandle, int regionToken, Set<Integer> attributes) throws JRegionNotKnown, JInvalidRegionContext, JRTIinternalError
JRegionNotKnown
JInvalidRegionContext
JRTIinternalError
private void validateRegion(int regionToken) throws JRegionNotKnown
JRegionNotKnown
|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |