Am Freitag, den 07.09.2007, 11:11 +0800 schrieb Stuart McCulloch:
> On 07/09/07, Carlos Sanchez <[EMAIL PROTECTED]> wrote:
> >
> > I have a couple of concept questions for improvements to the bundle
> > plugin manifest generation
> >
> > * Version resolution
> > Let's say bundle A exports a package with version 2.0, and bundle B
> > imports that package version 1.0
> >
> > When B is started, will it fail because A 1.0 is not present?
> 
> 
> yes, unless another bundle provides version 1.0

Well, not quite: If B specifies the import as version=1.0, this means
any version >= 1.0. So, yes, bundle B will resolve the package using the
export from Bundle A in this case.

> * Optional packages
> > If a bundle imports packages from several bundles A,B,C... but only
> > one is required at runtime, will it work?

But keep in mind: A bundle imports packages and does not care where
these packages come from. This is very important and very useful but
might be somewhat strange at first sight. But if you look behind the
scenes it makes sense a lot.

> yes, if only one will be available - or you could use DynamicImport-Package
> (but if you know the packages up front, then imho Import-Package is better)

resolution:=optional imports are tried to resolve when the bundle is
resolved. If the fail to resolve, they are just ignored and may only
become available when the bundle is resolved again (probably due to a
PackageAdmin refresh). DynamicImport-Package imports on the other hand
are not resolved up-front when the bundle is resolved. They are only
resolved when actually needed and will be re-checked as long as they
cannot be resolved. Of course after being resolved, the
DynamicImport-Package imports remain wired until the bundle is being
resolved again.

At the end of the day, I agree with Stuart, that resolution:=optional
tends to be clearer and possibly more performant. But your milage and
use cases may vary.

Regards
Felix

Reply via email to