You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Daniele Dellafiore <il...@gmail.com> on 2011/06/07 11:15:33 UTC

configuring karaf dynamically

Hi. I've some problem in understanding how karaf dynamic configuration
works from
https://cwiki.apache.org/KARAF/48-configuration.html

Now if I do a config:list on my karaf, i can't see a lot of properties
I've set in etc/config.properties, for examples, like all http service
properties (host name, ports...)

For example I've added these lines at the end of etc/config.properties

org.osgi.service.http.port=8181
org.osgi.service.http.secure.enabled=true
org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
org.ops4j.pax.web.ssl.password=xxx
org.ops4j.pax.web.ssl.keypassword=xxx
org.osgi.service.http.port.secure=443

but how can I See them from the config editor?
Also, I'm not completely sure on where is right to put those
properties, for example the HTTPS config, as for,
http://wiki.ops4j.org/display/paxweb/SSL+Configuration

the file where to write is not specified. It seems to me that
config.properties works, but I think that all the properties files
under etc are read, right? So there's some kind of hierarchy? Where's
that explained? In fact I can't be sure if it works. Example, if a
serve answer correctly at

http://domain:8181/app/signin

should it also answer at

https://domain/app/signin

Cause in my situation, it does not.

Also, talking about ports, I've tried to change 8181 into 80 but my
http bundles now does not answer neither on 80 or 8181. Maybe is a
firewall problem but it's a practice you recommend? I mean, I do want
http on 80, and I do not want to put some apache proxy behind Karaf,
so I can't figure out any other way than changing the http service
port there, is correct?

Finally, do you recommend me a book on Karaf? I already had OSGi in
Action but maybe Karaf in action (or such)  can be good for me.


Thanks for any support.


-- 
Daniele Dellafiore
http://danieledellafiore.net

Re: configuring karaf dynamically

Posted by mikevan <mv...@comcast.net>.
Danielle,

If you'd like to see the contents of a configuration file deployed into
Karaf (assuming it has a .cfg extension), you would do the following (lets
say you want to see the contents of org.apache.karaf.log.cfg) :

1)  features:install config
2) config:list '(service.id=org.apache.karaf.log)'

Note that the.cfg extension is omitted.


ildella wrote:
> 
> Hi. I've some problem in understanding how karaf dynamic configuration
> works from
> https://cwiki.apache.org/KARAF/48-configuration.html
> 
> Now if I do a config:list on my karaf, i can't see a lot of properties
> I've set in etc/config.properties, for examples, like all http service
> properties (host name, ports...)
> 
> For example I've added these lines at the end of etc/config.properties
> 
> org.osgi.service.http.port=8181
> org.osgi.service.http.secure.enabled=true
> org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
> org.ops4j.pax.web.ssl.password=xxx
> org.ops4j.pax.web.ssl.keypassword=xxx
> org.osgi.service.http.port.secure=443
> 
> but how can I See them from the config editor?
> Also, I'm not completely sure on where is right to put those
> properties, for example the HTTPS config, as for,
> http://wiki.ops4j.org/display/paxweb/SSL+Configuration
> 
> the file where to write is not specified. It seems to me that
> config.properties works, but I think that all the properties files
> under etc are read, right? So there's some kind of hierarchy? Where's
> that explained? In fact I can't be sure if it works. Example, if a
> serve answer correctly at
> 
> http://domain:8181/app/signin
> 
> should it also answer at
> 
> https://domain/app/signin
> 
> Cause in my situation, it does not.
> 
> Also, talking about ports, I've tried to change 8181 into 80 but my
> http bundles now does not answer neither on 80 or 8181. Maybe is a
> firewall problem but it's a practice you recommend? I mean, I do want
> http on 80, and I do not want to put some apache proxy behind Karaf,
> so I can't figure out any other way than changing the http service
> port there, is correct?
> 
> Finally, do you recommend me a book on Karaf? I already had OSGi in
> Action but maybe Karaf in action (or such)  can be good for me.
> 
> 
> Thanks for any support.
> 
> 
> -- 
> Daniele Dellafiore
> http://danieledellafiore.net
> 


-----
Mike Van (aka karafman)
Karaf Team (Contributor)
--
View this message in context: http://karaf.922171.n3.nabble.com/configuring-karaf-dynamically-tp3033747p3086788.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: configuring karaf dynamically

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
I second Achim.

Just an information. From a general point of view, Karaf configuration 
is powered by OSGi ConfigAdmin.

In ConfigAdmin, the configurations are defined as a set of properties 
group by a ID (PID).

For instance, org.ops4j.pax.web is a ID containing properties relative 
to Pax Web.
It allows a better overview of properties by bundles/applications.

Regards
JB

On 06/07/2011 11:22 AM, Achim Nierbeck wrote:
> Hi Daniele,
>
> you need to create a configuration file for pax-web this would be
>
> etc/org.ops4j.pax.web.cfg
>
> the *.cfg files are picked up through the FileInstaller bundle which in turn
> uses those to configure the config admin service.
> In your case since you installed the http feature through the
> the shell
>
> features:install http
>
> you have a default configuration which is already available to the
> configuration admin service through the installation of the feature.
> You might also do a
> features:info http
> to see which configuration is already connected to it.
>
> To make it short you need a config file that
> needs to look like the PID (Persistent ID - of a service) with an
> attached .cfg for being picked up.
>
> regards, Achim
>
>
> 2011/6/7 Daniele Dellafiore<il...@gmail.com>:
>> Hi. I've some problem in understanding how karaf dynamic configuration
>> works from
>> https://cwiki.apache.org/KARAF/48-configuration.html
>>
>> Now if I do a config:list on my karaf, i can't see a lot of properties
>> I've set in etc/config.properties, for examples, like all http service
>> properties (host name, ports...)
>>
>> For example I've added these lines at the end of etc/config.properties
>>
>> org.osgi.service.http.port=8181
>> org.osgi.service.http.secure.enabled=true
>> org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
>> org.ops4j.pax.web.ssl.password=xxx
>> org.ops4j.pax.web.ssl.keypassword=xxx
>> org.osgi.service.http.port.secure=443
>>
>> but how can I See them from the config editor?
>> Also, I'm not completely sure on where is right to put those
>> properties, for example the HTTPS config, as for,
>> http://wiki.ops4j.org/display/paxweb/SSL+Configuration
>>
>> the file where to write is not specified. It seems to me that
>> config.properties works, but I think that all the properties files
>> under etc are read, right? So there's some kind of hierarchy? Where's
>> that explained? In fact I can't be sure if it works. Example, if a
>> serve answer correctly at
>>
>> http://domain:8181/app/signin
>>
>> should it also answer at
>>
>> https://domain/app/signin
>>
>> Cause in my situation, it does not.
>>
>> Also, talking about ports, I've tried to change 8181 into 80 but my
>> http bundles now does not answer neither on 80 or 8181. Maybe is a
>> firewall problem but it's a practice you recommend? I mean, I do want
>> http on 80, and I do not want to put some apache proxy behind Karaf,
>> so I can't figure out any other way than changing the http service
>> port there, is correct?
>>
>> Finally, do you recommend me a book on Karaf? I already had OSGi in
>> Action but maybe Karaf in action (or such)  can be good for me.
>>
>>
>> Thanks for any support.
>>
>>
>> --
>> Daniele Dellafiore
>> http://danieledellafiore.net
>>
>
>
>

Re: configuring karaf dynamically

Posted by Daniele Dellafiore <da...@dellafiore.net>.
Thanks.
I moved the config to the new file and now I see the config line with a

config:list |grep 443

Still, I've refreshed org.eclipse.jetty.http bundle, also restarted it
and my http application bundle, even restarted the whole karaf (!) but
yet the https does not answer.

I'm thinking issue is outside karaf cause if I move jetty HTTP port to
80, it does no answer as well...

Anyway thanks for precious tips, now I can dynamically change
properties and that's good.
So for any bundle of mine, a .cfg file in etc will make me able to use
dynamic config for it?

On Tue, Jun 7, 2011 at 11:22 AM, Achim Nierbeck <bc...@googlemail.com> wrote:
> Hi Daniele,
>
> you need to create a configuration file for pax-web this would be
>
> etc/org.ops4j.pax.web.cfg
>
> the *.cfg files are picked up through the FileInstaller bundle which in turn
> uses those to configure the config admin service.
> In your case since you installed the http feature through the
> the shell
>
> features:install http
>
> you have a default configuration which is already available to the
> configuration admin service through the installation of the feature.
> You might also do a
> features:info http
> to see which configuration is already connected to it.
>
> To make it short you need a config file that
> needs to look like the PID (Persistent ID - of a service) with an
> attached .cfg for being picked up.
>
> regards, Achim
>
>
> 2011/6/7 Daniele Dellafiore <il...@gmail.com>:
>> Hi. I've some problem in understanding how karaf dynamic configuration
>> works from
>> https://cwiki.apache.org/KARAF/48-configuration.html
>>
>> Now if I do a config:list on my karaf, i can't see a lot of properties
>> I've set in etc/config.properties, for examples, like all http service
>> properties (host name, ports...)
>>
>> For example I've added these lines at the end of etc/config.properties
>>
>> org.osgi.service.http.port=8181
>> org.osgi.service.http.secure.enabled=true
>> org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
>> org.ops4j.pax.web.ssl.password=xxx
>> org.ops4j.pax.web.ssl.keypassword=xxx
>> org.osgi.service.http.port.secure=443
>>
>> but how can I See them from the config editor?
>> Also, I'm not completely sure on where is right to put those
>> properties, for example the HTTPS config, as for,
>> http://wiki.ops4j.org/display/paxweb/SSL+Configuration
>>
>> the file where to write is not specified. It seems to me that
>> config.properties works, but I think that all the properties files
>> under etc are read, right? So there's some kind of hierarchy? Where's
>> that explained? In fact I can't be sure if it works. Example, if a
>> serve answer correctly at
>>
>> http://domain:8181/app/signin
>>
>> should it also answer at
>>
>> https://domain/app/signin
>>
>> Cause in my situation, it does not.
>>
>> Also, talking about ports, I've tried to change 8181 into 80 but my
>> http bundles now does not answer neither on 80 or 8181. Maybe is a
>> firewall problem but it's a practice you recommend? I mean, I do want
>> http on 80, and I do not want to put some apache proxy behind Karaf,
>> so I can't figure out any other way than changing the http service
>> port there, is correct?
>>
>> Finally, do you recommend me a book on Karaf? I already had OSGi in
>> Action but maybe Karaf in action (or such)  can be good for me.
>>
>>
>> Thanks for any support.
>>
>>
>> --
>> Daniele Dellafiore
>> http://danieledellafiore.net
>>
>
>
>
> --
> --
> *Achim Nierbeck*
>
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> Committer & Project Lead
>

