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

Autodescripted modules interfaces declaration



This article explains how interfaces declaration are handled in autodescripted modules.

Overview

By default the interfaces declared for the autodescripted module are used for the Module instances, but it is possible to configure if these interfaces will be used.

Interfaces declaration

Interfaces are declared exactly as for a regular module. The attribute mode for the interfaces declaration specifies how the interfaces from the autodescripted module will be used in the instances:
  • "default" or "clear" means that:
    • If no interfaces are defined for an instance[1]
      If the interfaces element does not exist in the instance
      , all the interfaces in the autodescripted module will be used for this instance
    • If some interfaces are defined for an instance[2]
      If the interfaces element exists in the instance
      , none of the interfaces defined in the autodescripted module will be used in the instance
  • "keep" means that the interfaces defined in the autodescripted module will be added to those specifically defined in the instance

Default /clear behavior

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

Basic usage:no interfaces are specified for the Module instance

For example, suppose the following autodescripted module declaration:
      <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, and we have the following applications configuration:
      <applications>
         <application name="MyAppli">
            <deployment>
               <lib url="MyModule.jar" />
            </deployment>
         </application>                 
      </applications>
The definition is equivalent as:
      <application name="MyAppli">
          <deployment>
      ...
          </deployment>      
          <modules>
             <module name="PublishModule$1" >
                <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>

Case with interfaces specified for the Module instance

If the autodescripted module is defined in the MyModule.jar file, and we have the following applications configuration:
      <applications>
         <application name="MyAppli">
            <deployment>
               <lib url="MyModule.jar" />
            </deployment>
            <modules>            
              <module name="MyModule" >
                  <interfaces>
                     <subscribe service="position"/>
                  </interfaces>
               </module>         
          </modules>                  
         </application>                 
      </applications>
The definition is equivalent as:
      <application name="MyAppli">
          <deployment>
      ...
          </deployment>      
          <modules>
             <module name="MyModule" >
                <implementation path="org.da.samples.protoframework.publish.PublishModule" >
                   <initEntryPoint method="init" />
                   <defaultReceiveEntryPoint method="subscribe" />
                </implementation>
                <interfaces>
                   <subscribe service="position"/>
                </interfaces>
             </module>
          </modules>
      </application>
Note that the following interfaces specification in the autodescripted module will produce the same result:
      <interfaces mode="clear">
         <eventReceived service="event1"/>
         <eventSend service="event2"/>
      </interfaces>

Keep behavior

The keep behavior specifies that:
  • The interfaces defined in the autodescripted module will be added to those specifically defined in the instance
For example, suppose the following autodescripted module declaration:
      <application name="publishAppli">
          <modules>
             <module name="PublishModule" >
                <implementation path="org.da.samples.protoframework.publish.PublishModule" >
                   <initEntryPoint method="init" />
                   <defaultReceiveEntryPoint method="subscribe" />
                </implementation>
                <interfaces mode="keep">
                   <eventReceived service="event1"/>
                   <eventSend service="event2"/>
                </interfaces>
             </module>
          </modules>
      </application>
If the autodescripted module is defined in the MyModule.jar file, and we have the following applications configuration:
      <applications>
         <application name="MyAppli">
            <deployment>
               <lib url="MyModule.jar" />
            </deployment>
            <modules>            
              <module name="MyModule" >
                  <interfaces>
                     <subscribe service="position"/>
                  </interfaces>
               </module>         
          </modules>                  
         </application>                 
      </applications>
The definition is equivalent as:
      <application name="MyAppli">
          <deployment>
      ...
          </deployment>      
          <modules>
             <module name="MyModule" >
                <implementation path="org.da.samples.protoframework.publish.PublishModule" >
                   <initEntryPoint method="init" />
                   <defaultReceiveEntryPoint method="subscribe" />
                </implementation>
                <interfaces>
                   <eventReceived service="event1"/>
                   <eventSend service="event2"/>                
                   <subscribe service="position"/>
                </interfaces>
             </module>
          </modules>
      </application>

Overriding the autodescripted module interfaces mode for an instance

It is possible to override the interfaces mode for an instance, but using the mode attribute at the instance level.

For example, suppose the following autodescripted module declaration:
      <application name="publishAppli">
          <modules>
             <module name="PublishModule" >
                <implementation path="org.da.samples.protoframework.publish.PublishModule" >
                   <initEntryPoint method="init" />
                   <defaultReceiveEntryPoint method="subscribe" />
                </implementation>
                <interfaces mode="keep">
                   <eventReceived service="event1"/>
                   <eventSend service="event2"/>
                </interfaces>
             </module>
          </modules>
      </application>
We are able to specify for an instance that the mode will be clear and not keep with:
      <applications>
         <application name="MyAppli">
            <deployment>
               <lib url="MyModule.jar" />
            </deployment>
            <modules>            
              <module name="MyModule" >
                  <interfaces mode="keep">
                     <subscribe service="position"/>
                  </interfaces>
               </module>         
          </modules>                  
         </application>                 
      </applications>

Notes

  1. ^ If the interfaces element does not exist in the instance
  2. ^ If the interfaces element exists in the instance

See also


Categories: concepts | development

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