bnd solves the "I am implementing A but I am really a client" problem with an
annotation:
aQute.bnd.annotation.UsePolicy
For each import statement, bnd calculates how the bundle uses this. If it finds
any classes that implement an interface for an import then it assumes the
bundle "implements" the imported package, otherwise it uses this imported
package.
If bnd calculates the import version it applies either the -versionpolicy-impl
property or -versionpolicy-uses property as the version policy. If neither are
set, it uses the version policy for uses and it has (recently, like today) hard
coded the implementation policy.
If you annotate an interface with @UsePolicy bnd will treat implementers as
users. The burden is however on you. If you change such an interface the
consequence is that you need a major bump of the version, unlike interfaces
that are not marked.
Kind regards,
Peter Kriens
On 6 mei 2010, at 20:25, David Bosschaert wrote:
>>> Here's a really short summary of some of the content...
>>> * Let's say you have an interface X version 1.2 that you modify to
>>> include a new method. This would break backwards compatibility for
>>> people who implement this interface. Whether this will bump the
>>> version to 1.3 or 2.0 depends on who typically implements this
>>> interface:
>>> + If the interface is normally implemented by framework implementors
>>> (including compendium spec implementors), the version should bump to
>>> 1.3. This is because the new interface is still compatible with users
>>> of it.
>>> + If the interface is normally implemented by user bundles, the
>>> version should bump to 2.0 as the change is likely to change user
>>> builds.
>>
>> Maybe I misunderstand this, but I thought that recent bnd's (not yet in
>> maven-bundle-plugin despite my best efforts) were based on the idea that
>> you'd bump the version to 1.3, and
>> - using bundles would import with a version range of [1.2,2)
>> - implementing bundles would import with a version range of [1.2,1.3)
>
> True, but the missing piece of information here is that using bundles
> sometimes also implement an interface (the Whiteboard Pattern). Take
> for example the Configuration Admin Service org.osgi.service.cm
> package version 1.3. In there you find a ConfigurationAdmin interface
> which is implemented by framework/spec implementors, while its
> ManagedService is implemented by users. Hence adding a method to the
> ConfigurationAdmin interface will only change the version of the
> package to 1.4. But adding a method to ManagedService will change it
> to 2.0
>
> Best regards,
>
> David