karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leschke, Scott" <SLesc...@medline.com>
Subject RE: [osgi-dev] Create instance of factory configuration at runtime
Date Wed, 13 Dec 2017 21:24:47 GMT
Hey Tim,

Thanks for this. Yes that worked. I recall seeing something about this a number of months
ago but didn’t pay much attention since it didn’t apply to me at the time. Not sure why
I didn’t think to give that a try though.

Two additional questions for anybody who cares to answer.

1)      If “?” isn’t used, what would the location argument look like?  Is it like a
bundle symbolic id, with wildcards perhaps? It’s unclear to me how this would be used even
if you wanted to.

2)      Now for a Karaf question to any/all takers. When a service instance is created this
way, is there a way to associate a .cfg file with it so that the service configuration will
persist across Karaf upgrades?  I know that if a Configuration record is updated, the service’s
corresponding .cfg file is updated, but if you create a new service, you don’t get a .cfg


From: Tim Ward [mailto:tim.ward@paremus.com]
Sent: Saturday, December 09, 2017 3:04 AM
To: Leschke, Scott; OSGi Developer Mail List
Subject: Re: [osgi-dev] Create instance of factory configuration at runtime

Hi Scott,

That does work, but Configuration Admin has an old feature called location binding. This feature
prevents a configuration being delivered to bundles other than the bundle with the specified
bundle location.

The one-arg version of createFactoryConfiguration that you’re using defaults the bundle
location to the location of the bundle which got the ConfigurationAdmin service instance that
you’re using. This is almost never the correct location as it usually means only the management
bundle can see your configuration.

The location binding behaviour is so annoying that the general recommendation is to disable
it by using the two arg versions of Config Admin methods with a wildcard location binding
(a “?”).

My guess is that the two arg version will give you what you’re looking for.

Sent from my iPhone

On 9 Dec 2017, at 00:36, Leschke, Scott via osgi-dev <osgi-dev@mail.osgi.org<mailto:osgi-dev@mail.osgi.org>>
How does one create a new instance of a factory configuration programmatically?

I thought it was like

ConfigurationAdmin ca;

but that doesn’t seem to work for me.

Thanks in advance,

OSGi Developer Mail List
View raw message