I'm all for the DI for the Configuration management, but in order to minimize the impact to the various different interfaces, I think we probably want to have the idea that each method is aware of its context (user, user-config, ...). Not sure how we would do this with simple getters/setters/etc.<div>
<br></div><div>All I'm thinking at the moment, is somehow annotate those methods that start a "request" (they will need interface changes), and then allowing any other method to query the current state of the request by calling a "getMeTheCurrentContext". What I want to avoid is having to rewrite most of the method signatures across JSword to be passing down the current config/user/etc.</div>
<div><br></div><div>Any ideas welcome...</div><div>Chris</div><br><div class="gmail_quote">On 19 July 2010 09:17, Tonny Kohar <span dir="ltr"><<a href="mailto:tonny.kohar@gmail.com">tonny.kohar@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<div class="im"><br>
On Sat, Jul 17, 2010 at 3:11 AM, Chris Burrell <<a href="mailto:chris@burrell.me.uk">chris@burrell.me.uk</a>> wrote:<br>
> Hi DM<br>
> Well my suggestion would be to adopt a IOC/dependency injection. Perhaps a<br>
> "config provider" object can be inserted into those places that need access<br>
> to those statics. We can somehow insert a default provider with default<br>
> config if no user config provider is found.<br>
> The JSword code would ask the config provider for the various settings.<br>
> JSword could also alter the config provider on any changes.<br>
> If the provider is defined as an interface, it gives the people the option<br>
> to write their own Configuration Provider mechanism, and inject/set it at<br>
> runtime. Some might want to carry state and persist it elsewhere, some might<br>
> want it geared towards concurrency usage, etc.<br>
<br>
</div>+1<br>
<br>
Yes using concept dependency injection is good. However, if possible<br>
please don't use like annotation or non-standard/complex setup. Just<br>
use simple java constructs like service provider with default/abstract<br>
implementation which can be easily inherited/overriden.<br>
<br>
Cheers<br>
Tonny Kohar<br>
<font color="#888888">--<br>
Alkitab Bible Study<br>
<a href="http://www.kiyut.com" target="_blank">http://www.kiyut.com</a><br>
</font></blockquote></div><br>