Re: configuring karaf dynamically

Posted by Dan Tran <da...@gmail.com>.
I can confirm that o.a.k.management bundle does restart due to this
<cm:property-placeholder persistent-id="org.apache.karaf.management"
update-strategy="reload">

-Dan

On Thu, Jun 9, 2011 at 3:20 PM, Achim Nierbeck <bc...@googlemail.com> wrote:
> Hi Dan,
>
> look at this thread:
>
> http://karaf.922171.n3.nabble.com/ManagedServiceFactory-updated-never-get-called-with-etc-configuration-tt2464442.html
>
> and this one:
>
> http://karaf.922171.n3.nabble.com/Managed-Properties-question-tt2107407.html
>
> regards, Achim
>
> Am 10.06.2011 00:09, schrieb Dan Tran:
>>
>> Hi Achim
>>
>> Do you have an example to make a 'managed service' with relation to config
>> amin?
>>
>> ie, a change in config would trigger a 'managed service' to refresh
>> itself?
>>
>> Thanks
>>
>> -D
>>
>> On Thu, Jun 9, 2011 at 2:05 PM, Achim Nierbeck<bc...@googlemail.com>
>>  wrote:
>>>
>>> Hi Dan,
>>>
>>> yep, I just did take another look at the config, did get distracted by
>>> the
>>> update-strategy.
>>> For the factories to be 'reconfigured' those factories would need to be
>>> manged services.
>>> Which they aren't so I guess a refresh on the bundle needs to be called.
>>>
>>> regards, Achim
>>>
>>> Am 09.06.2011 22:56, schrieb Dan Tran:
>>>>
>>>> Hi Achim,
>>>>
>>>> Thank you for the response, from my understanding 'reconfigured' will
>>>> not send 'connectorFactory' to re-init, this means changes propagated
>>>> to 'connectorFactory' beane will not get looked at ( ie MBServer keeps
>>>> using the old config ).
>>>>
>>>> is it expected?
>>>>
>>>> Thanks again
>>>>
>>>> -Dan
>>>>
>>>> On Thu, Jun 9, 2011 at 1:37 PM, Achim Nierbeck<bc...@googlemail.com>
>>>>  wrote:
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> sorry for the belated response :-)
>>>>>
>>>>> if you take a look at the blueprint config or on the excerpt:
>>>>>
>>>>> <!-- Property place holder -->
>>>>> <cm:property-placeholder persistent-id="org.apache.karaf.management"
>>>>> update-strategy="reload">
>>>>> <cm:default-properties>
>>>>> <cm:property name="rmiRegistryPort" value="1099"/>
>>>>> <cm:property name="rmiServerPort" value="44444"/>
>>>>> <cm:property name="jmxRealm" value="karaf"/>
>>>>> <cm:property name="jmxRole" value="$[karaf.admin.role]"/>
>>>>> <cm:property name="serviceUrl"
>>>>>
>>>>>
>>>>> value="service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-$[karaf.name]"/>
>>>>> <cm:property name="daemon" value="true"/>
>>>>> <cm:property name="threaded" value="true"/>
>>>>> <cm:property name="objectName" value="connector:name=rmi"/>
>>>>> </cm:default-properties>
>>>>> </cm:property-placeholder>
>>>>>
>>>>> you'll see that it is managed.
>>>>> So yes if you do change the management.cfg it will be reconfigured. Not
>>>>> restarted.
>>>>>
>>>>>
>>>>> Regards, Achim
>>>>>
>>>>>
>>>>> Am 08.06.2011 17:33, schrieb Dan Tran:
>>>>>>
>>>>>> I am too looking for an example on how dynamics configuration work.
>>>>>>  From this conversation, does it mean if I update
>>>>>> org.apache.karaf.management.cfg
>>>>>> o.a.k.management bundle will restart? ( ie connectorFactory will get a
>>>>>> new update of its runtime configuration ? )
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> -Dan
>>>>>>
>>>>>>
>>>>>> On Wed, Jun 8, 2011 at 7:58 AM, Achim
>>>>>> Nierbeck<bc...@googlemail.com>
>>>>>>  wrote:
>>>>>>>
>>>>>>> Hi Daniele,
>>>>>>>
>>>>>>> spring-dm is fine too :-)
>>>>>>>
>>>>>>> documentation for spring-dm:
>>>>>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/
>>>>>>> and the configuration admin part
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm
>>>>>>>
>>>>>>> so I suggest you carefully read the part about how to get your
>>>>>>> configuration injected through the configuration admin.
>>>>>>> the configuration admin itself does get it's properties set through
>>>>>>> the FileInstaller which in turn watches the etc folder for *.cfg
>>>>>>> files.
>>>>>>> So yes you should put your properties in a configuration file in that
>>>>>>> exact directory :-)
>>>>>>>
>>>>>>> But be aware that the properties inside this config need to be of the
>>>>>>> "short" type like key=value, this way it's easier for the
>>>>>>> property placeholder to be able to inject those properties.
>>>>>>>
>>>>>>> Regards, Achim
>>>>>>>
>>>>>>> 2011/6/8 Daniele Dellafiore<da...@dellafiore.net>:
>>>>>>>>
>>>>>>>> On Wed, Jun 8, 2011 at 4:21 PM, Achim
>>>>>>>> Nierbeck<bc...@googlemail.com>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Short answer, no :-)
>>>>>>>>>
>>>>>>>>> Long answer, you have to take care of that. There are certain ways
>>>>>>>>> of
>>>>>>>>> doing this.
>>>>>>>>> 1) write code in your Activator class where you make your Class a
>>>>>>>>> Manageable Class
>>>>>>>>> - for an example of this you might take a look at the pax web stuff
>>>>>>>>> :-)
>>>>>>>>> 2) use spring-dm you can use spring xml configurations for doing
>>>>>>>>> this
>>>>>>>>> kind of stuff
>>>>>>>>> - see the spring-dm documentation
>>>>>>>>> 3) use blueprint this is the osgi spec compliant version of
>>>>>>>>> spring-dm
>>>>>>>>> and again your able to do such in a xml.
>>>>>>>>> - either apache aries documentation or spring-dm 2.0 documentation
>>>>>>>>> which is another reference impl. of blueprint
>>>>>>>>>
>>>>>>>>> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>>>>>>>>
>>>>>>>> I'm using spring-dm for all my bundles so I'll probably try that one
>>>>>>>> first.
>>>>>>>> I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.
>>>>>>>>
>>>>>>>> Generally, in my bundles a simple refresh should just reload
>>>>>>>> everyhing
>>>>>>>> right? So just two more questions:
>>>>>>>>
>>>>>>>> 1. either I can make dynamic reload work or not, is good practice to
>>>>>>>> have a
>>>>>>>> symbolic.name.cfg for all the bundle specific properties? Always
>>>>>>>> better
>>>>>>>> then
>>>>>>>> having properties inside the bundle (that would force me to
>>>>>>>> reinstall
>>>>>>>> the
>>>>>>>> bundle). In that case I tell explicitly the spring
>>>>>>>> PropertyPlaceholder
>>>>>>>> the
>>>>>>>> name of the properties file, I guess that I can reach it with
>>>>>>>>
>>>>>>>> resource="classpath:symbilic.name.cfg"
>>>>>>>>
>>>>>>>> if its at KARAF/etc/symbilic.name.cfg   right?
>>>>>>>>
>>>>>>>> 2. I've googled but I can't find any spring-dm specific docs about
>>>>>>>> this,
>>>>>>>> just some generic blog or archived mails, can you point me to some
>>>>>>>> official
>>>>>>>> doc?
>>>>>>>>
>>>>>>>> Thanks again for the precious clarifications.
>>>>>>>>
>>>>>>>> --
>>>>>>>> Daniele Dellafiore
>>>>>>>> http://danieledellafiore.net
>>>>>>>>
>>>>>>> --
>>>>>>> --
>>>>>>> *Achim Nierbeck*
>>>>>>>
>>>>>>>
>>>>>>> Apache Karaf<http://karaf.apache.org/>      Committer&      PMC
>>>>>>> OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>>>>>> Committer&      Project Lead
>>>>>>>
>>>
>
>

Re: configuring karaf dynamically

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Dan,

look at this thread:

