[xwiki-devs] [discussion] configuration files loading
Thomas Mortagne
thomas.mortagne at xwiki.com
Thu Jul 3 13:23:33 CEST 2008
On Thu, Jul 3, 2008 at 2:11 AM, Artem Melentyev <amelentev at gmail.com> wrote:
> Hi, devs.
>
> I would like to discuss about
> How we should load external configuration files (such as
> hibernate.cfg.xml, repository.xml and others)
>
> AFAIK, we agreed the following algorithm to load external config files:
> 1. filesystem
> 2. ServletContext
> 3. classpath.
>
> But we still lack some implementation for it.
> So we duplicate code in store, cache and others modules.
>
> How can it be implemented right?
> (Spring fwk for example have nice Resource classes:
> http://static.springframework.org/spring/docs/2.5.x/reference/resources.html
> and Resource classes injected simply by string path.)
>
> I see 2 ways:
>
> 1. Add InputStream getResourceAsStream(String) method to our Utils class.
> +: simple
> but I'm not sure it is right in V2 arch.
>
> 2. Implement Chained, FileSystem and ClassPath application contexts and
> provide one chained application context which tries to load resource
> from filesystem, servlet and classpath contexts in this order.
> -: I think it is overhead for now.
>
> I'm +1 for 1. now.
I like 2, especially since cache components would benefit of that.
1. would be already a good thing for core.
>
> Another question is
> How we should configure config file path.
>
> I think we should provide default path in component class (String
> somepath = "some/path") and we can override it in components.xml
> So no more "xwiki.store.hibernate.path" and others params in xwiki.cfg.
> Use components.xml instead. xwiki.cfg should contain more useful and
> global params.
>
> WDYT?
>
> --
> Artem Melentyev
> _______________________________________________
> devs mailing list
> devs at xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs
>
--
Thomas Mortagne
More information about the devs
mailing list