Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Module configuration



The configuration for one module is defined in its parent XML application configuration. It contains:
  • The name and identification[1]
    The ID is optional
    of the module: these two elements must be unique for all modules in the parent application[2]
    Which means that two modules can have the same name or identification if they are not in the same application
  • Declaring if the module is a master and is enabled
  • The module implementation
  • The Services interface
  • The declaration of the module properties

Name and identification

The name and identification[1]
The ID is optional
of the module must be unique for all modules in the parent application. For example:
      <module name="Aircraft" id="1">
See also the identification article for the constraints on naming and identification. Note that the identification can be omitted. For example, the following definition is valid:
      <module name="Aircraft" >

Module description

It is possible to add an optional description for a module. This description will not be used by the framework but will be parsed by the browser. There are two ways to specify a description:
  • Either adding a "desc" attribute for a module. For example:
          <module name="Aircraft" desc="the Aircraft description">
    
  • Or for long descriptions you can add a "description" child at the beginning of the module. For example:
             <module name="Aircraft">
             <description>the Aircraft description</description>
    

Master and enabled configuration


By default a module:
  • Is not a master module, which means it has no specific rights on other modules states
  • Is enabled, which means that it can invoke services[3]
    Except if it has been detached from a particular service
    or be notified from services invocations
However, it is possible to change this default behavior:
  • The isMaster attribute specifies that a module is a master module
  • The isEnabled attribute specifies if a module is enabled or not
For example here the module is a master module:
      <module name="Aircraft" isMaster="true">
And here the module is not enabled:
      <module name="InertialNavSystem1" isEnabled="false">
Note that it is possible to change the enabled state of a module by a master module during runtime.

Module implementation

The implementation declaration depends on the module type:
  • Modules which have a Java implementation. The top-level element is module
  • Modules which are implemented in Python. The top-level element is pythonModule
  • Modules which are implemented in Groovy scripts. The top-level element is groovyModule
  • Modules which are implemented in C. The top-level element is cModule
  • Custom user-defined Module types. The top-level element is customModule

Java module implementation

Main Article: Java modules

Python module implementation

Main Article: Python modules

Groovy module implementation

Main Article: Groovy modules

C module implementation

Main Article: C modules

User-defined module implementation


Omitting the modules declaration


If you define a module instance in an application with only this module, you can omit the modules and module declarations.

Module interfaces


The declaration of the Service interface is performed in the Module configuration:
  • The module declares for which services it interfaces to
  • For each Service it interfaces to, it specifies if it is a provider or a subscriber of this Service
  • Several properties can be defined depending on the Service type
The declaration for the interfaces for a module is specified through the interfaces element. For example:
      <module name="FlightManagementSystem">
         <interfaces>
            <subscribe service="position" />
            <eventReceived service="directTo"/>
         </interfaces>
      </module>

Module properties


The module properties define constants which allow to configure a module. Their effective values for the framework are defined in the application properties configuration. Module properties are for the moment only supported by Java modules and Python modules.

Examples

Java module example

In the following example, the FlightManagementSystem module:
  • subscribe to the position publish service
  • subscribe to the directTo event service
  • provides the computeFlightPlan request-response service
      <module name="FlightManagementSystem" id="1" >
         <implementation path="org.da.aircraft.fms.FMS" >
            <initEntryPoint method="init" />
            <startEntryPoint method="start" />
            <defaultReceiveEntryPoint method="receive" />
            <defaultSendEntryPoint method="send" />
         </implementation>
         <interfaces>
            <subscribe service="position" />
            <eventReceived service="directTo"/>
            <requestReceived service="computeFlightPlan"/>
         </interfaces>
      </module>

Groovy module example

In the following example, the FlightManagementSystem module:
  • subscribe to the position publish service
  • subscribe to the directTo event service
  • provides the computeFlightPlan request-response service
      <groovyModule name="FlightManagementSystem" id="1" >
         <groovyImplementation path="fms.groovy" />
         <interfaces>
            <subscribe service="position" />
            <eventReceived service="directTo"/>
            <requestReceived service="computeFlightPlan"/>
         </interfaces>
      </groovyModule>

Python module example

In the following example, the FlightManagementSystem module:
  • subscribe to the position publish service
  • subscribe to the directTo event service
  • provides the computeFlightPlan request-response service
      <pythonModule name="FlightManagementSystem" >
         <pythonImplementation path="pythonAppli"/>
         <interfaces>
            <subscribe service="position" />
            <eventReceived service="directTo"/>
            <requestReceived service="computeFlightPlan"/>
         </interfaces>
      </pythonModule>
Another way to specify the Python module is to explictly specify the ports and port sizes for the Java / Python communication:
      <pythonModule name="FlightManagementSystem" >
         <pythonImplementation path="pythonAppli" inputPort="6000" outputPort="6005" inputSize="1024" outputSize="1024"/>
         <interfaces>
            <subscribe service="position" />
            <eventReceived service="directTo"/>
            <requestReceived service="computeFlightPlan"/>
         </interfaces>
      </pythonModule>

C module example

In the following example, the FlightManagementSystem module:
  • subscribe to the position publish service
  • subscribe to the directTo event service
  • provides the computeFlightPlan request-response service
      <cModule name="FlightManagementSystem" id="1" >
         <cImplementation path="cAppli" />
         <interfaces>
            <subscribe service="position" />
            <eventReceived service="directTo"/>
            <requestReceived service="computeFlightPlan"/>
         </interfaces>
      </cModule>

User-defined module type example


In the following example, the FlightManagementSystem module is a custom defined python module which:
  • subscribe to the position publish service
  • subscribe to the directTo event service
  • provides the computeFlightPlan request-response service
      <customModule name="FlightManagementSystem" id="1" type="python" >
         <implementation path="pythonAppli" />
            <parameter key="inputPort" value="6000" />
            <parameter key="outputPort" value="6005" />
         </implementation>
         <interfaces>
            <subscribe service="position" />
            <eventReceived service="directTo"/>
            <requestReceived service="computeFlightPlan"/>
         </interfaces>
      </customModule>

Notes

  1. ^ [1] [2] The ID is optional
  2. ^ Which means that two modules can have the same name or identification if they are not in the same application
  3. ^ Except if it has been detached from a particular service

See also


Categories: config

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence