We are using Turbine and the framework uses commons-configuration. The
how-to is documented here:
http://jakarta.apache.org/turbine/turbine/turbine-2.3.2/howto/configuration-howto.html
We followed this example and turbine provides a configuration instance
for us.
Here is our xml for configuring turbine/commons-config:
---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<configuration>
<jndi prefix="java:comp/env"/>
<properties fileName="WEB-INF/conf/TurbineResources.properties"/>
<system/>
</configuration>
---
This uses ( in order from lowest to highest priority ) system
properties, properties from the TurbineResources.properties file, then
jndi settings. If the property is in the file and in jndi, the jndi
value is used.
We've also done a similar thing as turbine in one of our own servlets.
Here is how we built up a config in a plain old servlet:
Configuration buildConfiguration() throws NamingException
{
CompositeConfiguration configuration = new
CompositeConfiguration(new JNDIConfiguration("java:comp/env"));
configuration.addConfiguration( new
ServletConfiguration(getServletConfig()) );
configuration.addConfiguration( new SystemConfiguration() );
return configuration;
}
This would use ( from lowest to highest priority ) any system settings,
then servlet config settings, then whatever is defined in jndi.
So when we deploy in tomcat we just use wars and have either all
settings for all webapps defined in conf/context.xml or we hand code
conf/Catalina/localhost/[webappname].xml files. ( we need to remove
write privs on the localhost dir above, otherwise tomcat will delete the
xml's when the war is re-deployed.) Then each tomcat is configured with
the correct settings for that installation ( like beta vs. production ).
I hope this helps a little.
Thorbjørn Ravn Andersen wrote:
Jeffrey D. Brekke skrev den 23-01-2007 03:04:
Using commons-configuration, we use property files in our war as
defaults, then any container may redefine or define any property
specific to the container we've deployed into ( like beta,test, or
production ). We've used this setup with just settings ( string,
ints, etc ) or jdbc connection pools/resources.
I am currently looking into this issue for our application, and I would
appreciate if you would share your configuration snippet.
Best regards,
--
=====================================================================
Jeffrey D. Brekke [EMAIL PROTECTED]
Wisconsin, USA [EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.bloglines.com/blog/jbrekke [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]