First post, ExtendedProperties question

View: New views
13 Messages — Rating Filter:   Alert me  

First post, ExtendedProperties question

by csanders :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Sorry if this has been discussed already, I could not find a 'search'
button on the list archives.

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 ?

Thanks!
Charlei

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


Re: First post, ExtendedProperties question

by Rahul Akolkar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you are looking for Apache Velocity lists, please take a look at this page:

  http://velocity.apache.org/contact.html

You probably want the user list.

One example of searchable archives (there are others too):

  http://velocity.markmail.org/

-Rahul


On 5/13/08, csanders <csanders@...> wrote:

> Hi!
>
>  Sorry if this has been discussed already, I could not find a 'search'
> button on the list archives.
>
>  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 ?
>
>  Thanks!
>  Charlei
>

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


Re: First post, ExtendedProperties question

by csanders :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry no, I'm looking to patch ExtendedProperties in the collections
project, is this the right list ?

Thanks,
Charlei

Rahul Akolkar wrote:

> If you are looking for Apache Velocity lists, please take a look at this page:
>
>   http://velocity.apache.org/contact.html
>
> You probably want the user list.
>
> One example of searchable archives (there are others too):
>
>   http://velocity.markmail.org/
>
> -Rahul
>
>
> On 5/13/08, csanders <csanders@...> wrote:
>  
>> Hi!
>>
>>  Sorry if this has been discussed already, I could not find a 'search'
>> button on the list archives.
>>
>>  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 ?
>>
>>  Thanks!
>>  Charlei
>>
>>    
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>
>  


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


Re: First post, ExtendedProperties question

by Rahul Akolkar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 5/13/08, csanders <csanders@...> wrote:
> Sorry no, I'm looking to patch ExtendedProperties in the collections
> project, is this the right list ?
>
<snip/>

Yes, this is a shared list for all of Commons, please prefix email
subject with [$component] ( in this case, [collections] ).

Though I'd start with the user list.

-Rahul



>  Thanks,
>  Charlei
>
>  Rahul Akolkar wrote:
>
> >
> > If you are looking for Apache Velocity lists, please take a look at this
> page:
> >
> >  http://velocity.apache.org/contact.html
> >
> > You probably want the user list.
> >
> > One example of searchable archives (there are others too):
> >
> >  http://velocity.markmail.org/
> >
> > -Rahul
> >
> >
> > On 5/13/08, csanders <csanders@...> wrote:
> >
> >
> > > Hi!
> > >
> > >  Sorry if this has been discussed already, I could not find a 'search'
> > > button on the list archives.
> > >
> > >  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 ?
> > >
> > >  Thanks!
> > >  Charlei
> > >
> > >

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


Re: First post, ExtendedProperties question

by Henri Yandell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One thing to look for is whether Commons Configuration contains a
version of ExtendedProperties with this feature. If I understand
things correctly, the Collections class doesn't seek to be too
creative because Configuration is adding these types of features.

It might be that the better solution is to modify Velocity to use
Commons Configuration.

Hen

On Tue, May 13, 2008 at 12:27 PM, csanders <csanders@...> wrote:

> Hi!
>
>  Sorry if this has been discussed already, I could not find a 'search'
> button on the list archives.
>
>  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 ?
>
>  Thanks!
>  Charlei
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@...
>  For additional commands, e-mail: dev-help@...
>
>

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


Re: First post, ExtendedProperties question

by ebourg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Henri Yandell a écrit :
> One thing to look for is whether Commons Configuration contains a
> version of ExtendedProperties with this feature. If I understand
> things correctly, the Collections class doesn't seek to be too
> creative because Configuration is adding these types of features.
>
> It might be that the better solution is to modify Velocity to use
> Commons Configuration.
>
> Hen

Commons Configuration is quite heavy weight compared to the simple
ExtendedProperties, that may explain why Velocity didn't replace it.

I'll contact the Velocity team to see if they might be interested in a
patch to support Commons Configuration.

