On May 22, 2012, at 4:03 PM, Vincent Massol wrote:

> 
> On May 22, 2012, at 3:51 PM, Sergiu Dumitriu wrote:
> 
>> On 05/22/2012 08:59 AM, Vincent Massol wrote:
>>> 
>>> On May 22, 2012, at 2:49 PM, Vincent Massol wrote:
>>> 
>>>> Hi devs,
>>>> 
>>>> I need to be able to configuration the location of the HSQLDB database/ 
>>>> directory in our installer when executing on windows7 (because on windows7 
>>>> you cannot write to the ProgramFiles directory).
>>>> 
>>>> I'm proposing to add variable substitution so that we can configure 
>>>> connectio.url for HSQLDB to point to the environment.permanentDirectory 
>>>> location.
>>>> 
>>>> We would have:
>>>> <property 
>>>> name="connection.url">jdbc:hsqldb:file:${environment.permanentDirectory)/database/xwiki_db;shutdown=true</property>
>>>> 
>>>> Technical details:
>>>> * I'll modify DBCPConnectionProvider. More specifically this part:
>>>> 
>>>>           String jdbcUrl = System.getProperty(Environment.URL);
>>>>           if (jdbcUrl == null) {
>>>>               jdbcUrl = props.getProperty(Environment.URL);
>>>>           }
>>>>           dbcpProperties.put("url", jdbcUrl);
>>>> 
>>>> * And look for ${…} , extract the variable name and use the 
>>>> XWikiPropertiesConfigurationSource to get the value for that variable 
>>>> name, as a String.
>>>> 
>>>> WDYT?
>>> 
>>> Note that another solution to this is to move all Hibernate configuration 
>>> data to xwiki.properties… Since we allow property referencing in our 
>>> xwiki.properties file it would solve my need too.
>>> 
>>> It's a lot more more work though (unless we support both, looking first in 
>>> xwiki.properties for hibernate properties and fallbacking to older 
>>> hibernate.cfg.xml if not found, in which case it's a little less work but 
>>> still substantial). I'm still unsure I'm prepared to work on this now… :)
>>> 
>>> WDYT?
>> 
>> I don't like this that much, since there's a lot more that can be configured 
>> in the xml file, and the .properties is already getting very big.
> 
> If we really think that the size of the file is important (which I'm not sure 
> about) then we have the option of having as many configuration files as 
> possible by using a CompositeConfiguration.

s/as possible/as we want/

See 
http://commons.apache.org/configuration/userguide/overview.html#Configuration_Sources
 for details.

(We could even make this configurable by the user if we want by using a 
ConfigurationFactory config.xml file)

Thanks
-Vincent

> The important point here is not so much to have hibernate config in the same 
> file but rather to have it under our ConfigurationSource mechanism.
> 
> Thanks
> -Vincent
> 

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to