Hi Caleb, On Oct 26, 2010, at 4:25 PM, Caleb James DeLisle wrote:
I was wondering how the current method of configuration came into existence. I googled against the lists and didn't see anything particularly enlightening.
http://markmail.org/message/666kwgzfqrfcokxi Thanks -Vincent PS: I'm personally very fond of our current design for the configuration module (and I consider it one of the best design I've done ;)). It's simple and elegant and more importantly allows to do all sort of things in the future without hacks. PPS: I think we have a lot of other modules that would require redesign before it becomes interesting to tackle this one ;)
IMO the promise of component management is "you ask for it and it's there". The best way I can imagine to ask for a configuration parameter would be:
@Requirement("my-module.param") private String configParam = "default value";
If no parameter was defined then "default value" would be the value.
Since I imagine making the component manager inject a String and know that it's a configuration parameter would be horrible, I would have chosen a workaround by creating an interface and class which is shared among all consumers of configuration. Something like:
public interface ConfigurationString { java.lang.String get(); ConfigurationString default(java.lang.String); }
Then to get the configuration parameter you need:
@Requirement("my-module.param") private ConfigurationString myParam = ConfigurationString.default("default value");
Since the benefits of writing 2 lines to get a configuration parameter vs. writing 2 classes seem obvious, I assume that this idea was reviewed and cast aside and I was wondering why it was decided that something like this was the wrong approach. If anyone could shed some light on this, I'd appreciate it.
Thanks
Caleb
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs