Page tree
Skip to end of metadata
Go to start of metadata

Extended Properties

For configuration of openBIS servers Java Properties files are used. Usually they are just files with key-value pairs of the form

<key> = value

For more details see http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load%28java.io.InputStream%29

Two extensions allow to reuse properties in a properties file to avoid duplication of concrete property values.

Reusing Properties in Values

If in a property value with a term like ${<key>} appears it will be replaced by the value of the property with key <key>.

Example: The following extended properties file

A = 12345678
B = ${A}90
C = ${B} plus more

is equivalent to the following normal properties file

A = 12345678
B = 1234567890
C = 1234567890 plus more

It is also possible to define a default value which used if the referred property couldn't be found. Syntax:

${<key>:<default value>}

Example: The following extended properties file

greetings = hello ${user:world}

is equivalent to the following properties file:

greetings = hello world

If the line user = albert is added it would be equivalent to

greetings = hello albert

 

Inherit Properties

A property inherits the value from another property if there is a third property (called inheritance definition property) with a key which is the prefix of the key of the first property. This prefix will be replaced by the value of the inheritance definition property to get the key of the second property from whom the first inherits the value. A key of an inheritance definition property has to end with a dot '.'. Inheritance definition properties will only apply if no property for a specified key could be found.

Example: The following extended properties file

default-address.town = Basel
default-address.zip-code = 4058
default-address.street = Mattenstrasse 26
bsse-address. = default-address.
fmi-address. = default-address.
fmi-address.street = Maulbeerstrasse 66

is equivalent to the following normal properties file

default-address.town = Basel
default-address.zip-code = 4058
default-address.street = Mattenstrasse 26
bsse-address. = default-address.
bsse-address.town = Basel
bsse-address.zip-code = 4058
bsse-address.street = Mattenstrasse 26
fmi-address. = default-address.
fmi-address.town = Basel
fmi-address.zip-code = 4058
fmi-address.street = Maulbeerstrasse 66

This example shows not only inheritance (town, zip-code, and street) but also overriding: fmi-address.street overrides default-address.street.

  • No labels