Home
Categories
Dictionary

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:

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:

Ifdef

If is possible to use a "ifdef" and/or "ifndef" attribute for any element in the properties file: 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:

Example

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

Array properties

Properties which are arrays can be defined in two ways:

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:

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


Category:server Category:client Category:conf Category:user

Copyright 2016 Dassault Aviation. All Rights Reserved. Documentation and source under the GPL v2 licence

Project Web Hosted by SourceForge.net Copyright 1999-2010 - Geeknet, Inc., All Rights Reserved About - Legal - Help