Just a second...

XML configuration

Configuring a Diffusion™ server using XML property files

XML Property files

A Diffusion server is configured using a set of XML property files typically loaded from the etc folder. In a new Diffusion installation example versions of these files are provided which can be edited as required.

XML is used rather than standard property files due to the hierarchic nature and the ability to support repeating groups.

XSD files are issued that define the content of the XML property files and this section summarizes the XSD content.

Configuration path loading

You can pass a parameter to Diffusion upon startup so that files are not automatically loaded from the etc folder but loaded from a different folder. This folder does not have to contain the complete set of XML files, but the file is loaded from the specified folder first, if it exists. If it does not, Diffusion loads the configuration file from the etc folder. When Diffusion starts, it logs where each configuration file has been loaded from.

XML Value types

When XML values are loaded, the schema is checked so that we know that it is valid, but to aid configuration, there are some extra data types. When values are loaded, they are trimmed of leading and trailing white space.

Table 1. XML Value types
Data type Meaning
push:boolean true or false
push:string String value
push:int A number between -2,147,483,648 and 2,147,483,647
push:long A number between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807
push:double An 8 byte IEEE 754 floating point number: from +/- 2^-1074 to +/- (2-(2^-52))·2^1023
push:port A positive number but less than 65535
push:millis A string that represents the number of milliseconds. Append the mnemonic for the time unit. The mnemonic can be either upper or lower case.
s
Seconds
m
Minutes
h
Hours
d
Days

360000, 360s, 6m all represent 6 minutes

push:bytes A string that represents the number of bytes. Append the mnemonic size unit. The mnemonic can be either upper or lower case.
k
Kilobytes
m
Megabytes
g
Gigabytes

6291456, 6144k, 6m, all represent 6 Megabytes

push:log-level A log level can be ERROR, WARN, INFO, DEBUG, or TRACE.
push:percent A value that represents a percentage, this can have the trailing percent sign (%)
push:positiveNonZeroInt A number between 1 and 2,147,483,647
push:positiveInt A number between 0 and 2,147,483,647
push:positiveNonZeroLong A number between 1 and 9,223,372,036,854,775,807
push:positiveLong A number between 0 and 9,223,372,036,854,775,807
<element> This notation is used to indicate a complex element type. It can also be List<element> to indicate a repeating property group.

Environmental values

When defining custom configurations, you can define environmental variables that can be reused in all XML property files. These variables can be defined in the etc/Env.xml property file to be used in all other property files. Suppose, for example, the etc/Env.xml file defines a server-name variable, with value d-unit as follows:

<env> 
	<property name="server-name">d-unit</property>
</env> 

The server-name variable can be used in all other property files, where the value d-unit is appropriate, either as a value for an attribute, as in

<server name={server-name}>
...
</server> 

or as a name for an element as in:

<server>{server-name}</server> 

As a side remark, it is worth noting that names can be combined to provide malleable environmental variables. Suppose for instance Env.xml contains the following entries:

<env> 
	<property name="server-name">myServer</property> 
	<property name ="server-version">V2.0</property>
</env> 

Then server-name and server-version can be combined, for instance within the same etc/Env.xml, as

<property name="server-and-version">{server-name}-{server-version}</property>
and used in all other configuration files.