Another idea (not sure yet how to implement it correctly):
* Put the HSQLDB database/ directory in the xwiki config dir (if not specified through
system property or JNDI context then the xwiki config dir is the current dir).
IMO it makes sense since db is data and it should be easy to upgrade and keep your data
too.
The pb is in succeeding in defining where to put the hsqldb files but there are ways I
think (I can think of some but need more thinking). One solution though is to fold the
hibernate config data into the xwiki properties files and configure hibernate
programmatically instead of through its XML format. Another option is to combine both: use
the Hibernate properties file format and programmatically set the database location if
some special token like ${xwiki.config.dir} is used.
See
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configur…
Side note: these 2 solutions would solve the merging issue with XML file too.
WDYT?
Thanks
-Vincent
On Mar 19, 2010, at 6:08 PM, Vincent Massol wrote:
Hi devs,
I've been wanting to make it easy to upgrade XWiki from one version to another for
some time (I'm not talking about XAR upgrade here, that's the extension manager).
I'm talking about XWiki configuration files.
Here are the use cases I'd like to solve:
UC1: Easy install: no need to explode the XAR to install XWiki. See also the comment
about xwiki on
http://java.dzone.com/articles/file-system-storage-and
UC2: Easy upgrade: no need to take care about saving the configuration so that it's
not overwritten by an upgrade
UC3: Should be possible to have multiple installs on the same machine and running at the
same time
UC4: Should be possible to control the location of the configuration files for our
automated functional tests (so that we control the configuration used)
The configuration files I'm talking about are:
* xwiki.cfg
* hibernate.cfg.xml
* xwiki.properties
Proposed Solution:
===============
1) Look for a system property (e.g. xwiki.config.dir) defining a directory location and
if defined look for the files in it using File IO (I know it's not JEE kosher but
it's acceptable IMO). Could be relative or absolute.
2) If not found, look for a JNDI property that gives the location of the config
directory
3) If not found, look for config files in [user.home]/.xwiki
4) If not found, emit an error explaining how to configure xwiki
1) solves UC3 and UC4
2) solves UC3
3) solves UC1 and UC2
Note
====
I'm not suggesting any backward compatibility here since it's a new way of
configuring XWiki. It means upgraders will need to read the release notes/doc to
understand how to configure XWiki.
If really needed, we could devise a backward compat strategy, but I'm not sure we
absolutely need that.
WDYT?
Thanks
-Vincent