http://karaf.922171.n3.nabble.com/ManagedServiceFactory-updated-never-get-called-with-etc-configuration-tt2464442.html

and this one:

http://karaf.922171.n3.nabble.com/Managed-Properties-question-tt2107407.html

regards, Achim

Am 10.06.2011 00:09, schrieb Dan Tran:
> Hi Achim
>
> Do you have an example to make a 'managed service' with relation to config amin?
>
> ie, a change in config would trigger a 'managed service' to refresh itself?
>
> Thanks
>
> -D
>
> On Thu, Jun 9, 2011 at 2:05 PM, Achim Nierbeck<bc...@googlemail.com>  wrote:
>> Hi Dan,
>>
>> yep, I just did take another look at the config, did get distracted by the
>> update-strategy.
>> For the factories to be 'reconfigured' those factories would need to be
>> manged services.
>> Which they aren't so I guess a refresh on the bundle needs to be called.
>>
>> regards, Achim
>>
>> Am 09.06.2011 22:56, schrieb Dan Tran:
>>> Hi Achim,
>>>
>>> Thank you for the response, from my understanding 'reconfigured' will
>>> not send 'connectorFactory' to re-init, this means changes propagated
>>> to 'connectorFactory' beane will not get looked at ( ie MBServer keeps
>>> using the old config ).
>>>
>>> is it expected?
>>>
>>> Thanks again
>>>
>>> -Dan
>>>
>>> On Thu, Jun 9, 2011 at 1:37 PM, Achim Nierbeck<bc...@googlemail.com>
>>>   wrote:
>>>> Hi Dan,
>>>>
>>>> sorry for the belated response :-)
>>>>
>>>> if you take a look at the blueprint config or on the excerpt:
>>>>
>>>> <!-- Property place holder -->
>>>> <cm:property-placeholder persistent-id="org.apache.karaf.management"
>>>> update-strategy="reload">
>>>> <cm:default-properties>
>>>> <cm:property name="rmiRegistryPort" value="1099"/>
>>>> <cm:property name="rmiServerPort" value="44444"/>
>>>> <cm:property name="jmxRealm" value="karaf"/>
>>>> <cm:property name="jmxRole" value="$[karaf.admin.role]"/>
>>>> <cm:property name="serviceUrl"
>>>>
>>>> value="service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-$[karaf.name]"/>
>>>> <cm:property name="daemon" value="true"/>
>>>> <cm:property name="threaded" value="true"/>
>>>> <cm:property name="objectName" value="connector:name=rmi"/>
>>>> </cm:default-properties>
>>>> </cm:property-placeholder>
>>>>
>>>> you'll see that it is managed.
>>>> So yes if you do change the management.cfg it will be reconfigured. Not
>>>> restarted.
>>>>
>>>>
>>>> Regards, Achim
>>>>
>>>>
>>>> Am 08.06.2011 17:33, schrieb Dan Tran:
>>>>> I am too looking for an example on how dynamics configuration work.
>>>>>   From this conversation, does it mean if I update
>>>>> org.apache.karaf.management.cfg
>>>>> o.a.k.management bundle will restart? ( ie connectorFactory will get a
>>>>> new update of its runtime configuration ? )
>>>>>
>>>>> Thanks
>>>>>
>>>>> -Dan
>>>>>
>>>>>
>>>>> On Wed, Jun 8, 2011 at 7:58 AM, Achim Nierbeck<bc...@googlemail.com>
>>>>>   wrote:
>>>>>> Hi Daniele,
>>>>>>
>>>>>> spring-dm is fine too :-)
>>>>>>
>>>>>> documentation for spring-dm:
>>>>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/
>>>>>> and the configuration admin part
>>>>>>
>>>>>>
>>>>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm
>>>>>>
>>>>>> so I suggest you carefully read the part about how to get your
>>>>>> configuration injected through the configuration admin.
>>>>>> the configuration admin itself does get it's properties set through
>>>>>> the FileInstaller which in turn watches the etc folder for *.cfg
>>>>>> files.
>>>>>> So yes you should put your properties in a configuration file in that
>>>>>> exact directory :-)
>>>>>>
>>>>>> But be aware that the properties inside this config need to be of the
>>>>>> "short" type like key=value, this way it's easier for the
>>>>>> property placeholder to be able to inject those properties.
>>>>>>
>>>>>> Regards, Achim
>>>>>>
>>>>>> 2011/6/8 Daniele Dellafiore<da...@dellafiore.net>:
>>>>>>> On Wed, Jun 8, 2011 at 4:21 PM, Achim
>>>>>>> Nierbeck<bc...@googlemail.com>
>>>>>>> wrote:
>>>>>>>> Short answer, no :-)
>>>>>>>>
>>>>>>>> Long answer, you have to take care of that. There are certain ways of
>>>>>>>> doing this.
>>>>>>>> 1) write code in your Activator class where you make your Class a
>>>>>>>> Manageable Class
>>>>>>>> - for an example of this you might take a look at the pax web stuff
>>>>>>>> :-)
>>>>>>>> 2) use spring-dm you can use spring xml configurations for doing this
>>>>>>>> kind of stuff
>>>>>>>> - see the spring-dm documentation
>>>>>>>> 3) use blueprint this is the osgi spec compliant version of spring-dm
>>>>>>>> and again your able to do such in a xml.
>>>>>>>> - either apache aries documentation or spring-dm 2.0 documentation
>>>>>>>> which is another reference impl. of blueprint
>>>>>>>>
>>>>>>>> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>>>>>>> I'm using spring-dm for all my bundles so I'll probably try that one
>>>>>>> first.
>>>>>>> I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.
>>>>>>>
>>>>>>> Generally, in my bundles a simple refresh should just reload everyhing
>>>>>>> right? So just two more questions:
>>>>>>>
>>>>>>> 1. either I can make dynamic reload work or not, is good practice to
>>>>>>> have a
>>>>>>> symbolic.name.cfg for all the bundle specific properties? Always
>>>>>>> better
>>>>>>> then
>>>>>>> having properties inside the bundle (that would force me to reinstall
>>>>>>> the
>>>>>>> bundle). In that case I tell explicitly the spring PropertyPlaceholder
>>>>>>> the
>>>>>>> name of the properties file, I guess that I can reach it with
>>>>>>>
>>>>>>> resource="classpath:symbilic.name.cfg"
>>>>>>>
>>>>>>> if its at KARAF/etc/symbilic.name.cfg   right?
>>>>>>>
>>>>>>> 2. I've googled but I can't find any spring-dm specific docs about
>>>>>>> this,
>>>>>>> just some generic blog or archived mails, can you point me to some
>>>>>>> official
>>>>>>> doc?
>>>>>>>
>>>>>>> Thanks again for the precious clarifications.
>>>>>>>
>>>>>>> --
>>>>>>> Daniele Dellafiore
>>>>>>> http://danieledellafiore.net
>>>>>>>
>>>>>> --
>>>>>> --
>>>>>> *Achim Nierbeck*
>>>>>>
>>>>>>
>>>>>> Apache Karaf<http://karaf.apache.org/>      Committer&      PMC
>>>>>> OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>>>>> Committer&      Project Lead
>>>>>>
>>


Re: configuring karaf dynamically

Posted by Dan Tran <da...@gmail.com>.
Hi Achim

Do you have an example to make a 'managed service' with relation to config amin?

ie, a change in config would trigger a 'managed service' to refresh itself?

Thanks

-D

