You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Carlos Sanchez <ca...@apache.org> on 2007/02/22 20:43:27 UTC

Should a bundle import it's own packages?

Seems that that's how the flix bundle plugin works, importing all
packages that it exports. Is this right?

-- 
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

Re: Should a bundle import it's own packages?

Posted by Carlos Sanchez <ca...@apache.org>.
cool, thanks!

On 2/23/07, Enrique Rodriguez <en...@gmail.com> wrote:
> On 2/22/07, Richard S. Hall <he...@ungoverned.org> wrote:
> > Carlos Sanchez wrote:
> > > Seems that that's how the flix bundle plugin works, importing all
> > > packages that it exports. Is this right?
> >
> > In OSGi R3 this was always the case, since Export-Package implied
> > Import-Package. It was a good idea then and is generally a good idea now.
> > ...
>
> I added Richard's answer to the FAQ:
> http://cwiki.apache.org/FELIX/faq.html
>
> Enrique
>


-- 
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

Re: Should a bundle import it's own packages?

Posted by Enrique Rodriguez <en...@gmail.com>.
On 2/22/07, Richard S. Hall <he...@ungoverned.org> wrote:
> Carlos Sanchez wrote:
> > Seems that that's how the flix bundle plugin works, importing all
> > packages that it exports. Is this right?
>
> In OSGi R3 this was always the case, since Export-Package implied
> Import-Package. It was a good idea then and is generally a good idea now.
> ...

I added Richard's answer to the FAQ:
http://cwiki.apache.org/FELIX/faq.html

Enrique

Re: Should a bundle import it's own packages?

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Carlos Sanchez wrote:
> Seems that that's how the flix bundle plugin works, importing all
> packages that it exports. Is this right?

In OSGi R3 this was always the case, since Export-Package implied 
Import-Package. It was a good idea then and is generally a good idea now.

The whole point is substitutability of providers.

If you import what you export, then the framework is free to choose a 
different provider of those packages for your bundle, which means that 
your exports may go unused. However, this is a good thing, because the 
framework tries to minimize the number of active versions of a given 
package. This is a good thing because more active versions means 
divisions in the service registry and less interoperability of bundles.

If your bundle only exports its packages, then it is forcing the 
framework to use its own version, which can result in more active 
version of the given package.

In general, the main time you want to export only, is if your bundle is 
purely a library bundle, then its packages will only be used if they are 
needed or if you have tightly coupled bundles sharing implementation 
packages. However, if your bundle will be started and especially if the 
exported packages define service interfaces or are referenced from 
service interfaces, then you will want to export and import them.

-> richard