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

User properties tutorial



In this tutorial, we will use the second tutorial with two instances of one module, but we will make the presence of one of this instance depend from the value of a user-defined properties.

Overview

In the first tutorial, we had two modules:
  • The PublishModule module increments or decrements a value cyclically
  • The EventModule module allows to click on a toggle to set if the first module should increment or decrement the value, and shows the value. There are two instances of this module
The only changes you will have to do are in the XML configuration.

Filelist configuration

The initial filelist configuration was:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
      </files>
We will add a user-defined property in the configuration:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
      <confProperty key="twoGUI" value="false" />
      </files>

Applications definition

We will change the applications.xml XML file, by adding a condition to one of the EventModules:
          <application name="eventAppli">
         <deployment>
            <lib url="samples1Event.jar" />
         </deployment>
         <modules>
            <module name="EventModule1" id="1" > 
               <implementation path="org.da.samples.protoframework.event.EventModule" >
                  <initEntryPoint method="init" />
                  <defaultReceiveEntryPoint method="subscribe" />
               </implementation>
               <interfaces>
                  <eventSend service="event" attach="attach"/>
                  <subscribe service="published" />
               </interfaces>             
            </module>
         </modules>
         <modules>
            <module name="EventModule2" condition="${twoGUI}" > 
               <implementation path="org.da.samples.protoframework.event.EventModule" >
                  <initEntryPoint method="init" />
                  <defaultReceiveEntryPoint method="subscribe" />
               </implementation>
               <interfaces>
                  <eventSend service="event" attach="attach"/>
                  <subscribe service="published" />
               </interfaces>             
            </module>
         </modules>      
      </application>
The "EventModule2" module will exist only if the value of the "twoGUI" property is true.

Starting the framework

To show how our condition work, we will add the "starterGUI" argument to allow to override the value of the property at start through a Popup dialog:
      java -jar protoframework.jar config=filelist.xml starterGUI
We will have the following window Popup at start:
launchproperties
  • If we don't change the value of the property at start, only one instance of the event modules will be created. It will work exactly as the first tutorial
  • If we set the value of the property at start to true, the two instances of the event modules will be created. It will work exactly as the second tutorial

See also


Categories: tutorials

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