Something similar would be create a bundle that reads a config file, with
getProperty as a interface function, and then expose the class as a service
that can be used by other bundles in reference.

This would be a quick way to accomplish this functionality .

On Fri, Sep 25, 2015, 5:38 AM Kevin Carr <[email protected]> wrote:

> I have created a configuration that pulls from a db every 5 minutes.  The
> bundle creates a isgconfig service for each entry in the configuration file.
>
> The config service is a regular osgi bundle that can be referenced by any
> bundle in the system.  This works really well for centralized configuration.
>
> I will see about putting what I have in github.  I will have to talk to my
> boss about releasing it first.
>
> On Fri, Sep 25, 2015, 5:33 AM Arnaud Deprez <[email protected]> wrote:
>
>> Hi,
>>
>> @JP: The problem is not using 2 property placeholder, but sharing one
>> property placeholder across multiple bundles. And in that case, it seems
>> that we have to avoid it because it can cause trouble to the Config Admin
>> due to concurrency issues (it's actually what I read, I didn't take a look
>> to the code).
>>
>> @Christian: Thanks for your answer. I actually had the same idea but I'm
>> a guy who is looking for icing by using Config Admin with its dynamical
>> behavior :-). But if there is no other solution, I'll go to that direction.
>>
>> On Fri, Sep 25, 2015 at 11:34 AM Christian Schneider <
>> [email protected]> wrote:
>>
>>> You can use the <ext:property-placeholder placeholder-prefix="$["
>>> placeholder-suffix="]"/>
>>> It allows access to the System.properties and use it for shared config.
>>> See:
>>> https://github.com/apache/karaf/blob/karaf-3.0.x/bundle/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>>>
>>> It can be used together with a cm:property-placeholder that contains
>>> bundle specific config from config admin.
>>>
>>> One problem is that the System properties do not support updates in case
>>> of changes. So you can only use it for relatively fixed configs.
>>>
>>>
>>> Christian
>>>
>>>
>>> Am 25.09.2015 um 10:04 schrieb Arnaud Deprez:
>>>
>>> Hi folks,
>>>
>>> I would like to have your opinion about my needs.
>>> I've several bundles which all need their custom configuration (own PID)
>>> but all of them depends on some common configuration depending on which
>>> environment (ie: test, production) my karaf instance is running.
>>>
>>> I'm currently using apache blueprint. So I would like to do is for
>>> example, if I use [[env.name]] it will retrieve the config value from
>>> global configuration and if I use {{bundle.name}}.
>>>
>>> So my questions is :
>>> Is there a way to use common/global configuration with my current bundle
>>> configuration ?
>>> If yes, is it possible with blueprint or do I have to change my tech
>>> stack ?
>>> What are best practices ?
>>> And icing on the cake, do you have example ?
>>>
>>> Rgds,
>>>
>>> Arnaud
>>>
>>>
>>>

Reply via email to