On Thu, Jun 9, 2011 at 2:05 PM, Achim Nierbeck <bc...@googlemail.com> wrote:
> Hi Dan,
>
> yep, I just did take another look at the config, did get distracted by the
> update-strategy.
> For the factories to be 'reconfigured' those factories would need to be
> manged services.
> Which they aren't so I guess a refresh on the bundle needs to be called.
>
> regards, Achim
>
> Am 09.06.2011 22:56, schrieb Dan Tran:
>>
>> Hi Achim,
>>
>> Thank you for the response, from my understanding 'reconfigured' will
>> not send 'connectorFactory' to re-init, this means changes propagated
>> to 'connectorFactory' beane will not get looked at ( ie MBServer keeps
>> using the old config ).
>>
>> is it expected?
>>
>> Thanks again
>>
>> -Dan
>>
>> On Thu, Jun 9, 2011 at 1:37 PM, Achim Nierbeck<bc...@googlemail.com>
>>  wrote:
>>>
>>> Hi Dan,
>>>
>>> sorry for the belated response :-)
>>>
>>> if you take a look at the blueprint config or on the excerpt:
>>>
>>> <!-- Property place holder -->
>>> <cm:property-placeholder persistent-id="org.apache.karaf.management"
>>> update-strategy="reload">
>>> <cm:default-properties>
>>> <cm:property name="rmiRegistryPort" value="1099"/>
>>> <cm:property name="rmiServerPort" value="44444"/>
>>> <cm:property name="jmxRealm" value="karaf"/>
>>> <cm:property name="jmxRole" value="$[karaf.admin.role]"/>
>>> <cm:property name="serviceUrl"
>>>
>>> value="service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-$[karaf.name]"/>
>>> <cm:property name="daemon" value="true"/>
>>> <cm:property name="threaded" value="true"/>
>>> <cm:property name="objectName" value="connector:name=rmi"/>
>>> </cm:default-properties>
>>> </cm:property-placeholder>
>>>
>>> you'll see that it is managed.
>>> So yes if you do change the management.cfg it will be reconfigured. Not
>>> restarted.
>>>
>>>
>>> Regards, Achim
>>>
>>>
>>> Am 08.06.2011 17:33, schrieb Dan Tran:
>>>>
>>>> I am too looking for an example on how dynamics configuration work.
>>>>  From this conversation, does it mean if I update
>>>> org.apache.karaf.management.cfg
>>>> o.a.k.management bundle will restart? ( ie connectorFactory will get a
>>>> new update of its runtime configuration ? )
>>>>
>>>> Thanks
>>>>
>>>> -Dan
>>>>
>>>>
>>>> On Wed, Jun 8, 2011 at 7:58 AM, Achim Nierbeck<bc...@googlemail.com>
>>>>  wrote:
>>>>>
>>>>> Hi Daniele,
>>>>>
>>>>> spring-dm is fine too :-)
>>>>>
>>>>> documentation for spring-dm:
>>>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/
>>>>> and the configuration admin part
>>>>>
>>>>>
>>>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm
>>>>>
>>>>> so I suggest you carefully read the part about how to get your
>>>>> configuration injected through the configuration admin.
>>>>> the configuration admin itself does get it's properties set through
>>>>> the FileInstaller which in turn watches the etc folder for *.cfg
>>>>> files.
>>>>> So yes you should put your properties in a configuration file in that
>>>>> exact directory :-)
>>>>>
>>>>> But be aware that the properties inside this config need to be of the
>>>>> "short" type like key=value, this way it's easier for the
>>>>> property placeholder to be able to inject those properties.
>>>>>
>>>>> Regards, Achim
>>>>>
>>>>> 2011/6/8 Daniele Dellafiore<da...@dellafiore.net>:
>>>>>>
>>>>>> On Wed, Jun 8, 2011 at 4:21 PM, Achim
>>>>>> Nierbeck<bc...@googlemail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Short answer, no :-)
>>>>>>>
>>>>>>> Long answer, you have to take care of that. There are certain ways of
>>>>>>> doing this.
>>>>>>> 1) write code in your Activator class where you make your Class a
>>>>>>> Manageable Class
>>>>>>> - for an example of this you might take a look at the pax web stuff
>>>>>>> :-)
>>>>>>> 2) use spring-dm you can use spring xml configurations for doing this
>>>>>>> kind of stuff
>>>>>>> - see the spring-dm documentation
>>>>>>> 3) use blueprint this is the osgi spec compliant version of spring-dm
>>>>>>> and again your able to do such in a xml.
>>>>>>> - either apache aries documentation or spring-dm 2.0 documentation
>>>>>>> which is another reference impl. of blueprint
>>>>>>>
>>>>>>> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>>>>>>
>>>>>> I'm using spring-dm for all my bundles so I'll probably try that one
>>>>>> first.
>>>>>> I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.
>>>>>>
>>>>>> Generally, in my bundles a simple refresh should just reload everyhing
>>>>>> right? So just two more questions:
>>>>>>
>>>>>> 1. either I can make dynamic reload work or not, is good practice to
>>>>>> have a
>>>>>> symbolic.name.cfg for all the bundle specific properties? Always
>>>>>> better
>>>>>> then
>>>>>> having properties inside the bundle (that would force me to reinstall
>>>>>> the
>>>>>> bundle). In that case I tell explicitly the spring PropertyPlaceholder
>>>>>> the
>>>>>> name of the properties file, I guess that I can reach it with
>>>>>>
>>>>>> resource="classpath:symbilic.name.cfg"
>>>>>>
>>>>>> if its at KARAF/etc/symbilic.name.cfg   right?
>>>>>>
>>>>>> 2. I've googled but I can't find any spring-dm specific docs about
>>>>>> this,
>>>>>> just some generic blog or archived mails, can you point me to some
>>>>>> official
>>>>>> doc?
>>>>>>
>>>>>> Thanks again for the precious clarifications.
>>>>>>
>>>>>> --
>>>>>> Daniele Dellafiore
>>>>>> http://danieledellafiore.net
>>>>>>
>>>>>
>>>>> --
>>>>> --
>>>>> *Achim Nierbeck*
>>>>>
>>>>>
>>>>> Apache Karaf<http://karaf.apache.org/>    Committer&    PMC
>>>>> OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>>>> Committer&    Project Lead
>>>>>
>>>
>
>

Re: configuring karaf dynamically

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Dan,

yep, I just did take another look at the config, did get distracted by 
the update-strategy.
For the factories to be 'reconfigured' those factories would need to be 
manged services.
Which they aren't so I guess a refresh on the bundle needs to be called.

regards, Achim

Am 09.06.2011 22:56, schrieb Dan Tran:
> Hi Achim,
>
> Thank you for the response, from my understanding 'reconfigured' will
> not send 'connectorFactory' to re-init, this means changes propagated
> to 'connectorFactory' beane will not get looked at ( ie MBServer keeps
> using the old config ).
>
> is it expected?
>
> Thanks again
>
> -Dan
>
> On Thu, Jun 9, 2011 at 1:37 PM, Achim Nierbeck<bc...@googlemail.com>  wrote:
>> Hi Dan,
>>
>> sorry for the belated response :-)
>>
>> if you take a look at the blueprint config or on the excerpt:
>>
>> <!-- Property place holder -->
>> <cm:property-placeholder persistent-id="org.apache.karaf.management"
>> update-strategy="reload">
>> <cm:default-properties>
>> <cm:property name="rmiRegistryPort" value="1099"/>
>> <cm:property name="rmiServerPort" value="44444"/>
>> <cm:property name="jmxRealm" value="karaf"/>
>> <cm:property name="jmxRole" value="$[karaf.admin.role]"/>
>> <cm:property name="serviceUrl"
>> value="service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-$[karaf.name]"/>
>> <cm:property name="daemon" value="true"/>
>> <cm:property name="threaded" value="true"/>
>> <cm:property name="objectName" value="connector:name=rmi"/>
>> </cm:default-properties>
>> </cm:property-placeholder>
>>
>> you'll see that it is managed.
>> So yes if you do change the management.cfg it will be reconfigured. Not
>> restarted.
>>
>>
>> Regards, Achim
>>
>>
>> Am 08.06.2011 17:33, schrieb Dan Tran:
>>> I am too looking for an example on how dynamics configuration work.
>>>   From this conversation, does it mean if I update
>>> org.apache.karaf.management.cfg
>>> o.a.k.management bundle will restart? ( ie connectorFactory will get a
>>> new update of its runtime configuration ? )
>>>
>>> Thanks
>>>
>>> -Dan
>>>
>>>
>>> On Wed, Jun 8, 2011 at 7:58 AM, Achim Nierbeck<bc...@googlemail.com>
>>>   wrote:
>>>> Hi Daniele,
>>>>
>>>> spring-dm is fine too :-)
>>>>
>>>> documentation for spring-dm:
>>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/
>>>> and the configuration admin part
>>>>
>>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm
>>>>
>>>> so I suggest you carefully read the part about how to get your
>>>> configuration injected through the configuration admin.
>>>> the configuration admin itself does get it's properties set through
>>>> the FileInstaller which in turn watches the etc folder for *.cfg
>>>> files.
>>>> So yes you should put your properties in a configuration file in that
>>>> exact directory :-)
>>>>
>>>> But be aware that the properties inside this config need to be of the
>>>> "short" type like key=value, this way it's easier for the
>>>> property placeholder to be able to inject those properties.
>>>>
>>>> Regards, Achim
>>>>
>>>> 2011/6/8 Daniele Dellafiore<da...@dellafiore.net>:
>>>>> On Wed, Jun 8, 2011 at 4:21 PM, Achim Nierbeck<bc...@googlemail.com>
>>>>> wrote:
>>>>>> Short answer, no :-)
>>>>>>
>>>>>> Long answer, you have to take care of that. There are certain ways of
>>>>>> doing this.
>>>>>> 1) write code in your Activator class where you make your Class a
>>>>>> Manageable Class
>>>>>> - for an example of this you might take a look at the pax web stuff :-)
>>>>>> 2) use spring-dm you can use spring xml configurations for doing this
>>>>>> kind of stuff
>>>>>> - see the spring-dm documentation
>>>>>> 3) use blueprint this is the osgi spec compliant version of spring-dm
>>>>>> and again your able to do such in a xml.
>>>>>> - either apache aries documentation or spring-dm 2.0 documentation
>>>>>> which is another reference impl. of blueprint
>>>>>>
>>>>>> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>>>>> I'm using spring-dm for all my bundles so I'll probably try that one
>>>>> first.
>>>>> I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.
>>>>>
>>>>> Generally, in my bundles a simple refresh should just reload everyhing
>>>>> right? So just two more questions:
>>>>>
>>>>> 1. either I can make dynamic reload work or not, is good practice to
>>>>> have a
>>>>> symbolic.name.cfg for all the bundle specific properties? Always better
>>>>> then
>>>>> having properties inside the bundle (that would force me to reinstall
>>>>> the
>>>>> bundle). In that case I tell explicitly the spring PropertyPlaceholder
>>>>> the
>>>>> name of the properties file, I guess that I can reach it with
>>>>>
>>>>> resource="classpath:symbilic.name.cfg"
>>>>>
>>>>> if its at KARAF/etc/symbilic.name.cfg   right?
>>>>>
>>>>> 2. I've googled but I can't find any spring-dm specific docs about this,
>>>>> just some generic blog or archived mails, can you point me to some
>>>>> official
>>>>> doc?
>>>>>
>>>>> Thanks again for the precious clarifications.
>>>>>
>>>>> --
>>>>> Daniele Dellafiore
>>>>> http://danieledellafiore.net
>>>>>
>>>>
>>>> --
>>>> --
>>>> *Achim Nierbeck*
>>>>
>>>>
>>>> Apache Karaf<http://karaf.apache.org/>    Committer&    PMC
>>>> OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>>> Committer&    Project Lead
>>>>
>>


