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