commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csanders <csand...@hoovers.com>
Subject Re: First post, ExtendedProperties question
Date Wed, 14 May 2008 19:17:36 GMT
I'm having a little trouble getting the interpolation to work, I have a 
properties file with contents  similar to:

---
file.resource.loader.path = ${VELOCITY_TEMPLATE_HOME}
---

Where VELOCITY_TEMPLATE_HOME is an environmental variable that I need to 
get expanded , how would I do this ?

Thanks,
Charlie



Emmanuel Bourg wrote:
> csanders a écrit :
>
>> We have a project that uses Velocity, which uses ExtendedProperties, 
>> which we want to extend to interpolate environmental variables and 
>> system properties.
>>
>> Does anyone have any objection / suggestion for this ?  Is we write 
>> the patch is this something that could be included ?
>
> An alternative is to build a Configuration with Commons Configuration 
> that performs the interpolation you want, and then turn it into an 
> ExtendedProperties.
>
> The code would look like this:
>
> CompositeConfiguration config = new CompositeConfiguration();
> config.addConfiguration(new SystemConfiguration());
> config.addConfiguration(new EnvironmentConfiguration());
> config.addConfiguration(new PropertiesConfiguration("conf.properties"));
>
> ExtendedProperties props = 
> ConfigurationConverter.getExtendedProperties(config);
>
>
> Emmanuel Bourg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message