Home
Categories
Dictionary
Download
Project Details
Changes Log
Who We Are
FAQ
License

Configuration properties format


    1  Simple text format
       1.1  Definition of a reusable path
          1.1.1  Example
       1.2  Definition of an environment variable
          1.2.1  Example
       1.3  Definition of array properrties
          1.3.1  Example
       1.4  Example
    2  XML format
       2.1  Ifdef
          2.1.1  Example
       2.2  Path element
          2.2.1  Example
       2.3  Env element
          2.3.1  Example
       2.4  Setenv element
          2.4.1  Example
       2.5  Property element
          2.5.1  Example
       2.6  Array properties
          2.6.1  Examples
       2.7  Import element
          2.7.1  Example
       2.8  Echo element
          2.8.1  Example
       2.9  Grammar
    3  See also

There are two possible formats to set the configuration properties:
  • A simple text format (file with the extension ".properties")
  • AN XML format which allows more configuration

Simple text format

The format of the file uses key / value pairs, the value being separated from the associated key by a "=".

Definition of a reusable path

It is possible to specify a reusable part of a path with the following expression for the key: path.<expression>. The path can be reused in the properties file by using the following expression: ${path.<expression>}

Example

      path.myPath=tutu/toto
      graphics=DefGraphics.xml
      pictures=DefPictures.xml
      ui=LookAndFeel.xml
      lf=windows
      serverInputPort=8080
      serverOutputPort=8081
      serverInputSize=500
      serverOutputSize=100
      maximumQueueSize=30
      server.autoVisible=false
      extensions=${path.myPath}/MyExtension.jar
Here the extensions property will have the value tutu/toto/MyExtension.jar

Definition of an environment variable

It is possible to specify the value of a system environment variable with the following expression for the key: env.<expression>. The value of the environment variable can be reused in the properties file by using the following expression: ${env.<expression>}

Example

      env.myenv=MY_ENV_VAR
      graphics=DefGraphics.xml
      pictures=DefPictures.xml
      ui=LookAndFeel.xml
      lf=windows
      serverInputPort=8080
      serverOutputPort=8081
      serverInputSize=500
      serverOutputSize=100
      maximumQueueSize=30
      server.autoVisible=false
      extensions=${env.myenv}/MyExtension.jar
Here the MY_ENV_VAR environment variable has the value "tutu/toto", the extensions property will have the value tutu/toto/MyExtension.jar

Definition of array properrties

To specify an array of properties, you have to separate each value of the array by a ";" (semicolon).

Example

      extensions=extension1.jar;extension2.jar

Example

      graphics=DefGraphics.xml
      pictures=DefPictures.xml
      ui=LookAndFeel.xml
      lf=windows
      serverInputPort=8080
      serverOutputPort=8081
      serverInputSize=500
      serverOutputSize=100
      maximumQueueSize=30
      logServerArea=false
      server.autoVisible=false
      server.computeLayerSize=true
      server.background=255,255,255

XML format

The XML format allows much more configuration than the properties format. The elements that can be used in the foramt are:
  • " define": (must be at the beginning of the XML file): allows to define expressions as in C
  • " path": a more simple way to define a reusable path
  • " env": a more simple way to define the value of a system environment variable
  • " setenv": to set the value of an environment variable if the properties file uses an "env" element but the associated system environment variable does not exist
  • " property": a key / value pair for a property
  • " array properties": definition of properties which are arrays of elements
  • " import": to import another XML properties configuration file
  • " echo": to echo a value in the console

Ifdef

If is possible to use a "ifdef" and/or "ifndef" attribute for any element in the properties file:
  • The element will be evaluated if the "ifdef" value is defined
  • The element will be evaluated if the "ifndef" value is not defined
It is possible to define values used in these expressions by using the "define" element.

Example

      <define key="def2" />
      <import path="propertiesChild1.xml" />
      <import ifdef="def1" path="child/propertiesChild2.xml" />
      <import ifdef="def2" path="child/propertiesChild3.xml" />
      <property key="lf" value="metal" />
      <property ifdef="def1" key="supplement" value="3" />
      <property ifdef="def2" key="supplement" value="5" />

Path element

Allows to define a reusable path. For example:

Example

      <properties>
         <path key="parent" value=".." />
         <property key="graphics" value="${parent}/DefGraphics.xml" />
      ...
      </properties>
The "graphics" property will have the value: ../DefGraphics.xml

Env element

Allows to get the value of a system environment variable. For example:

Example

      <properties>
         <env key="graphics" value="ENV_GRAPHICS"/>
         <property key="graphics" value="${env.graphics}" />
      ...
      </properties>
If the system environment variable ENV_GRAPHICS has the value "myPath", The "graphics" property will have the value: myPath/DefGraphics.xml

Setenv element

Allows to set the value of an environment variable if the properties file uses an "env" element but the associated system environment variable does not exist.

Example

      <properties>
         <setenv key="ENV_GRAPHICS" value="myPath2"/>
         <env key="graphics" value="ENV_GRAPHICS"/>
         <property key="graphics" value="${env.graphics}" />
      ...
      </properties>
The "graphics" property will have the value: myPath2/DefGraphics.xml, regardless of the value of the ENV_GRAPHICS system environment variable, and even if this environment variable is undefined.

Property element

Allows to set a key / value pair for a configuration property. Note that various specific properties types are supported:
  • boolean properties: the values "true" and "false" (in lower case characters) are supported
  • file properties: the path of the file can be an absolute path (for example C://directory/myFile.xml) or relative to the properties file (for example myFile.xml)
  • color properties: the different components of the color should be separated by ";" (semicolon) or "," (colon). For example: 250;250;250

Example

      <properties>
         <property key="graphics" value="defGraphics.xml" />
      ...
      </properties>

Array properties

Properties which are arrays can be defined in two ways:
  • By separating each value of the array by a ";" (semicolon)
  • By using an "arrayProperty" element rather than a "property" element

Examples

      <properties>
         <property key="extensions" value="extension1.jar;extension2.jar" />
      ...
      </properties>
is equivalent to:
      <properties>
         <arrayProperty key="extensions">
            <element key="extension1.jar" >
            <element key="extension2.jar" >
         </arrayProperty>
      ...
      </properties>

Import element

Allows to import another XML configuration properties file. Note that:
  • Imports are recursive, so it is perfectly possible to import another properties file in an imported properties file
  • The result is the same as if the imported file properties were defined before the file which imports it

Example

      <properties>
        <import path="propertiesChild1.xml" />
        <property key="lf" value="metal" />
      </properties>

Echo element

Allows to echo a message on the console. The message can contain values of properties defined before the echo element by the following pattern: ${property key}.

Example

      <path key="parent" value=".." />
      <property key="graphics" value="${path.parent}/DefGraphics.xml" />
      <echo message="graphics is ${graphics} and path is ${parent}" />

Grammar

See the Properties configuration Schema

See also


Categories: client | conf | server | user

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