Very good question. This is why we distinguish between "provider
implemented" and "consumer implemented" interfaces. Usually to a developer
the role of the interface is clear, as you have intuitively grasped:
interfaces that are merely callbacks or listeners are generally "consumer
implemented". In bnd we have two annotations @ProviderType and
@ConsumerType that we place on the interface that allows the tooling to
detect the role of the interface and generate the correct import range.

So the rule is, your bundle is a provider of the API if it implements any
of the "provider implemented" types. Otherwise it is a consumer.

Neil

On Wed, Jan 16, 2013 at 2:58 PM, Martin Ždila <[email protected]> wrote:

> Hello
>
> How can I distinguish whether some bundle is API consumer or provider?
>
> I need it to specify correct Import-Package version range.
>
> Is the bundle automatically provider if it implements any interface
> from imported package, even interfaces like listeners and others that
> seems to be more consumer-like?
>
> I am asking because we are using Configuration Admin implementation of
> version 1.5 but we have many bundles that implements
> ManagedServiceFactory from 1.4. ManagedServiceFactory interface of 1.5
> is compatible with 1.4 and 1.3, but if we use provider version range
> for our bundles then it forbids us to use them for both 1.4 and 1.5
> implementation even they are interface-compatible.
>
> Thanks in advance
> Best regards
>
> --
> Ing. Martin Ždila
> tel:+421-908-363-848
> mailto:[email protected]
> http://www.zdila.sk/
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to