Re: configuring karaf dynamically

Posted by Dan Tran <da...@gmail.com>.
Hi Achim,

Thank you for the response, from my understanding 'reconfigured' will
not send 'connectorFactory' to re-init, this means changes propagated
to 'connectorFactory' beane will not get looked at ( ie MBServer keeps
using the old config ).

is it expected?

Thanks again

-Dan

On Thu, Jun 9, 2011 at 1:37 PM, Achim Nierbeck <bc...@googlemail.com> wrote:
> Hi Dan,
>
> sorry for the belated response :-)
>
> if you take a look at the blueprint config or on the excerpt:
>
> <!-- Property place holder -->
> <cm:property-placeholder persistent-id="org.apache.karaf.management"
> update-strategy="reload">
> <cm:default-properties>
> <cm:property name="rmiRegistryPort" value="1099"/>
> <cm:property name="rmiServerPort" value="44444"/>
> <cm:property name="jmxRealm" value="karaf"/>
> <cm:property name="jmxRole" value="$[karaf.admin.role]"/>
> <cm:property name="serviceUrl"
> value="service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-$[karaf.name]"/>
> <cm:property name="daemon" value="true"/>
> <cm:property name="threaded" value="true"/>
> <cm:property name="objectName" value="connector:name=rmi"/>
> </cm:default-properties>
> </cm:property-placeholder>
>
> you'll see that it is managed.
> So yes if you do change the management.cfg it will be reconfigured. Not
> restarted.
>
>
> Regards, Achim
>
>
> Am 08.06.2011 17:33, schrieb Dan Tran:
>>
>> I am too looking for an example on how dynamics configuration work.
>>  From this conversation, does it mean if I update
>> org.apache.karaf.management.cfg
>> o.a.k.management bundle will restart? ( ie connectorFactory will get a
>> new update of its runtime configuration ? )
>>
>> Thanks
>>
>> -Dan
>>
>>
>> On Wed, Jun 8, 2011 at 7:58 AM, Achim Nierbeck<bc...@googlemail.com>
>>  wrote:
>>>
>>> Hi Daniele,
>>>
>>> spring-dm is fine too :-)
>>>
>>> documentation for spring-dm:
>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/
>>> and the configuration admin part
>>>
>>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm
>>>
>>> so I suggest you carefully read the part about how to get your
>>> configuration injected through the configuration admin.
>>> the configuration admin itself does get it's properties set through
>>> the FileInstaller which in turn watches the etc folder for *.cfg
>>> files.
>>> So yes you should put your properties in a configuration file in that
>>> exact directory :-)
>>>
>>> But be aware that the properties inside this config need to be of the
>>> "short" type like key=value, this way it's easier for the
>>> property placeholder to be able to inject those properties.
>>>
>>> Regards, Achim
>>>
>>> 2011/6/8 Daniele Dellafiore<da...@dellafiore.net>:
>>>>
>>>> On Wed, Jun 8, 2011 at 4:21 PM, Achim Nierbeck<bc...@googlemail.com>
>>>> wrote:
>>>>>
>>>>> Short answer, no :-)
>>>>>
>>>>> Long answer, you have to take care of that. There are certain ways of
>>>>> doing this.
>>>>> 1) write code in your Activator class where you make your Class a
>>>>> Manageable Class
>>>>> - for an example of this you might take a look at the pax web stuff :-)
>>>>> 2) use spring-dm you can use spring xml configurations for doing this
>>>>> kind of stuff
>>>>> - see the spring-dm documentation
>>>>> 3) use blueprint this is the osgi spec compliant version of spring-dm
>>>>> and again your able to do such in a xml.
>>>>> - either apache aries documentation or spring-dm 2.0 documentation
>>>>> which is another reference impl. of blueprint
>>>>>
>>>>> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>>>>
>>>> I'm using spring-dm for all my bundles so I'll probably try that one
>>>> first.
>>>> I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.
>>>>
>>>> Generally, in my bundles a simple refresh should just reload everyhing
>>>> right? So just two more questions:
>>>>
>>>> 1. either I can make dynamic reload work or not, is good practice to
>>>> have a
>>>> symbolic.name.cfg for all the bundle specific properties? Always better
>>>> then
>>>> having properties inside the bundle (that would force me to reinstall
>>>> the
>>>> bundle). In that case I tell explicitly the spring PropertyPlaceholder
>>>> the
>>>> name of the properties file, I guess that I can reach it with
>>>>
>>>> resource="classpath:symbilic.name.cfg"
>>>>
>>>> if its at KARAF/etc/symbilic.name.cfg   right?
>>>>
>>>> 2. I've googled but I can't find any spring-dm specific docs about this,
>>>> just some generic blog or archived mails, can you point me to some
>>>> official
>>>> doc?
>>>>
>>>> Thanks again for the precious clarifications.
>>>>
>>>> --
>>>> Daniele Dellafiore
>>>> http://danieledellafiore.net
>>>>
>>>
>>>
>>> --
>>> --
>>> *Achim Nierbeck*
>>>
>>>
>>> Apache Karaf<http://karaf.apache.org/>  Committer&  PMC
>>> OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>> Committer&  Project Lead
>>>
>
>

Re: configuring karaf dynamically

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Dan,

sorry for the belated response :-)

if you take a look at the blueprint config or on the excerpt:

<!-- Property place holder -->
<cm:property-placeholder persistent-id="org.apache.karaf.management" 
update-strategy="reload">
<cm:default-properties>
<cm:property name="rmiRegistryPort" value="1099"/>
<cm:property name="rmiServerPort" value="44444"/>
<cm:property name="jmxRealm" value="karaf"/>
<cm:property name="jmxRole" value="$[karaf.admin.role]"/>
<cm:property name="serviceUrl" 
value="service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-$[karaf.name]"/>
<cm:property name="daemon" value="true"/>
<cm:property name="threaded" value="true"/>
<cm:property name="objectName" value="connector:name=rmi"/>
</cm:default-properties>
</cm:property-placeholder>

you'll see that it is managed.
So yes if you do change the management.cfg it will be reconfigured. Not 
restarted.


Regards, Achim


Am 08.06.2011 17:33, schrieb Dan Tran:
> I am too looking for an example on how dynamics configuration work.
>  From this conversation, does it mean if I update
> org.apache.karaf.management.cfg
> o.a.k.management bundle will restart? ( ie connectorFactory will get a
> new update of its runtime configuration ? )
>
> Thanks
>
> -Dan
>
>
> On Wed, Jun 8, 2011 at 7:58 AM, Achim Nierbeck<bc...@googlemail.com>  wrote:
>> Hi Daniele,
>>
>> spring-dm is fine too :-)
>>
>> documentation for spring-dm:
>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/
>> and the configuration admin part
>> http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm
>>
>> so I suggest you carefully read the part about how to get your
>> configuration injected through the configuration admin.
>> the configuration admin itself does get it's properties set through
>> the FileInstaller which in turn watches the etc folder for *.cfg
>> files.
>> So yes you should put your properties in a configuration file in that
>> exact directory :-)
>>
>> But be aware that the properties inside this config need to be of the
>> "short" type like key=value, this way it's easier for the
>> property placeholder to be able to inject those properties.
>>
>> Regards, Achim
>>
>> 2011/6/8 Daniele Dellafiore<da...@dellafiore.net>:
>>>
>>> On Wed, Jun 8, 2011 at 4:21 PM, Achim Nierbeck<bc...@googlemail.com>
>>> wrote:
>>>> Short answer, no :-)
>>>>
>>>> Long answer, you have to take care of that. There are certain ways of
>>>> doing this.
>>>> 1) write code in your Activator class where you make your Class a
>>>> Manageable Class
>>>> - for an example of this you might take a look at the pax web stuff :-)
>>>> 2) use spring-dm you can use spring xml configurations for doing this
>>>> kind of stuff
>>>> - see the spring-dm documentation
>>>> 3) use blueprint this is the osgi spec compliant version of spring-dm
>>>> and again your able to do such in a xml.
>>>> - either apache aries documentation or spring-dm 2.0 documentation
>>>> which is another reference impl. of blueprint
>>>>
>>>> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>>>
>>> I'm using spring-dm for all my bundles so I'll probably try that one first.
>>> I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.
>>>
>>> Generally, in my bundles a simple refresh should just reload everyhing
>>> right? So just two more questions:
>>>
>>> 1. either I can make dynamic reload work or not, is good practice to have a
>>> symbolic.name.cfg for all the bundle specific properties? Always better then
>>> having properties inside the bundle (that would force me to reinstall the
>>> bundle). In that case I tell explicitly the spring PropertyPlaceholder the
>>> name of the properties file, I guess that I can reach it with
>>>
>>> resource="classpath:symbilic.name.cfg"
>>>
>>> if its at KARAF/etc/symbilic.name.cfg   right?
>>>
>>> 2. I've googled but I can't find any spring-dm specific docs about this,
>>> just some generic blog or archived mails, can you point me to some official
>>> doc?
>>>
>>> Thanks again for the precious clarifications.
>>>
>>> --
>>> Daniele Dellafiore
>>> http://danieledellafiore.net
>>>
>>
>>
>> --
>> --
>> *Achim Nierbeck*
>>
>>
>> Apache Karaf<http://karaf.apache.org/>  Committer&  PMC
>> OPS4J Pax Web<http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>> Committer&  Project Lead
>>


