When processing the configuration file, Weave make available provides a couple of processing instructions that may help to make your life a little easier, they . They are include
and set
. These instructions provide a means to alter the configuration items before they are processed.
...
Code Block |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:com.cohga.server.config#1.0"...
<?include client_main.xml?>
</config>
|
...
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>
|
...
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>
|
...
Code Block |
---|
|
<?set HOSTNAME=development.example.com?>
|
...
Code Block |
---|
|
<?set HOSTNAME=production.example.com?>
|
...
Of course set
can also be used to locate commonly referenced items in a single location at the start of the config.xml file to allow them to be easily changed later. For example passwords that are updated every month or defaults for functions such as connection timeouts.The
Externally defined values
In addition to the set processing instruction, the value for a substitution variable can also come from system properties , or from a property as defined during the startup of the Java Virtual Machine , not just values set using the set
processing instruction(JVM option). ${property_name} notation can then be used to substitute the values in place.