RTIComponent Launcher

RTIComponent Launcher is an JDK 1.2 application to run components that exchange attributes of object and parameters of interactions. Components describe their interest to publish and subscribe objects in the federeation executions with an XML formatted configuration file. Components should implement the RTIComponent interface. RTIComponent interface contains a method for setting the RTIContext object from which the component gets the MessagePublisher and MessageFactory object, and registers a MessageHandler object to receive the incoming calls. Other methods in RTIComponent are related to lifecycle.

RTIComponent DTD

<!ELEMENT object    (attribute*)>
<!ATTLIST object    name CDATA #REQUIRED>
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute name CDATA #REQUIRED>
<!ATTLIST attribute callback CDATA #IMPLIED>
<!ELEMENT interaction (parameter*)>
<!ATTLIST interaction name CDATA #REQUIRED>
<!ELEMENT parameter EMPTY>
<!ATTLIST parameter name CDATA #REQUIRED>
<!ATTLIST parameter callback CDATA #IMPLIED>
<!ELEMENT publish    (object|interaction)+>
<!ELEMENT subscribe  (object|interaction)+>
<!ELEMENT federation (publish?,subscribe?)>
<!ELEMENT RTIComponent (federation+)>
<!ATTLIST RTIComponent name CDATA #REQUIRED>

An example configuration file looks as follows:

<RTIComponent name="HelloWorlViewer">
 <federation name="HelloWorld"> 
  <publish> 
   <object name="Country"> 
    <attribute name="Name"/> 
    <attribute name="Population"/> 
   </object>  
   <interaction name="Communication"> 
    <parameter name="Message"/> 
   </interaction>  
  </publish> 
  <subscribe>
   <object name="Country"> 
    <attribute name="Name"/> 
    <attribute name="Population"/> 
   </object> 
   <interaction name="Communication"> 
    <parameter name="Message"/> 
   </interaction>  
  </subscribe> 
 </federation> 
</RTIComponent>

The component can specify the callback method name (parameter will be byte[]). For attribute updates, first parameter contains the instance identifier and the second parameter contains the byte[].

  <subscribe>
   <object name="Country"> 
    <attribute name="Name" callback="setName"/>
    <attribute name="Population" callback="setPopulation"/> 
   </object> 
   <interaction name="Communication"> 
    <parameter name="Message" callback="setMessage"/> 
   </interaction>  
  </subscribe> 
 
This description looks for the following methods:
setName(int objectId, byte[] value);
setPopulation(int objectId, byte[] value);
setMessage(byte[] value);

It is also possible to mention only the object or interaction class name instead of enumerating all the attributes and parameters.

name attribute of RTIComponent element is used to give the class name. Instead, this information can be defined by another element as follows:

<implementation> 
 <classname>..</classname>
 <path>..</path>
 <jarfile>..</jarfile>
 <url>..</url>
</implementation> 

The following DTD definition should be added to the RTIComponent DTD description.

<!ELEMENT classname PCDATA>
<!ELEMENT path      PCDATA>
<!ELEMENT jarfile   PCDATA>
<!ELEMENT url       PCDATA>
<!ELEMENT implementation (classname,path*,jarfile*,url*)>

Responsibilities of Component Developer

  1. provide the configuration file,
  2. provide an implementation of RTIComponent interface, and
  3. provide an implementation of MessageHandler interface.

RTIComponent Launcher Internals

Launcher defines one FederationAmbassador per active federation. Launcher defines one RTIAmbassador. The interaction between container and components are Push-Push model.

Launcher defines message queues for:

  1. Discover/RemoveObjectMessage queue,
  2. UpdateAttributeMessage queue,
  3. UpdateParameterMessage queue.

FederateAmbassador publishes Message objects to the proper queues based on the callback call from the RTI.

