Hi > Am 04.06.2017 um 14:02 schrieb Mark Raynsford <list+org.o...@io7m.com>: > > On 2017-06-04T13:04:12 +0200 > Felix Meschberger <fmesc...@gmail.com> wrote: > >> Hi Mark >> >> I assume your configurator is creating the configuraiton with: >> >>> final Configuration config = >>> this.configurations.getConfiguration( >>> "com.io7m.callisto.stringtables.main.provider“) >> >> If this is the case, this new configuration is bound to the configurator’s >> bundle, which IIUIC is the same bundle also containing the Example component. > > I see. > >> Thus the Example component gets the configuration being in the same bundle, >> but the provider does not as it is in another bundle. >> >> You might want to try to use the two-parameter getConfiguration method using >> null (no location) as the second parameter to make sure the configuration is >> not bound at the time of creation — but later when it is first provided to >> the consumer >> > > Yes, this worked! Thanks. > > I have to admit, I'm not exactly sure what's happening here.
When a configuration is created it is either unbound, explicitly bound, or implicitly bound to a consuming bundle (in later specs, the location may be sort of a pattern to bind to multiple bundles, but originally it was intended to be the Bundle’s Location property). Using the single value getConfiguration method creates a configuration which is implicitly bound to the bundle of the caller if the configuration does not exist yet. Using the two parameter method, will either create an unbound configuration when using null or an explicitly bound configuration, when using a non-null location. This two-parameter version is primarily intended for „management bundles“. As those bundles must make sure to create configuration which can properly assigned to consumers. > The R6 > compendium spec mentions that location binding is a security feature > (104.4.1), but it then uses terms like "management bundle" without > actually explaining what that is. Well, in general application code should care to consume configuration and not to create configuration. The specification designates special bundles which are used to manage aspects of an application such as configuration, as management bundles. In your example, your „configurer“ makes part of a management bundle. Management bundles should be conscious to location binding of configuration. Regards Felix > > M > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev