...
When the include
processing instruction is used, the contents of the file specified are read and inserted into the configuration tree at the location where the include tag was specified.
Code Block |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:com.cohga.server.config#1.0"...
<?include client_main.xml?>
</config>
|
the client_main.xml
file could contain
Code Block |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">
<client:config id="main">
<default>true</default>
<debug>false</debug>
<theme>grey</theme>
...
</client:config>
</config>
|
...
The set
instruction can supplement the include
instruction by providing support for variable substitution within the configuration file.
A variation on the previous example can be used when only the hostname needs to change between the development and production servers, so this time config.xml could contain
Code Block |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:com.cohga.server.config#1.0"...
<jdbc:dataSource id="datasource.main">
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url><![CDATA[jdbc:oracle:thin:@${HOSTNAME}:1521:GIS]]></url>
<username>reader</username>
<password>0hn0w3rdun</password>
<pool:pool>
<maxActive>15</maxActive>
<minIdle>2</minIdle>
<maxIdle>2</maxIdle>
<testOnBorrow>true</testOnBorrow>
<timeBetweenEvictionRunsMillis>60000</timeBetweenEvictionRunsMillis>
<minEvictableIdleTimeMillis>1200000</minEvictableIdleTimeMillis>
<whenExhaustedAction>grow</whenExhaustedAction>
</pool:pool>
</jdbc:dataSource>
</config>
|
Then the datasource.xml
file on the development server could contain
Code Block |
---|
|
<?set HOSTNAME=development.example.com?>
|
and the datasource.xml
file on the production server could contain
Code Block |
---|
|
<?set HOSTNAME=production.example.com?>
|
...