Overview
For each configuration type you can provide an XML file following the required structure of the Config nodes and property elements defined by the configurable provider. The importing process can be manual (using the web or the text console) or automatic (using the ConfigTree manifest header).
To access a configuration, make sure you have the relevant configuration type exported in the Config Tree. For example, if your application is not the one exporting the type, use the cft.list command in the runtime console to see the available configurable objects.
Editing Configurations
If there is already some configuration data saved, follow the steps below:
Creating new Configurations
You can create an XML file from scratch following the structure required by the mapped functionality and import it in the runtime.
Defining Custom Property Types
The ConfigTreeConstants interface (see Java API) defines the supported ConfigTree property types. See also Supported Property Data Types topic from the System Architecture.
To define a custom property type:
<property type="int[]" value="1,2,3" key=" ExampleMode"/>
For more information on the properties refer to Components for ConfigTree Content chapter.
The syntax for all available property types is available below.
<property type=" float" value=" 234.5" key=" FLOAT"/>
<property type=" long[]" value=" 9, 223, 9, 222, 9, 221" key=" ARR LONG"/>
<property type=" int[]" value=" 1, 10, 100" key=" ARR INT"/>
<property type=" float[]" value=" 234.5, 222.5, 221.4" key=" ARR FLOAT"/>
<property type=" boolean[]" value=" true, true, false" key=" ARR BOOLEAN"/>
<property type=" char" value=" A" key=" CHAR"/>
<property type=" boolean" value=" true" key=" BOOLEAN"/>
<property type=" int" value=" 2" key=" INT"/>
<property type=" char[]" value=" A, A, A" key=" ARR CHAR"/>
<property type=" short" value=" 0" key=" SHORT"/>
<property type=" string[]" value=" yes, yes" key=" ARR STRING"/>
<property type=" short[]" value=" 0, 2, 30" key=" ARR SHORT"/>
<property type=" double[]" value=" 123.4, 123.0, 122.4" key=" ARR DOUBLE"/>
<property type=" byte" value=" -128" key=" BYTE"/>
<property type=" string" value=" message" key=" STRING"/>
<property type=" double" value=" 123.4" key=" DOUBLE"/>
<property type=" byte[]" value=" 0x80, 0x81, 0x82" key=" ARR BYTE"/>
<property type=" long" value=" 0" key=" LONG"/>
Managing Several Configurations
You can modify several configurable objects at one time by using a ZIP file with XML files according to the structure defined in "System Architecture -> Import/Export Formats". Similarly to single XML files, you can export a ZIP file, modify the configuration XML files and then import it.
Check the ConfigTree Demo's config.zip file for illustration.
<config name=" DEMO1">
<property type=" byte[]" value=" 0x01, 0x02, 0x03" key=" barray"/>
<property type=" boolean" value=" true" key=" booleanKey"/>
<property type=" byte" value=" 1" key=" byteKey"/>
<property type=" double" value=" 1.0" key=" doubleKey"/>
<property type=" float" value=" 1.0" key=" floatKey"/>
<property type=" int" value=" 1" key=" intKey"/>
<property type=" long" value=" 1" key=" longKey"/>
<property type=" string" value=" text" key=" stringKey"/>
<config name=" root.child.1">
<property type=" string" value=" value11" key=" key11"/>
<config name=" root.child.1.child.1">
<property type=" string" value=" value111" key=" key111"/>
</config> </config> <config name=" root.child.2">
<property type=" string" value=" value12" key=" key12"/>
<config name=" root.child.2.child.1">
<property type=" string" value=" value121" key=" key121"/>
</config>
</config>
</config>
cft>$cn DEMO1
DEMO1:/
cft>$tree
DEMO1:/ -----------------------------------------------
DEMO1
| +--(barray = 0x01, 0x02, 0x03) {byte[]}
| +--(booleanKey = true) {boolean}
| +--(byteKey = 1) {byte}
| +--(doubleKey = 1.0) {double}
| +--(floatKey = 1.0) {float}
| +--(intKey = 1) {int}
| +--(longKey = 1) {long}
| +--(stringKey = text) {string} +--root.child.1
| +--(key11 = value11) {string}
| +--root.child.1.child.1
| +--(key111 = value111) {string}
+--root.child.2 +--(key12 = value12) {string}
+--root.child.2.child.1
+--(key121 = value121) {string} cft>$
Automatically Importing Configurations
A bundle can provide configurations in XML format within its JAR file, which to be automatically loaded on its start-up. For this purpose, a record with the header ConfigTree should be added in its manifest file with the following syntax:
ConfigTree: xml=<source_path>[; type=<type_name>][; version=<verison>], where:
If the source content has been updated, in order to be reloaded on the next bundle start-up, change the version number to a higher value.
The order of the parameters is not mandatory.
For importing more than one configuration file, a comma-separated list can be used. Example:
Bundle-ManifestVersion: 2
Bundle-SymbolicName: test.resman.ctr_2
ConfigTree: xml=/TEST-A.xml;
type=TEST-A;
version=1.0.0,
type=TEST-B;
xml=/config2_2.xml;
version=1.0.0
If the configurable type is not registered yet, the imported configurations are stored in the database and will be loaded once the relevant configurable service has been implemented and registered.