[Configuration] unary statement operator support

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Configuration] unary statement operator support

micke_
Hi,
I wonder if there are plans to support the unary operator in the
configuration files? (Given it isn't already supported, had a look at the
project website but couldn't find any information regarding it).

Would be great to have something like this supported:
hello=Hi there ${$name ? $name : user }

The reason I'm asking is because I'm having a look at potential libraries to
use in a future project, and this feature is something which is neccessary
for our configuration files.

Regards,
- Mikael
Reply | Threaded
Open this post in threaded view
|

RE: [Configuration] unary statement operator support

Jörg Schaible-2
Hi Mikael,

Mikael Andersson wrote on Wednesday, February 22, 2006 11:32 AM:

> Hi,
> I wonder if there are plans to support the unary operator in the
> configuration files? (Given it isn't already supported, had a look at
> the project website but couldn't find any information regarding it).
>
> Would be great to have something like this supported:
> hello=Hi there ${$name ? $name : user }
>
> The reason I'm asking is because I'm having a look at
> potential libraries to
> use in a future project, and this feature is something which
> is neccessary
> for our configuration files.

No, something like this is not supported. Configurations could refactor the interpolation into an Interface though, so different interpolation engines could be used (e.g. el or jexl).

Apart from this, you might solve your problem with a CompositeConfiguration:

CompositeConfiguration config = new CompositeConfiguration();
config.addConfiguration(ConfigurationConverter.getConfiguration(System.getProperties()));
config.addConfiguration(new PropertiesConfiguration("app.properties"));
config.addConfiguration(new PropertiesConfiguration(App.class.getResource("default.properties")));

Here the defaults are stores in a file available from the class loader. This file would contain

name=user

The app.properties file would contain your line:

hello=Hi there ${name}

And if you app is started with -Dname="John Doe" it would interpolate to the correct value.

- Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Configuration] unary statement operator support

micke_
Hi Joerg,
the pluggable interpolation approach would be cool.

Thanks for making me aware of the composite configuration, I also need to be
able to override a configuration file with a map of values which this seems
to be able to do.

Thanks for the quick reply,
Micke

On 22/02/06, Jörg Schaible <[hidden email]> wrote:

>
> Hi Mikael,
>
> Mikael Andersson wrote on Wednesday, February 22, 2006 11:32 AM:
>
> > Hi,
> > I wonder if there are plans to support the unary operator in the
> > configuration files? (Given it isn't already supported, had a look at
> > the project website but couldn't find any information regarding it).
> >
> > Would be great to have something like this supported:
> > hello=Hi there ${$name ? $name : user }
> >
> > The reason I'm asking is because I'm having a look at
> > potential libraries to
> > use in a future project, and this feature is something which
> > is neccessary
> > for our configuration files.
>
> No, something like this is not supported. Configurations could refactor
> the interpolation into an Interface though, so different interpolation
> engines could be used (e.g. el or jexl).
>
> Apart from this, you might solve your problem with a
> CompositeConfiguration:
>
> CompositeConfiguration config = new CompositeConfiguration();
> config.addConfiguration(ConfigurationConverter.getConfiguration(
> System.getProperties()));
> config.addConfiguration(new PropertiesConfiguration("app.properties"));
> config.addConfiguration(new PropertiesConfiguration(App.class.getResource
> ("default.properties")));
>
> Here the defaults are stores in a file available from the class loader.
> This file would contain
>
> name=user
>
> The app.properties file would contain your line:
>
> hello=Hi there ${name}
>
> And if you app is started with -Dname="John Doe" it would interpolate to
> the correct value.
>
> - Jörg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [Configuration] unary statement operator support

Oliver Heger
An enhancement of the interpolation features is indeed on the agenda.
There is a bugzilla ticket covering this issue and providing some more
details:

http://issues.apache.org/bugzilla/show_bug.cgi?id=35116

Parts of this are already implemented. For other parts we would like to
make use of new classes in Commons Lang, which are not yet released.

Oliver

Mikael Andersson wrote:

> Hi Joerg,
> the pluggable interpolation approach would be cool.
>
> Thanks for making me aware of the composite configuration, I also need to be
> able to override a configuration file with a map of values which this seems
> to be able to do.
>
> Thanks for the quick reply,
> Micke
>
> On 22/02/06, Jörg Schaible <[hidden email]> wrote:
>
>>Hi Mikael,
>>
>>Mikael Andersson wrote on Wednesday, February 22, 2006 11:32 AM:
>>
>>
>>>Hi,
>>>I wonder if there are plans to support the unary operator in the
>>>configuration files? (Given it isn't already supported, had a look at
>>>the project website but couldn't find any information regarding it).
>>>
>>>Would be great to have something like this supported:
>>>hello=Hi there ${$name ? $name : user }
>>>
>>>The reason I'm asking is because I'm having a look at
>>>potential libraries to
>>>use in a future project, and this feature is something which
>>>is neccessary
>>>for our configuration files.
>>
>>No, something like this is not supported. Configurations could refactor
>>the interpolation into an Interface though, so different interpolation
>>engines could be used (e.g. el or jexl).
>>
>>Apart from this, you might solve your problem with a
>>CompositeConfiguration:
>>
>>CompositeConfiguration config = new CompositeConfiguration();
>>config.addConfiguration(ConfigurationConverter.getConfiguration(
>>System.getProperties()));
>>config.addConfiguration(new PropertiesConfiguration("app.properties"));
>>config.addConfiguration(new PropertiesConfiguration(App.class.getResource
>>("default.properties")));
>>
>>Here the defaults are stores in a file available from the class loader.
>>This file would contain
>>
>>name=user
>>
>>The app.properties file would contain your line:
>>
>>hello=Hi there ${name}
>>
>>And if you app is started with -Dname="John Doe" it would interpolate to
>>the correct value.
>>
>>- Jörg
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [hidden email]
>>For additional commands, e-mail: [hidden email]
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Configuration] unary statement operator support

micke_
Hi
I am curious about whether there has been any work done with the
"interpolation features"?

Thanks
- Micke

On 22/02/06, Oliver Heger <[hidden email]> wrote:

>
> An enhancement of the interpolation features is indeed on the agenda.
> There is a bugzilla ticket covering this issue and providing some more
> details:
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=35116
>
> Parts of this are already implemented. For other parts we would like to
> make use of new classes in Commons Lang, which are not yet released.
>
> Oliver
>
> Mikael Andersson wrote:
> > Hi Joerg,
> > the pluggable interpolation approach would be cool.
> >
> > Thanks for making me aware of the composite configuration, I also need
> to be
> > able to override a configuration file with a map of values which this
> seems
> > to be able to do.
> >
> > Thanks for the quick reply,
> > Micke
> >
> > On 22/02/06, Jörg Schaible <[hidden email]> wrote:
> >
> >>Hi Mikael,
> >>
> >>Mikael Andersson wrote on Wednesday, February 22, 2006 11:32 AM:
> >>
> >>
> >>>Hi,
> >>>I wonder if there are plans to support the unary operator in the
> >>>configuration files? (Given it isn't already supported, had a look at
> >>>the project website but couldn't find any information regarding it).
> >>>
> >>>Would be great to have something like this supported:
> >>>hello=Hi there ${$name ? $name : user }
> >>>
> >>>The reason I'm asking is because I'm having a look at
> >>>potential libraries to
> >>>use in a future project, and this feature is something which
> >>>is neccessary
> >>>for our configuration files.
> >>
> >>No, something like this is not supported. Configurations could refactor
> >>the interpolation into an Interface though, so different interpolation
> >>engines could be used (e.g. el or jexl).
> >>
> >>Apart from this, you might solve your problem with a
> >>CompositeConfiguration:
> >>
> >>CompositeConfiguration config = new CompositeConfiguration();
> >>config.addConfiguration(ConfigurationConverter.getConfiguration(
> >>System.getProperties()));
> >>config.addConfiguration(new PropertiesConfiguration("app.properties"));
> >>config.addConfiguration(new PropertiesConfiguration(
> App.class.getResource
> >>("default.properties")));
> >>
> >>Here the defaults are stores in a file available from the class loader.
> >>This file would contain
> >>
> >>name=user
> >>
> >>The app.properties file would contain your line:
> >>
> >>hello=Hi there ${name}
> >>
> >>And if you app is started with -Dname="John Doe" it would interpolate to
> >>the correct value.
> >>
> >>- Jörg
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [hidden email]
> >>For additional commands, e-mail: [hidden email]
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [Configuration] unary statement operator support

Oliver Heger-3
Mikael Andersson wrote:
> Hi
> I am curious about whether there has been any work done with the
> "interpolation features"?
>
> Thanks
> - Micke

Sorry, not yet. There was no new release of [lang] in the meantime.

Oliver

>
> On 22/02/06, Oliver Heger <[hidden email]> wrote:
>>
>> An enhancement of the interpolation features is indeed on the agenda.
>> There is a bugzilla ticket covering this issue and providing some more
>> details:
>>
>> http://issues.apache.org/bugzilla/show_bug.cgi?id=35116
>>
>> Parts of this are already implemented. For other parts we would like to
>> make use of new classes in Commons Lang, which are not yet released.
>>
>> Oliver
>>
>> Mikael Andersson wrote:
>> > Hi Joerg,
>> > the pluggable interpolation approach would be cool.
>> >
>> > Thanks for making me aware of the composite configuration, I also need
>> to be
>> > able to override a configuration file with a map of values which this
>> seems
>> > to be able to do.
>> >
>> > Thanks for the quick reply,
>> > Micke
>> >
>> > On 22/02/06, Jörg Schaible <[hidden email]> wrote:
>> >
>> >>Hi Mikael,
>> >>
>> >>Mikael Andersson wrote on Wednesday, February 22, 2006 11:32 AM:
>> >>
>> >>
>> >>>Hi,
>> >>>I wonder if there are plans to support the unary operator in the
>> >>>configuration files? (Given it isn't already supported, had a look at
>> >>>the project website but couldn't find any information regarding it).
>> >>>
>> >>>Would be great to have something like this supported:
>> >>>hello=Hi there ${$name ? $name : user }
>> >>>
>> >>>The reason I'm asking is because I'm having a look at
>> >>>potential libraries to
>> >>>use in a future project, and this feature is something which
>> >>>is neccessary
>> >>>for our configuration files.
>> >>
>> >>No, something like this is not supported. Configurations could refactor
>> >>the interpolation into an Interface though, so different interpolation
>> >>engines could be used (e.g. el or jexl).
>> >>
>> >>Apart from this, you might solve your problem with a
>> >>CompositeConfiguration:
>> >>
>> >>CompositeConfiguration config = new CompositeConfiguration();
>> >>config.addConfiguration(ConfigurationConverter.getConfiguration(
>> >>System.getProperties()));
>> >>config.addConfiguration(new PropertiesConfiguration("app.properties"));
>> >>config.addConfiguration(new PropertiesConfiguration(
>> App.class.getResource
>> >>("default.properties")));
>> >>
>> >>Here the defaults are stores in a file available from the class loader.
>> >>This file would contain
>> >>
>> >>name=user
>> >>
>> >>The app.properties file would contain your line:
>> >>
>> >>hello=Hi there ${name}
>> >>
>> >>And if you app is started with -Dname="John Doe" it would
>> interpolate to
>> >>the correct value.
>> >>
>> >>- Jörg
>> >>
>> >>---------------------------------------------------------------------
>> >>To unsubscribe, e-mail: [hidden email]
>> >>For additional commands, e-mail: [hidden email]
>> >>
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]