[discussion] configuration files loading

2 Messages Forum Options Options
Permalink
Artem Melentyev-3
[discussion] configuration files loading
Reply Threaded More
Print post
Permalink
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.

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@...
http://lists.xwiki.org/mailman/listinfo/devs
Thomas Mortagne
Re: [discussion] configuration files loading
Reply Threaded More
Print post
Permalink
On Thu, Jul 3, 2008 at 2:11 AM, Artem Melentyev <amelentev@...> 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@...
> http://lists.xwiki.org/mailman/listinfo/devs
>



--
Thomas Mortagne
_______________________________________________
devs mailing list
devs@...
http://lists.xwiki.org/mailman/listinfo/devs