Launcher defines PullProxy for each component. PullProxy is registered by the Launcher to proper queues. PullProxy takes Messages from the queue and filters if necessary. After it decides that it need to inform the component, then it uses the proper CallbackInvoker object. CallbackInvoker (default) uses the handleMessage().

  1. AggregatedFedAmbFactory : implements Factory and Finder patterns for AggregatedFedAmb objects. Uses FedNameToAmbMap object.

  2. FedNameToAmbMap : keeps the mapping between the federation name and AggregatedFedAmb object.

  3. AggregatedFedAmb : implements the FederateAmbassador interface. Contains information about the joining RTIComponents through this object. Contains remove/join methods. It will be removed when it is not serving any local RTIComponent. Defines three message queues (UpdateAttribute, UpdateParameter, Discover/RemoveObject). Contains methods to get the handle of these queues. Publishes RTI callbacks in Message format to the proper queues.

  4. PullProxyFactory : Accepts the subscription definitions and produces a PullProxy object containing filtering.

  5. RTIComponentLoader : Loads the component.

    I can load from:
    1. class files by using path and system path.
    2. class files by url.
    3. class files by using jar file from the given path.
    4. class files by using jar file from the given url.

  6. ObjectInstanceMapper : Each component can have multiple instances. Each one of them are registered through this mapper. Each component contains a RTIContext object which contains the handle of MessageHandler object provided by the component.

  7. RTIContextFactory : Factory pattern for RTIContext objects.

Messages

The interaction between the component and the container based on the following Message types:

  1. DefineObjectMessage
  2. DiscoverObjectMessage
  3. RemoveObjectMessage
  4. UpdateAttributeMessage
  5. UpdateParameterMessage

DefineObjectMessage is send by the component when a new object is defined.

DiscoverObjectMessage is send to the component to inform the existence of that particular object.

RemoveObjectMessage is send to the component to informm that the object is removed.

UpdateAttributeMessage is send to/from the component to receive/update the attribute of a particular object.

UpdateParameterMessage is send to/from the component to receive/update the parameter of an interaction class.

Class diagram for Message Types. InteractionMessage and ObjectMessage classes are abstract.

MessageFactory object has static methods to create a particular messages.

Factory object for Messages.

MessageFactory object is defined per federation. Each MessageFactory object knows the handle of:

  1. RTIInteractionLookUp
  2. RTIObjectClassAttributeLookUp

MessageFactory object throws an exception for invalid names.

RTIInteractionLookUp 
  Hashtable interactionName_to_record;
  Hashtable interactionId_to_record;

  getInteractionClassId(String);
  getInteractionClassName(id);
  getParameterId(String,String);
  getParameterName(String,id);
RTIInteractionClassRecord
  String    interactionClassName;
  int       id;
  Hashtable parameterName_to_id;
  Hashtable id_to_parameterName;

  getInteractionClassId();
  getInteractionClassName();
  getParameterId(String);
  getParameterName(id);
RTIObjectClassAttributeLookUp 
  Hashtable objectClassName_to_record;
  Hashtable objectClassId_to_record;

  getObjectClassId(String);
  getObjectClassName(id);
  getObjectAttributeId(String,String);
  getObjectAttributeName(String,id);
RTIObjectClassRecord
  String    objectClassName;
  int       id;
  Hashtable attributeName_to_id;
  Hashtable id_to_attributeName;

  getObjectClassId();
  getObjectClassName();
  getObjectAttributeId(String);
  getObjectAttributeName(id);

Q: It can be possible to associate type description to attribute or a parameter. Then the framework knows how to marshal/unmarshal properly.
FederationDescription
  MessageFactory
  AggregatedFedAmb
  RTIContextFactory
  ObjectInstanceMapper
RTIContext
  MessageFactory
  MessagePublisher

Components implement the RTIComponent interface to be launched by the RTIComponent Launcher. RTIComponent interface contains the following methods:

  1. setContext() :
  2. created()
  3. activated()
  4. deactivated()
  5. removed()

RTIContext interface contains:

  1. registerMessageHandler()
  2. MessageFactory getMessageFactory()
  3. MessagePublisher getMessagePublisher()

MessageHandler interface contains:

  1. handleMessage(Message inMsg) : the container uses this method to inform the component.

MessagePublisher interface contains only one method:

  1. push(Message inMsg) : the component builds the message and publishes by using this object.

Interaction between container and component is based on two interfaces.

CallbackInvoker

CallbackInvoker object invokes the handleMessage() method on the component provided MessageHandler interface. It is obtained from CallbackInvokerFactory object. DCallbackInvoker object invokes the method provided by the component's MessageHandler implementation. If this method does not exist, it uses the invoke() method of its parent (CallbackInvoker).

Queues

Each queue object implements the Queue interface. Each AggregatedFedAmb object has at most three queues.

Classes and Interfaces

Java Doc..