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

Environment variables tutorial



In the third tutorial, one module increments or decrements a value by a step defined by the factor cyclically. In this tutorial, we will use environment variables to set several valeus and properties:
  • Set the value of the factor property using an environment variable
  • Set the path of the properties file using an environment variable

Initial filelist

The filelist configuration had the following content:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
         <file url="properties.xml" />
      </files>

Modified filelist and environment variables

We will use two environment variables:
  • PROPERTIES for the path of the properties file
  • FACTOR for the value of the factor property
Which will give us the following content for the configuration:
      <files>
         <env key="PROPERTIES" default="properties.xml" />
         <env key="FACTOR" default="1" />
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
         <file url="${PROPERTIES}" />
      </files>
The default value for the PROPERTIES variable (if there is no environment variable of this name) will be "properties.xml". The default value for the FACTOR variable (if there is no environment variable of this name) will be "1".

Modified properties file

We will modify the properties file to use the new FACTOR environment variable:
      <properties>
         <application name="publishAppli" >
            <module name="PublishModule" >
               <moduleProperty key="factor" value="${FACTOR}" />
            </module>
         </application>
      </properties>

Starting the framework on Windows

We will define a bat file to call the framework:
      set PROPERTIES=properties.xml
      set FACTOR=10
      "C:\Program Files\Java\jdk1.8.0_111\jre\bin\java" -jar protoFramework.jar config=filelist.xml

See also


Categories: tutorials

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