Re: configuring karaf dynamically

Posted by Dan Tran <da...@gmail.com>.
I am too looking for an example on how dynamics configuration work.
>From this conversation, does it mean if I update
org.apache.karaf.management.cfg
o.a.k.management bundle will restart? ( ie connectorFactory will get a
new update of its runtime configuration ? )

Thanks

-Dan


On Wed, Jun 8, 2011 at 7:58 AM, Achim Nierbeck <bc...@googlemail.com> wrote:
> Hi Daniele,
>
> spring-dm is fine too :-)
>
> documentation for spring-dm:
> http://static.springsource.org/osgi/docs/1.2.1/reference/html/
> and the configuration admin part
> http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm
>
> so I suggest you carefully read the part about how to get your
> configuration injected through the configuration admin.
> the configuration admin itself does get it's properties set through
> the FileInstaller which in turn watches the etc folder for *.cfg
> files.
> So yes you should put your properties in a configuration file in that
> exact directory :-)
>
> But be aware that the properties inside this config need to be of the
> "short" type like key=value, this way it's easier for the
> property placeholder to be able to inject those properties.
>
> Regards, Achim
>
> 2011/6/8 Daniele Dellafiore <da...@dellafiore.net>:
>>
>>
>> On Wed, Jun 8, 2011 at 4:21 PM, Achim Nierbeck <bc...@googlemail.com>
>> wrote:
>>>
>>> Short answer, no :-)
>>>
>>> Long answer, you have to take care of that. There are certain ways of
>>> doing this.
>>> 1) write code in your Activator class where you make your Class a
>>> Manageable Class
>>> - for an example of this you might take a look at the pax web stuff :-)
>>> 2) use spring-dm you can use spring xml configurations for doing this
>>> kind of stuff
>>> - see the spring-dm documentation
>>> 3) use blueprint this is the osgi spec compliant version of spring-dm
>>> and again your able to do such in a xml.
>>> - either apache aries documentation or spring-dm 2.0 documentation
>>> which is another reference impl. of blueprint
>>>
>>> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>>
>>
>> I'm using spring-dm for all my bundles so I'll probably try that one first.
>> I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.
>>
>> Generally, in my bundles a simple refresh should just reload everyhing
>> right? So just two more questions:
>>
>> 1. either I can make dynamic reload work or not, is good practice to have a
>> symbolic.name.cfg for all the bundle specific properties? Always better then
>> having properties inside the bundle (that would force me to reinstall the
>> bundle). In that case I tell explicitly the spring PropertyPlaceholder the
>> name of the properties file, I guess that I can reach it with
>>
>> resource="classpath:symbilic.name.cfg"
>>
>> if its at KARAF/etc/symbilic.name.cfg   right?
>>
>> 2. I've googled but I can't find any spring-dm specific docs about this,
>> just some generic blog or archived mails, can you point me to some official
>> doc?
>>
>> Thanks again for the precious clarifications.
>>
>> --
>> Daniele Dellafiore
>> http://danieledellafiore.net
>>
>
>
>
> --
> --
> *Achim Nierbeck*
>
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> Committer & Project Lead
>

Re: configuring karaf dynamically

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Daniele,

spring-dm is fine too :-)

documentation for spring-dm:
http://static.springsource.org/osgi/docs/1.2.1/reference/html/
and the configuration admin part
http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm

so I suggest you carefully read the part about how to get your
configuration injected through the configuration admin.
the configuration admin itself does get it's properties set through
the FileInstaller which in turn watches the etc folder for *.cfg
files.
So yes you should put your properties in a configuration file in that
exact directory :-)

But be aware that the properties inside this config need to be of the
"short" type like key=value, this way it's easier for the
property placeholder to be able to inject those properties.

Regards, Achim

2011/6/8 Daniele Dellafiore <da...@dellafiore.net>:
>
>
> On Wed, Jun 8, 2011 at 4:21 PM, Achim Nierbeck <bc...@googlemail.com>
> wrote:
>>
>> Short answer, no :-)
>>
>> Long answer, you have to take care of that. There are certain ways of
>> doing this.
>> 1) write code in your Activator class where you make your Class a
>> Manageable Class
>> - for an example of this you might take a look at the pax web stuff :-)
>> 2) use spring-dm you can use spring xml configurations for doing this
>> kind of stuff
>> - see the spring-dm documentation
>> 3) use blueprint this is the osgi spec compliant version of spring-dm
>> and again your able to do such in a xml.
>> - either apache aries documentation or spring-dm 2.0 documentation
>> which is another reference impl. of blueprint
>>
>> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>
>
> I'm using spring-dm for all my bundles so I'll probably try that one first.
> I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.
>
> Generally, in my bundles a simple refresh should just reload everyhing
> right? So just two more questions:
>
> 1. either I can make dynamic reload work or not, is good practice to have a
> symbolic.name.cfg for all the bundle specific properties? Always better then
> having properties inside the bundle (that would force me to reinstall the
> bundle). In that case I tell explicitly the spring PropertyPlaceholder the
> name of the properties file, I guess that I can reach it with
>
> resource="classpath:symbilic.name.cfg"
>
> if its at KARAF/etc/symbilic.name.cfg   right?
>
> 2. I've googled but I can't find any spring-dm specific docs about this,
> just some generic blog or archived mails, can you point me to some official
> doc?
>
> Thanks again for the precious clarifications.
>
> --
> Daniele Dellafiore
> http://danieledellafiore.net
>



-- 
--
*Achim Nierbeck*


Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead

Re: configuring karaf dynamically

Posted by Daniele Dellafiore <da...@dellafiore.net>.
On Wed, Jun 8, 2011 at 4:21 PM, Achim Nierbeck <bc...@googlemail.com>wrote:

> Short answer, no :-)
>
> Long answer, you have to take care of that. There are certain ways of
> doing this.
> 1) write code in your Activator class where you make your Class a
> Manageable Class
> - for an example of this you might take a look at the pax web stuff :-)
> 2) use spring-dm you can use spring xml configurations for doing this
> kind of stuff
> - see the spring-dm documentation
> 3) use blueprint this is the osgi spec compliant version of spring-dm
> and again your able to do such in a xml.
> - either apache aries documentation or spring-dm 2.0 documentation
> which is another reference impl. of blueprint
>
> I'd prefer 3 since it's the easier one and OSGi spec compliant :-)
>


I'm using spring-dm for all my bundles so I'll probably try that one first.
I'm using spring-dm 1.2.1 that's shipped with karaf 2.2.

Generally, in my bundles a simple refresh should just reload everyhing
right? So just two more questions:

1. either I can make dynamic reload work or not, is good practice to have a
symbolic.name.cfg for all the bundle specific properties? Always better then
having properties inside the bundle (that would force me to reinstall the
bundle). In that case I tell explicitly the spring PropertyPlaceholder the
name of the properties file, I guess that I can reach it with

resource="classpath:symbilic.name.cfg"

if its at KARAF/etc/symbilic.name.cfg   right?

2. I've googled but I can't find any spring-dm specific docs about this,
just some generic blog or archived mails, can you point me to some official
doc?

Thanks again for the precious clarifications.

-- 
Daniele Dellafiore
http://danieledellafiore.net

Re: configuring karaf dynamically

Posted by Achim Nierbeck <bc...@googlemail.com>.
Short answer, no :-)

Long answer, you have to take care of that. There are certain ways of
doing this.
1) write code in your Activator class where you make your Class a
Manageable Class
- for an example of this you might take a look at the pax web stuff :-)
2) use spring-dm you can use spring xml configurations for doing this
kind of stuff
- see the spring-dm documentation
3) use blueprint this is the osgi spec compliant version of spring-dm
and again your able to do such in a xml.
- either apache aries documentation or spring-dm 2.0 documentation
which is another reference impl. of blueprint

I'd prefer 3 since it's the easier one and OSGi spec compliant :-)

Regards, Achim


