Variable Substitution
You can use placeholder variables in a grid-library.xml file, which are then substituted with their value as defined in a properties file or in an OS environment variable. This enables quick changes in properties in the grid-library.xml file without redeploying the Grid Library.
If the grid-library.xml file contains a property with a value contained with the $ character, such as $mydir$, it is substituted with the value in one of three places, in this order:
| • | A default properties file in your Grid Library named grid-library.properties. This can provide baseline values for your variables. |
| • | An external properties file, named with the same name as the Grid Library archive, with the extension .properties, in the Grid Library deployment directory. Values in an external properties file replace those defined in the default properties file within the Grid Library. |
| • | A defined OS environment variable. This value replaces the value defined in either properties file. |
|
Note |
If the substitution is not found in the file, the empty string, "", is substituted. |
Substitutions are allowed anywhere in a string within the content of property value elements and pathelements. Multiple substitutions per string are allowed. $ characters can be treated as literals by escaping them with another $ character. Windows paths that are specified in the [library].properties file must escape the \ character with another \.
The implicit property ds.GridLibraryRoot can be used in the grid-library.xml file. This is useful for including a driver.properties file in a Grid Library, and setting the DSDRIVER_DIR to the location of the file in the library. This can be done in a C++ or .NET Grid Library as follows:
<environment-variables>
<property >
<name>DSDRIVER_DIR</name>
<value>$ds.GridLibraryRoot$</value>
</property>
</environment-variables>
The following would be done in a Java Grid Library:
<jar-path>
<pathelement>$ds.GridLibraryRoot$</pathelement>
</jar-path>