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

Autodescripted modules



This article explains how to define and instanciate generic Java modules.

Use case

You can see autodescripted modules as classes which you can instanciate.

Normally a Java module is just a jar file which is accessed through the module configuration.

In that case all of the following definitions must be defined in the configuration: However it is possible to specify all these elements in the jar file Manifest. You can consider an autodescripted module as a class which you can instanciate wherever you need to. For example, in the example below, an InertialNavSystem module is defined once in a jar file, and used for two instances:
autodescriptedoverview

Defining an autodescripted module


To define an autodescripted module, you just have to create a jar file containing the code, and specify the Manifest for this module, which will define:

Interfaces declaration


Interfaces are declared exactly as for a regular module. Note that by default:
  • If no interfaces are specified for a Module instance, the interfaces declared for the autodescripted module will be used
  • if interfaces are specified for a Module instance, these interfaces will be used rather than those specified for the autodescripted module

Using an autodescripted module

Main Article: Module instances

Module instances are Java modules which are instances of autodescripted modules. They don't have any implementation because they instanciate their associated autodescripted module.

Example

Simple example

The following definition specifies the manifest for an autodescripted module:
      Modules: org/da/protoframework/tacticalenv/resources/application.xml
      Types: org/da/protoframework/tacticalenv/resources/types.xml
      Services: org/da/protoframework/tacticalenv/resources/services.xml
With the following specification for the application.xml applications configuration:
      <application name="publishAppli">
          <modules>
             <module name="PublishModule" >
                <implementation path="org.da.samples.protoframework.publish.PublishModule" >
                   <initEntryPoint method="init" />
                   <defaultReceiveEntryPoint method="subscribe" />
                </implementation>
                <interfaces>
                   <eventReceived service="event1"/>
                   <eventSend service="event2"/>
                </interfaces>
             </module>
          </modules>
      </application>
If the autodescripted module is defined in the MyModule.jar file, we can use this autodescripted module in the following instance:
      <application name="MyAppli">
        <deployment>
          <lib url="MyModule.jar" />
        </deployment>
      </application>

A more complex example


The tacticalEnv model Application allows to maintain a data store from datas provided by a tacticalEnv Application.
      <applications>
         <application name="tacticalenv">
            <deployment>
               <lib url="tacticalEnv.jar" />
               <lib url="tacticalEnvModel.jar" />
            </deployment>
         </application>
      </applications>

See also


Categories: concepts | development

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