Parsing the Import-Package header would however not show the exact runtime imports since optional packages could be either present or not.

As far as I know using the clunky PackageAdmin API is the only way to query the actual runtime wiring. If performance is key, maybe some level of caching together with a BundleListener could be used.

Regards,

Valentin

On 8 Jan 2010, at 21:26, Alasdair Nottingham wrote:

Can you not call Bundle.getHeaders().get("Import-Package")?

That will return a them all as a single string, but we have code in
the application component that can correctly split this up in the
individual packages. We could move this into the util package so it
can be shared.

Alasdair

2010/1/8 Alan Keane <[email protected]>:
I'm looking for a standard way through the Framework API to inspect a
bundle's resolved bundle dependencies and imported packages.
The BundleStateMBean defines a #getImportedPackages(long bundleId) &
#getRequiredBundles(long) method.

The processing used for getImportedPackages
(FrameworkUtils#getBundleImportedPackages)
in particular will iterate through all bundles in the framework, query for ExportedPackages on each one and check for a match on the importing bundles.

Any ideas on a more efficient (standard) way of doing this?

Cheers,
Alan




--
Alasdair Nottingham
[email protected]

Reply via email to