2011/6/8 Daniele Dellafiore <da...@dellafiore.net>:
> that's nice.
>
> Does that happen automagivcally for any bundle?
> So for example I have a bundle with symbolic name "mybundle" and I have a
> mybundle.cfg with some properties, and I change the properties with
> config:edit, everything is changed accordingly?
>
> On Tue, Jun 7, 2011 at 12:40 PM, Achim Nierbeck <bc...@googlemail.com>
> wrote:
>>
>> Hi,
>>
>> well first of all if you change the configuration you don't need to
>> restart any bundle.
>> The Pax Web bundles are configuration managed. That means if you change
>> something the Pax Web Service is restarted.
>> Restarting the jetty bundle doesn't help at all since pax web is the one
>> in charge of everything.
>>
>> I suggest you also take a look at
>> http://ops4j1.jira.com/wiki/display/paxweb/Pax+Web
>> to  get a better understanding on how it works.
>>
>> If anything is still unclear feel free to ask :-)
>>
>> regards, Achim
>>
>>
>> 2011/6/7 Daniele Dellafiore <da...@dellafiore.net>:
>> > also, this is strange.
>> > I moved   org.osgi.service.http.port = 8181
>> > to 80 from config:edit and restarted jetty bundle. It worked: 8181
>> > does not answer.
>> > Now I've moved 80 back to 8181 and yet does not answer... what's
>> > happening?
>> >
>> > I thing that restarting the jetty http bundle it's enough, isn't it?
>> >
>> > ah, I've org.osgi.service.http.port = 8181  also in
>> > org.ops4j.pax.web.cfg is that right?
>> >
>> > On Tue, Jun 7, 2011 at 11:22 AM, Achim Nierbeck
>> > <bc...@googlemail.com> wrote:
>> >> Hi Daniele,
>> >>
>> >> you need to create a configuration file for pax-web this would be
>> >>
>> >> etc/org.ops4j.pax.web.cfg
>> >>
>> >> the *.cfg files are picked up through the FileInstaller bundle which in
>> >> turn
>> >> uses those to configure the config admin service.
>> >> In your case since you installed the http feature through the
>> >> the shell
>> >>
>> >> features:install http
>> >>
>> >> you have a default configuration which is already available to the
>> >> configuration admin service through the installation of the feature.
>> >> You might also do a
>> >> features:info http
>> >> to see which configuration is already connected to it.
>> >>
>> >> To make it short you need a config file that
>> >> needs to look like the PID (Persistent ID - of a service) with an
>> >> attached .cfg for being picked up.
>> >>
>> >> regards, Achim
>> >>
>> >>
>> >> 2011/6/7 Daniele Dellafiore <il...@gmail.com>:
>> >>> Hi. I've some problem in understanding how karaf dynamic configuration
>> >>> works from
>> >>> https://cwiki.apache.org/KARAF/48-configuration.html
>> >>>
>> >>> Now if I do a config:list on my karaf, i can't see a lot of properties
>> >>> I've set in etc/config.properties, for examples, like all http service
>> >>> properties (host name, ports...)
>> >>>
>> >>> For example I've added these lines at the end of etc/config.properties
>> >>>
>> >>> org.osgi.service.http.port=8181
>> >>> org.osgi.service.http.secure.enabled=true
>> >>> org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
>> >>> org.ops4j.pax.web.ssl.password=xxx
>> >>> org.ops4j.pax.web.ssl.keypassword=xxx
>> >>> org.osgi.service.http.port.secure=443
>> >>>
>> >>> but how can I See them from the config editor?
>> >>> Also, I'm not completely sure on where is right to put those
>> >>> properties, for example the HTTPS config, as for,
>> >>> http://wiki.ops4j.org/display/paxweb/SSL+Configuration
>> >>>
>> >>> the file where to write is not specified. It seems to me that
>> >>> config.properties works, but I think that all the properties files
>> >>> under etc are read, right? So there's some kind of hierarchy? Where's
>> >>> that explained? In fact I can't be sure if it works. Example, if a
>> >>> serve answer correctly at
>> >>>
>> >>> http://domain:8181/app/signin
>> >>>
>> >>> should it also answer at
>> >>>
>> >>> https://domain/app/signin
>> >>>
>> >>> Cause in my situation, it does not.
>> >>>
>> >>> Also, talking about ports, I've tried to change 8181 into 80 but my
>> >>> http bundles now does not answer neither on 80 or 8181. Maybe is a
>> >>> firewall problem but it's a practice you recommend? I mean, I do want
>> >>> http on 80, and I do not want to put some apache proxy behind Karaf,
>> >>> so I can't figure out any other way than changing the http service
>> >>> port there, is correct?
>> >>>
>> >>> Finally, do you recommend me a book on Karaf? I already had OSGi in
>> >>> Action but maybe Karaf in action (or such)  can be good for me.
>> >>>
>> >>>
>> >>> Thanks for any support.
>> >>>
>> >>>
>> >>> --
>> >>> Daniele Dellafiore
>> >>> http://danieledellafiore.net
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> --
>> >> *Achim Nierbeck*
>> >>
>> >>
>> >> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> >> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>> >> Committer & Project Lead
>> >>
>> >
>>
>>
>>
>> --
>> --
>> *Achim Nierbeck*
>>
>>
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>> Committer & Project Lead
>
>
>
> --
> Daniele Dellafiore
> http://danieledellafiore.net
>



-- 
--
*Achim Nierbeck*


Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead

Re: configuring karaf dynamically

Posted by Daniele Dellafiore <da...@dellafiore.net>.
that's nice.

Does that happen automagivcally for any bundle?
So for example I have a bundle with symbolic name "mybundle" and I have a
mybundle.cfg with some properties, and I change the properties with
config:edit, everything is changed accordingly?

On Tue, Jun 7, 2011 at 12:40 PM, Achim Nierbeck <bc...@googlemail.com>wrote:

> Hi,
>
> well first of all if you change the configuration you don't need to
> restart any bundle.
> The Pax Web bundles are configuration managed. That means if you change
> something the Pax Web Service is restarted.
> Restarting the jetty bundle doesn't help at all since pax web is the one
> in charge of everything.
>
> I suggest you also take a look at
> http://ops4j1.jira.com/wiki/display/paxweb/Pax+Web
> to  get a better understanding on how it works.
>
> If anything is still unclear feel free to ask :-)
>
> regards, Achim
>
>
> 2011/6/7 Daniele Dellafiore <da...@dellafiore.net>:
> > also, this is strange.
> > I moved   org.osgi.service.http.port = 8181
> > to 80 from config:edit and restarted jetty bundle. It worked: 8181
> > does not answer.
> > Now I've moved 80 back to 8181 and yet does not answer... what's
> happening?
> >
> > I thing that restarting the jetty http bundle it's enough, isn't it?
> >
> > ah, I've org.osgi.service.http.port = 8181  also in
> > org.ops4j.pax.web.cfg is that right?
> >
> > On Tue, Jun 7, 2011 at 11:22 AM, Achim Nierbeck <bc...@googlemail.com>
> wrote:
> >> Hi Daniele,
> >>
> >> you need to create a configuration file for pax-web this would be
> >>
> >> etc/org.ops4j.pax.web.cfg
> >>
> >> the *.cfg files are picked up through the FileInstaller bundle which in
> turn
> >> uses those to configure the config admin service.
> >> In your case since you installed the http feature through the
> >> the shell
> >>
> >> features:install http
> >>
> >> you have a default configuration which is already available to the
> >> configuration admin service through the installation of the feature.
> >> You might also do a
> >> features:info http
> >> to see which configuration is already connected to it.
> >>
> >> To make it short you need a config file that
> >> needs to look like the PID (Persistent ID - of a service) with an
> >> attached .cfg for being picked up.
> >>
> >> regards, Achim
> >>
> >>
> >> 2011/6/7 Daniele Dellafiore <il...@gmail.com>:
> >>> Hi. I've some problem in understanding how karaf dynamic configuration
> >>> works from
> >>> https://cwiki.apache.org/KARAF/48-configuration.html
> >>>
> >>> Now if I do a config:list on my karaf, i can't see a lot of properties
> >>> I've set in etc/config.properties, for examples, like all http service
> >>> properties (host name, ports...)
> >>>
> >>> For example I've added these lines at the end of etc/config.properties
> >>>
> >>> org.osgi.service.http.port=8181
> >>> org.osgi.service.http.secure.enabled=true
> >>> org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
> >>> org.ops4j.pax.web.ssl.password=xxx
> >>> org.ops4j.pax.web.ssl.keypassword=xxx
> >>> org.osgi.service.http.port.secure=443
> >>>
> >>> but how can I See them from the config editor?
> >>> Also, I'm not completely sure on where is right to put those
> >>> properties, for example the HTTPS config, as for,
> >>> http://wiki.ops4j.org/display/paxweb/SSL+Configuration
> >>>
> >>> the file where to write is not specified. It seems to me that
> >>> config.properties works, but I think that all the properties files
> >>> under etc are read, right? So there's some kind of hierarchy? Where's
> >>> that explained? In fact I can't be sure if it works. Example, if a
> >>> serve answer correctly at
> >>>
> >>> http://domain:8181/app/signin
> >>>
> >>> should it also answer at
> >>>
> >>> https://domain/app/signin
> >>>
> >>> Cause in my situation, it does not.
> >>>
> >>> Also, talking about ports, I've tried to change 8181 into 80 but my
> >>> http bundles now does not answer neither on 80 or 8181. Maybe is a
> >>> firewall problem but it's a practice you recommend? I mean, I do want
> >>> http on 80, and I do not want to put some apache proxy behind Karaf,
> >>> so I can't figure out any other way than changing the http service
> >>> port there, is correct?
> >>>
> >>> Finally, do you recommend me a book on Karaf? I already had OSGi in
> >>> Action but maybe Karaf in action (or such)  can be good for me.
> >>>
> >>>
> >>> Thanks for any support.
> >>>
> >>>
> >>> --
> >>> Daniele Dellafiore
> >>> http://danieledellafiore.net
> >>>
> >>
> >>
> >>
> >> --
> >> --
> >> *Achim Nierbeck*
> >>
> >>
> >> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> >> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> >> Committer & Project Lead
> >>
> >
>
>
>
> --
> --
> *Achim Nierbeck*
>
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> Committer & Project Lead
>



-- 
Daniele Dellafiore
http://danieledellafiore.net

Re: configuring karaf dynamically

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

well first of all if you change the configuration you don't need to
restart any bundle.
The Pax Web bundles are configuration managed. That means if you change
something the Pax Web Service is restarted.
Restarting the jetty bundle doesn't help at all since pax web is the one
in charge of everything.

I suggest you also take a look at
http://ops4j1.jira.com/wiki/display/paxweb/Pax+Web
to  get a better understanding on how it works.

If anything is still unclear feel free to ask :-)

regards, Achim


