geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Kirby" <ted.ki...@gmail.com>
Subject Proposal for property substitution in config.xml
Date Thu, 18 Jan 2007 23:15:56 GMT
The idea is allow an identical configuration on a set of machines, yet allow
customization through property substitution with command line/system
property override (i.e. java -Dxxx.yyy.zzz=ABC).



For example, allow the following in config.xml:


<module name="...">
<gbean name="TomcatConnector">
<attribute name="port">${tomcat.port}</attribute>
<attribute name="host">${tomcat.listen.ip}</attribute>
</gbean>
</module>



These variables are set on server startup via:
java –Dtomcat.port=9090 –Dtomcat.listen.ip=10.0.0.7



JBoss has this capability, and I'd like to bring it to Geronimo.



I have opened JIRA 2735 (https://issues.apache.org/jira/browse/GERONIMO-2735)
for the feature, but I wanted to solicit community input and feedback on
features and implementation.



I think this feature could be pretty easily implemented in GBeanOverride.  The
constructor reads the values from config.xml.  The values could be parsed
for ${…} constructs.  If a known substitution variable is found inside, the
attribute and its unsubstituted value could be saved in an
unsubstitutedAttribute hashmap.  The attribute hashmap would contain the
substituted value.  This logic can also be applied to the setAttribute
method.  The writeXML method is used to write out the config.xml.  As it is
processing the attributes hashmap, if the attribute name was found in the
new unsubstitutedAttribute hashmap, write out its value instead.



Thoughts?

Mime
View raw message