Emmanuel Bourg



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


Re: First post, ExtendedProperties question

by ebourg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: dev-help@...


Re: First post, ExtendedProperties question

by csanders :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
> For additional commands, e-mail: dev-help@...
>


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


Re: First post, ExtendedProperties question

by ebourg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

csanders a écrit :
> 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 ?


Did you try the composite configuration example I gave in my previous
message ?

Emmanuel Bourg



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


Re: First post, ExtendedProperties question

by csanders :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yep, here is the code:

            CompositeConfiguration config = new CompositeConfiguration();
            config.addConfiguration(new SystemConfiguration());
            config.addConfiguration(new EnvironmentConfiguration());
            config.addConfiguration(new
PropertiesConfiguration(Config.velocity_properties_file));
           
           
System.out.println(config.getProperty("file.resource.loader.path") );
            System.out.println(config.getProperty("TEMPLATE_HOME") );

            ExtendedProperties configuration =
ConfigurationConverter.getExtendedProperties(config);

TEMPLATE_HOME is the env var, and the getProperty() does expand it, but
the file.resource.loader.path just returns ${TEMPLATE_HOME} .

Thanks,
Charlie

Emmanuel Bourg wrote:

> csanders a écrit :
>> 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 ?
>
>
> Did you try the composite configuration example I gave in my previous
> message ?
>
> Emmanuel Bourg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>


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


Re: First post, ExtendedProperties question

by ebourg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

csanders a écrit :

> Yep, here is the code:
>
>            CompositeConfiguration config = new CompositeConfiguration();
>            config.addConfiguration(new SystemConfiguration());
>            config.addConfiguration(new EnvironmentConfiguration());
>            config.addConfiguration(new
> PropertiesConfiguration(Config.velocity_properties_file));
>                      
> System.out.println(config.getProperty("file.resource.loader.path") );
>            System.out.println(config.getProperty("TEMPLATE_HOME") );
>
>            ExtendedProperties configuration =
> ConfigurationConverter.getExtendedProperties(config);
>
> TEMPLATE_HOME is the env var, and the getProperty() does expand it, but
> the file.resource.loader.path just returns ${TEMPLATE_HOME} .

config.getProperty() doesn't perform the interpolation, it returns the
raw property. You have to use config.getString() to retrieve the
interpolated value.

Emmanuel Bourg


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


Re: First post, ExtendedProperties question

by csanders :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ahh, and Velocity uses getProperty()  .

Thanks for all your help on this Emmanuel, and your posts to the
Velocity mailing list :).  You're a gentleman and a scholar!

Charlie

Emmanuel Bourg wrote:

> csanders a écrit :
>> Yep, here is the code:
>>
>>            CompositeConfiguration config = new CompositeConfiguration();
>>            config.addConfiguration(new SystemConfiguration());
>>            config.addConfiguration(new EnvironmentConfiguration());
>>            config.addConfiguration(new
>> PropertiesConfiguration(Config.velocity_properties_file));
>>                      
>> System.out.println(config.getProperty("file.resource.loader.path") );
>>            System.out.println(config.getProperty("TEMPLATE_HOME") );
>>
>>            ExtendedProperties configuration =
>> ConfigurationConverter.getExtendedProperties(config);
>>
>> TEMPLATE_HOME is the env var, and the getProperty() does expand it,
>> but the file.resource.loader.path just returns ${TEMPLATE_HOME} .
>
> config.getProperty() doesn't perform the interpolation, it returns the
> raw property. You have to use config.getString() to retrieve the
> interpolated value.
>
> Emmanuel Bourg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>


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


Re: First post, ExtendedProperties question

by ebourg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

csanders a écrit :
> Ahh, and Velocity uses getProperty()  .

I'm not sure about this, I looked quickly into the Velocity code, it
seems it mostly uses getString() on the ExtendedProperties, so the
interpolation should work.

Emmanuel Bourg

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