2011/6/7 Daniele Dellafiore <da...@dellafiore.net>:
> also, this is strange.
> I moved   org.osgi.service.http.port = 8181
> to 80 from config:edit and restarted jetty bundle. It worked: 8181
> does not answer.
> Now I've moved 80 back to 8181 and yet does not answer... what's happening?
>
> I thing that restarting the jetty http bundle it's enough, isn't it?
>
> ah, I've org.osgi.service.http.port = 8181  also in
> org.ops4j.pax.web.cfg is that right?
>
> On Tue, Jun 7, 2011 at 11:22 AM, Achim Nierbeck <bc...@googlemail.com> wrote:
>> Hi Daniele,
>>
>> you need to create a configuration file for pax-web this would be
>>
>> etc/org.ops4j.pax.web.cfg
>>
>> the *.cfg files are picked up through the FileInstaller bundle which in turn
>> uses those to configure the config admin service.
>> In your case since you installed the http feature through the
>> the shell
>>
>> features:install http
>>
>> you have a default configuration which is already available to the
>> configuration admin service through the installation of the feature.
>> You might also do a
>> features:info http
>> to see which configuration is already connected to it.
>>
>> To make it short you need a config file that
>> needs to look like the PID (Persistent ID - of a service) with an
>> attached .cfg for being picked up.
>>
>> regards, Achim
>>
>>
>> 2011/6/7 Daniele Dellafiore <il...@gmail.com>:
>>> Hi. I've some problem in understanding how karaf dynamic configuration
>>> works from
>>> https://cwiki.apache.org/KARAF/48-configuration.html
>>>
>>> Now if I do a config:list on my karaf, i can't see a lot of properties
>>> I've set in etc/config.properties, for examples, like all http service
>>> properties (host name, ports...)
>>>
>>> For example I've added these lines at the end of etc/config.properties
>>>
>>> org.osgi.service.http.port=8181
>>> org.osgi.service.http.secure.enabled=true
>>> org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
>>> org.ops4j.pax.web.ssl.password=xxx
>>> org.ops4j.pax.web.ssl.keypassword=xxx
>>> org.osgi.service.http.port.secure=443
>>>
>>> but how can I See them from the config editor?
>>> Also, I'm not completely sure on where is right to put those
>>> properties, for example the HTTPS config, as for,
>>> http://wiki.ops4j.org/display/paxweb/SSL+Configuration
>>>
>>> the file where to write is not specified. It seems to me that
>>> config.properties works, but I think that all the properties files
>>> under etc are read, right? So there's some kind of hierarchy? Where's
>>> that explained? In fact I can't be sure if it works. Example, if a
>>> serve answer correctly at
>>>
>>> http://domain:8181/app/signin
>>>
>>> should it also answer at
>>>
>>> https://domain/app/signin
>>>
>>> Cause in my situation, it does not.
>>>
>>> Also, talking about ports, I've tried to change 8181 into 80 but my
>>> http bundles now does not answer neither on 80 or 8181. Maybe is a
>>> firewall problem but it's a practice you recommend? I mean, I do want
>>> http on 80, and I do not want to put some apache proxy behind Karaf,
>>> so I can't figure out any other way than changing the http service
>>> port there, is correct?
>>>
>>> Finally, do you recommend me a book on Karaf? I already had OSGi in
>>> Action but maybe Karaf in action (or such)  can be good for me.
>>>
>>>
>>> Thanks for any support.
>>>
>>>
>>> --
>>> Daniele Dellafiore
>>> http://danieledellafiore.net
>>>
>>
>>
>>
>> --
>> --
>> *Achim Nierbeck*
>>
>>
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>> Committer & Project Lead
>>
>



-- 
--
*Achim Nierbeck*


Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead

Re: configuring karaf dynamically

Posted by Daniele Dellafiore <da...@dellafiore.net>.
also, this is strange.
I moved   org.osgi.service.http.port = 8181
to 80 from config:edit and restarted jetty bundle. It worked: 8181
does not answer.
Now I've moved 80 back to 8181 and yet does not answer... what's happening?

I thing that restarting the jetty http bundle it's enough, isn't it?

ah, I've org.osgi.service.http.port = 8181  also in
org.ops4j.pax.web.cfg is that right?

On Tue, Jun 7, 2011 at 11:22 AM, Achim Nierbeck <bc...@googlemail.com> wrote:
> Hi Daniele,
>
> you need to create a configuration file for pax-web this would be
>
> etc/org.ops4j.pax.web.cfg
>
> the *.cfg files are picked up through the FileInstaller bundle which in turn
> uses those to configure the config admin service.
> In your case since you installed the http feature through the
> the shell
>
> features:install http
>
> you have a default configuration which is already available to the
> configuration admin service through the installation of the feature.
> You might also do a
> features:info http
> to see which configuration is already connected to it.
>
> To make it short you need a config file that
> needs to look like the PID (Persistent ID - of a service) with an
> attached .cfg for being picked up.
>
> regards, Achim
>
>
> 2011/6/7 Daniele Dellafiore <il...@gmail.com>:
>> Hi. I've some problem in understanding how karaf dynamic configuration
>> works from
>> https://cwiki.apache.org/KARAF/48-configuration.html
>>
>> Now if I do a config:list on my karaf, i can't see a lot of properties
>> I've set in etc/config.properties, for examples, like all http service
>> properties (host name, ports...)
>>
>> For example I've added these lines at the end of etc/config.properties
>>
>> org.osgi.service.http.port=8181
>> org.osgi.service.http.secure.enabled=true
>> org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
>> org.ops4j.pax.web.ssl.password=xxx
>> org.ops4j.pax.web.ssl.keypassword=xxx
>> org.osgi.service.http.port.secure=443
>>
>> but how can I See them from the config editor?
>> Also, I'm not completely sure on where is right to put those
>> properties, for example the HTTPS config, as for,
>> http://wiki.ops4j.org/display/paxweb/SSL+Configuration
>>
>> the file where to write is not specified. It seems to me that
>> config.properties works, but I think that all the properties files
>> under etc are read, right? So there's some kind of hierarchy? Where's
>> that explained? In fact I can't be sure if it works. Example, if a
>> serve answer correctly at
>>
>> http://domain:8181/app/signin
>>
>> should it also answer at
>>
>> https://domain/app/signin
>>
>> Cause in my situation, it does not.
>>
>> Also, talking about ports, I've tried to change 8181 into 80 but my
>> http bundles now does not answer neither on 80 or 8181. Maybe is a
>> firewall problem but it's a practice you recommend? I mean, I do want
>> http on 80, and I do not want to put some apache proxy behind Karaf,
>> so I can't figure out any other way than changing the http service
>> port there, is correct?
>>
>> Finally, do you recommend me a book on Karaf? I already had OSGi in
>> Action but maybe Karaf in action (or such)  can be good for me.
>>
>>
>> Thanks for any support.
>>
>>
>> --
>> Daniele Dellafiore
>> http://danieledellafiore.net
>>
>
>
>
> --
> --
> *Achim Nierbeck*
>
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> Committer & Project Lead
>

Re: configuring karaf dynamically

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Daniele,

you need to create a configuration file for pax-web this would be

etc/org.ops4j.pax.web.cfg

the *.cfg files are picked up through the FileInstaller bundle which in turn
uses those to configure the config admin service.
In your case since you installed the http feature through the
the shell

features:install http

you have a default configuration which is already available to the
configuration admin service through the installation of the feature.
You might also do a
features:info http
to see which configuration is already connected to it.

To make it short you need a config file that
needs to look like the PID (Persistent ID - of a service) with an
attached .cfg for being picked up.

regards, Achim


2011/6/7 Daniele Dellafiore <il...@gmail.com>:
> Hi. I've some problem in understanding how karaf dynamic configuration
> works from
> https://cwiki.apache.org/KARAF/48-configuration.html
>
> Now if I do a config:list on my karaf, i can't see a lot of properties
> I've set in etc/config.properties, for examples, like all http service
> properties (host name, ports...)
>
> For example I've added these lines at the end of etc/config.properties
>
> org.osgi.service.http.port=8181
> org.osgi.service.http.secure.enabled=true
> org.ops4j.pax.web.ssl.keystore=${karaf.base}/keystore
> org.ops4j.pax.web.ssl.password=xxx
> org.ops4j.pax.web.ssl.keypassword=xxx
> org.osgi.service.http.port.secure=443
>
> but how can I See them from the config editor?
> Also, I'm not completely sure on where is right to put those
> properties, for example the HTTPS config, as for,
> http://wiki.ops4j.org/display/paxweb/SSL+Configuration
>
> the file where to write is not specified. It seems to me that
> config.properties works, but I think that all the properties files
> under etc are read, right? So there's some kind of hierarchy? Where's
> that explained? In fact I can't be sure if it works. Example, if a
> serve answer correctly at
>
> http://domain:8181/app/signin
>
> should it also answer at
>
> https://domain/app/signin
>
> Cause in my situation, it does not.
>
> Also, talking about ports, I've tried to change 8181 into 80 but my
> http bundles now does not answer neither on 80 or 8181. Maybe is a
> firewall problem but it's a practice you recommend? I mean, I do want
> http on 80, and I do not want to put some apache proxy behind Karaf,
> so I can't figure out any other way than changing the http service
> port there, is correct?
>
> Finally, do you recommend me a book on Karaf? I already had OSGi in
> Action but maybe Karaf in action (or such)  can be good for me.
>
>
> Thanks for any support.
>
>
> --
> Daniele Dellafiore
> http://danieledellafiore.net
>



-- 
--
*Achim Nierbeck*


Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead