commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36397] - [configuration][PATCH] conditional directives in property files
Date Tue, 30 Aug 2005 04:58:30 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36397>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36397





------- Additional Comments From bcalmac@gmail.com  2005-08-30 06:58 -------
After I gave it a little more thought, using recursive property references is
even more restrictive, because you must define ALL properties on ALL branches so
that for instance you cannot skip 'jta.UserTransaction' if you go on the JDBC
branch.

All right, I'll restate my case, because I incline to the directives again.

There is one user level property file "custom.properties" that can be read,
saved, reloaded, aso. It contains high-level properties that require customization:

db=postgres
user=foo
password=bar

On the other hand, there is a property TEMPLATE file "default.template" which
used conditional directives and is integrated with commons-configuration by
means of reader:

CompositeConfiguration config    = new CompositeConfiguration();
FileConfiguration customConfig   = new FileConfiguration("custom.properties");
FileConfiguration defaultConfig  = new FileConfiguration();
PropertyTemplate defaultTemplate = new PropertyTemplate("default.template");

defaultTemplate.addConfiguration(customConfig); // needs it to evaluate the
directives
defaultConfig.load(defaultTemplate.getReader()); // the reader implements the
directives, defaultConfig "sees" a regular property stream.

config.addConfiguration(customConfig);
config.addConfiguration(defaultConfig);


The thing here is that "default.template" is never seen by the user, it's only
changed at design time and is stored together with the classes so that you
wouldn't need to save or reload it. It's main purpose is to hide from the user
Java internal details like JDBC drivers, hibernate properties, aso.

I need to implement a similar scheme in the ant build (for generating deployment
descriptors), so having the PropertyTemplate as a stream makes it easier to
integrate with the "property" task in ant.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message