Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Felix Meschberger
Hi

I think this is a good topic to discuss on a broader level.

I once implemented a function with two services configured through OSGi 
Configuration being able to overwritten by framework properties (aka system 
properties). What I did implement is a helper function which first checked the 
system property and if not set would revert to the OSGi configuration and if 
that was also not set revert to a default value.

I wonder, whether we could not make function available on a broader bases, such 
as through the OSGi Configuration Admin Service ?

Of course this has consequences when we start thinking in terms of „and what if 
I update configuration ?“ I think this goes into the discussion of immutable 
systems.

(Yes I know this is not standard, but lets start thinking about it and we might 
make it a standard…)

Regards
Felix

> Am 14.12.2016 um 14:40 schrieb Bertrand Delacretaz :
> 
> On Wed, Dec 14, 2016 at 12:07 PM, Robert Munteanu  wrote:
>> ...The idea is to allow the user to redefine it at runtime via system
>> properties:
>> 
>> java -jar ... -Dmpx.repository.home=/some/place ...
> 
> FWIW the crankstart launcher supports this, I've just added an example
> at http://svn.apache.org/r1774245 as that was not tested for configs
> so far.
> 
> I think it's required for modern operations, where some things are
> known only at runtime.
> 
> -Bertrand



Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Carsten Ziegeler
Felix Meschberger wrote
> 
> Am 14.12.2016 um 15:38 schrieb Carsten Ziegeler 
> >:
> 
> Felix Meschberger wrote
> > I guess this can be done with a ConfigurationPlugin transparently
> 
> Ah ! Nice catch. And with the updated ConfigurationAdmin specification we can 
> be reasonably sure this to be applied to DS configurations as well. Right ?
> 
Exactly :)

 Carsten

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org



Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Felix Meschberger

Am 14.12.2016 um 15:38 schrieb Carsten Ziegeler 
>:

Felix Meschberger wrote
Hi

I think this is a good topic to discuss on a broader level.

I once implemented a function with two services configured through OSGi 
Configuration being able to overwritten by framework properties (aka system 
properties). What I did implement is a helper function which first checked the 
system property and if not set would revert to the OSGi configuration and if 
that was also not set revert to a default value.

I wonder, whether we could not make function available on a broader bases, such 
as through the OSGi Configuration Admin Service ?

Of course this has consequences when we start thinking in terms of „and what if 
I update configuration ?“ I think this goes into the discussion of immutable 
systems.

I guess this can be done with a ConfigurationPlugin transparently

Ah ! Nice catch. And with the updated ConfigurationAdmin specification we can 
be reasonably sure this to be applied to DS configurations as well. Right ?

… and now for some side track coding of this ;-)

Thanks
Felix



Carsten

(Yes I know this is not standard, but lets start thinking about it and we might 
make it a standard…)

Regards
Felix

Am 14.12.2016 um 14:40 schrieb Bertrand Delacretaz 
>:

On Wed, Dec 14, 2016 at 12:07 PM, Robert Munteanu 
> wrote:
...The idea is to allow the user to redefine it at runtime via system
properties:

java -jar ... -Dmpx.repository.home=/some/place ...

FWIW the crankstart launcher supports this, I've just added an example
at http://svn.apache.org/r1774245 as that was not tested for configs
so far.

I think it's required for modern operations, where some things are
known only at runtime.

-Bertrand





--
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org



Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Carsten Ziegeler
Felix Meschberger wrote
> Hi
> 
> I think this is a good topic to discuss on a broader level.
> 
> I once implemented a function with two services configured through OSGi 
> Configuration being able to overwritten by framework properties (aka system 
> properties). What I did implement is a helper function which first checked 
> the system property and if not set would revert to the OSGi configuration and 
> if that was also not set revert to a default value.
> 
> I wonder, whether we could not make function available on a broader bases, 
> such as through the OSGi Configuration Admin Service ?
> 
> Of course this has consequences when we start thinking in terms of „and what 
> if I update configuration ?“ I think this goes into the discussion of 
> immutable systems.
> 
I guess this can be done with a ConfigurationPlugin transparently

Carsten

> (Yes I know this is not standard, but lets start thinking about it and we 
> might make it a standard…)
> 
> Regards
> Felix
> 
>> Am 14.12.2016 um 14:40 schrieb Bertrand Delacretaz :
>>
>> On Wed, Dec 14, 2016 at 12:07 PM, Robert Munteanu  wrote:
>>> ...The idea is to allow the user to redefine it at runtime via system
>>> properties:
>>>
>>> java -jar ... -Dmpx.repository.home=/some/place ...
>>
>> FWIW the crankstart launcher supports this, I've just added an example
>> at http://svn.apache.org/r1774245 as that was not tested for configs
>> so far.
>>
>> I think it's required for modern operations, where some things are
>> known only at runtime.
>>
>> -Bertrand
> 


 

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org



Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Robert Munteanu
On Wed, 2016-12-14 at 14:40 +0100, Bertrand Delacretaz wrote:
> On Wed, Dec 14, 2016 at 12:07 PM, Robert Munteanu  > wrote:
> > ...The idea is to allow the user to redefine it at runtime via
> > system
> > properties:
> > 
> > java -jar ... -Dmpx.repository.home=/some/place ...
> 
> FWIW the crankstart launcher supports this, I've just added an
> example
> at http://svn.apache.org/r1774245 as that was not tested for configs
> so far.
> 
> I think it's required for modern operations, where some things are
> known only at runtime.

