You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Guenther Schmidt <sc...@gmail.com> on 2017/12/13 00:20:19 UTC

Blueprint and managed Services

Hello,

how do I set the system.pid for a service that needs to receive its 
configuration data from the OSGi container using Blueprint?

Guenther


Re: Blueprint and managed Services

Posted by Guenther Schmidt <sc...@gmail.com>.
Hello Guillaume,

thank you very much, your answers have been very helpful. With 
update-strategy="component-manged" I do get what I want. I have not 
tested if the configuration of the service implementation is set at 
least before the service is used. The configuration has been "deposited" 
before the bundle was installed.

Guenther

PS: I have tried to find the answers of my own, but as far as "official" 
document goes it seems a bit sparse ...



Am 12/13/2017 um 4:44 PM schrieb Guillaume Nodet:
> Blueprint does not call setters while the beans are created, so your 
> code does not need to care about changes.
> What happens is that if the configuration changes, the whole blueprint 
> application will be refreshed.
>
> 2017-12-13 22:45 GMT+01:00 Guenther Schmidt <schmig68@gmail.com 
> <ma...@gmail.com>>:
>
>     Hello Guillaume,
>
>     thank you very much.
>
>     I had hoped for an example where a change of several values is
>     transmitted in one go, much like ManagedService.
>
>     Having configuration values change individually requires me to do
>     quite a bit of reprogramming as right now my code expects all of
>     these values to change atomically.
>
>     Guenther
>
>
>
>
> -- 
> ------------------------
> Guillaume Nodet
>


Re: Blueprint and managed Services

Posted by Guillaume Nodet <gn...@apache.org>.
Blueprint does not call setters while the beans are created, so your code
does not need to care about changes.
What happens is that if the configuration changes, the whole blueprint
application will be refreshed.

2017-12-13 22:45 GMT+01:00 Guenther Schmidt <sc...@gmail.com>:

> Hello Guillaume,
>
> thank you very much.
>
> I had hoped for an example where a change of several values is transmitted
> in one go, much like ManagedService.
>
> Having configuration values change individually requires me to do quite a
> bit of reprogramming as right now my code expects all of these values to
> change atomically.
>
> Guenther
>



-- 
------------------------
Guillaume Nodet

Re: Blueprint and managed Services

Posted by Guillaume Nodet <gn...@apache.org>.
Here's a typical example of using configuration in blueprint:

https://github.com/apache/karaf/blob/karaf-2.x/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml

The pid of the configuration is defined using the persistent-id attribute:

https://github.com/apache/karaf/blob/karaf-2.x/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml#L37

and properties are used inside values such as:

https://github.com/apache/karaf/blob/karaf-2.x/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml#L76

Cheers,
Guillaume Nodet


2017-12-13 1:20 GMT+01:00 Guenther Schmidt <sc...@gmail.com>:

> Hello,
>
> how do I set the system.pid for a service that needs to receive its
> configuration data from the OSGi container using Blueprint?
>
> Guenther
>
>


-- 
------------------------
Guillaume Nodet