You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Pierre Henry Perret <ph...@gmail.com> on 2011/01/03 14:56:18 UTC

How to find an exporting bundle for a certain package?

Hi,

I'd like to know if find a bundle contains and export a certain package.
Is there a reference for that ?

Pierre

Re: How to find an exporting bundle for a certain package?

Posted by Per-Erik Svensson <pe...@gmail.com>.
PackageAdmin does what I think you're looking for

Pseudo

val padminService = getPackageAdminService(context);
val package = padminService.getExportedPackage("javax.swing"); //Highest
version returned
package.getExportingBundle()

I'm not sure what you want to do but the following 4 classes should cover
your needs I think:
http://www.osgi.org/javadoc/r4v42/org/osgi/service/packageadmin/PackageAdmin.html
http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleContext.html
http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html
http://www.osgi.org/javadoc/r4v42/org/osgi/service/packageadmin/ExportedPackage.html

With these, you can get all installed bundles (from the bundle context) and
all exported packages (from package admin). From there you can do pretty
much any query you want. :)

/Per-Erik


On Mon, Jan 3, 2011 at 2:56 PM, Pierre Henry Perret <ph...@gmail.com>wrote:

> Hi,
>
> I'd like to know if find a bundle contains and export a certain package.
> Is there a reference for that ?
>
> Pierre
>