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

Using user-defined properties to customize the framework architecture



It is possible to use user-defined properties to customize the framework architecture. This can be achieved through the "condition" attribute on the following elements on the applications configuration files: It can also be used to configure the filelist configuration, for the following elements:

Overview

The "condition" attribute allows to use values of user-defined properties to use portions of the architecture or not.

Note that its different from disabling a module. For example, if a condition removes a module from the architecture, it will not be instanciated, and thus it will be impossible to re-enable it at runtime.

Condition attribute

The "condition" attribute can have one of the following patterns:
  • exists(${propertyName}): the condition will be true only if the property exists (ie is defined)
  • notExists(${propertyName}): the condition will be true only if the property does not exists (ie is not defined)
  • not(${propertyName}): the condition will be true only if the property does not exists (ie is not defined) or its value is not equal to "true"
  • ${propertyName} = value or ${propertyName} == value): the condition will be true only if the property exists and has the specified value
  • ${propertyName} != value: the condition will be true only if the property exists and has another value than the specified value
  • ${propertyName}: the condition will be true only if the property exists and has the value "true"

Usages

You can make an application depend on a condition. For example:
      <application name="MyAppli" condition="${theVar}=true">
      ...
      </application>
You can make a module depend on a condition. For example:
      <module name="MyModule" condition="exists(${theVar})">
      ...
      </module>
You can make a module interface depend on a condition. For example:
      <module name="MyModule"> 
         <implementation path="org.da.MyModule" >
            <initEntryPoint method="init" />
         </implementation>
         <interfaces>
            <eventSend service="event1"/>
            <eventReceived service="event2" condition="exists(${theVar})"/>
         </interfaces>

Example

Suppose the following filelist configuration:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
         <confProperty key="theVar" value="false" />
      </files>
And the associated application configuration:
      <application name="MyAppli">
         <deployment>
            <lib url="MyAppli.jar" />
         </deployment>
         <modules>
            <module name="SenderModule1"> 
               <implementation path="org.da.SenderModule1" >
                  <initEntryPoint method="init" />
               </implementation>
               <interfaces>
                  <eventSend service="event1"/>
               </interfaces>             
            </module>
            <module name="SenderModule2" condition="${theVar}=true"> 
               <implementation path="org.da.SenderModule2" >
                  <initEntryPoint method="init" />
               </implementation>
               <interfaces>
                  <eventSend service="event2"/>
               </interfaces>             
            </module>         
            <module name="ReceiverModule"> 
               <implementation path="org.da.ReceiverModule" >
                  <initEntryPoint method="init" />
                  <defaultReceiveEntryPoint method="subscribe" />
               </implementation>
               <interfaces>
                  <eventReceived service="event1" />
                  <eventReceived service="event2" />
               </interfaces>             
            </module>                  
         </modules>
      </application>
The architecture is the following:
customarch1
With the value of the variable as defined in the filelist, we will have the resulting architecture:
customarch2

See also


Categories: config

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