Good to know, thanks!

Robert


Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Bertrand Delacretaz
On Wed, Dec 14, 2016 at 12:07 PM, Robert Munteanu  wrote:
> ...The idea is to allow the user to redefine it at runtime via system
> properties:
>
> java -jar ... -Dmpx.repository.home=/some/place ...

FWIW the crankstart launcher supports this, I've just added an example
at http://svn.apache.org/r1774245 as that was not tested for configs
so far.

I think it's required for modern operations, where some things are
known only at runtime.

-Bertrand


Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Carsten Ziegeler
Robert Munteanu wrote
> Hi,
> 
> On Wed, 2016-12-14 at 12:57 +0100, Carsten Ziegeler wrote:
>> Hi,
>>
>> I think what should work is to use variables/properties defined in
>> the pom:
>> In the prov model you have
>> [variables]
>>mpx.repository=${foo}
>>
>> in the pom you have
>> 
>>${sling.home}/repository
>> 
>>
>> and then you set true for the
>> slingstart maven plugin configuration.
>>
>> And finally you can use the maven mechanisms to override the property
>> value for foo.
> 
> Thanks for the reply. What that means though is that I can't use that
> at runtime, when running the slingstart, right?


True

Carsten

> 
> But on the other hand I should be able to drop in a config file and
> that would override the property, which should be fine.
> 
> Thanks,
> 
> Robert
> 
>>
>> Regards
>> Carsten
>>
>> Robert Munteanu wrote
>>> Hi,
>>>
>>> I'm trying to set a 'dynamic' property in the slingstart model,
>>> based
>>> on sling.home:
>>>
>>> [variables]
>>>   mpx.repository.home=${sling.home}/repository
>>>
>>> The idea is to allow the user to redefine it at runtime via system
>>> properties:
>>>
>>> java -jar ... -Dmpx.repository.home=/some/place
>>>
>>> Is this possible using slingstart? If not, what solutions do I have
>>> to
>>> enable this kind of usage?
>>>
>>> Thanks,
>>>
>>> Robert
>>>
>>
>>
>>  
>>
> 
> 


 

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org



Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Robert Munteanu
Hi,

On Wed, 2016-12-14 at 12:57 +0100, Carsten Ziegeler wrote:
> Hi,
> 
> I think what should work is to use variables/properties defined in
> the pom:
> In the prov model you have
> [variables]
>    mpx.repository=${foo}
> 
> in the pom you have
> 
>    ${sling.home}/repository
> 
> 
> and then you set true for the
> slingstart maven plugin configuration.
> 
> And finally you can use the maven mechanisms to override the property
> value for foo.

Thanks for the reply. What that means though is that I can't use that
at runtime, when running the slingstart, right?

But on the other hand I should be able to drop in a config file and
that would override the property, which should be fine.

Thanks,

Robert

> 
> Regards
> Carsten
> 
> Robert Munteanu wrote
> > Hi,
> > 
> > I'm trying to set a 'dynamic' property in the slingstart model,
> > based
> > on sling.home:
> > 
> > [variables]
> >   mpx.repository.home=${sling.home}/repository
> > 
> > The idea is to allow the user to redefine it at runtime via system
> > properties:
> > 
> > java -jar ... -Dmpx.repository.home=/some/place
> > 
> > Is this possible using slingstart? If not, what solutions do I have
> > to
> > enable this kind of usage?
> > 
> > Thanks,
> > 
> > Robert
> > 
> 
> 
>  
> 



Re: [slingstart] Overriding a variable from the command line at runtime

2016-12-14 Thread Carsten Ziegeler
Hi,

I think what should work is to use variables/properties defined in the pom:
In the prov model you have
[variables]
   mpx.repository=${foo}

in the pom you have

   ${sling.home}/repository


and then you set true for the
slingstart maven plugin configuration.

And finally you can use the maven mechanisms to override the property
value for foo.

Regards
Carsten

Robert Munteanu wrote
> Hi,
> 
> I'm trying to set a 'dynamic' property in the slingstart model, based
> on sling.home:
> 
> [variables]
>   mpx.repository.home=${sling.home}/repository
> 
> The idea is to allow the user to redefine it at runtime via system
> properties:
> 
> java -jar ... -Dmpx.repository.home=/some/place
> 
> Is this possible using slingstart? If not, what solutions do I have to
> enable this kind of usage?
> 
> Thanks,
> 
> Robert
> 


 

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org