Hello,
I'm upgrading some code that used PackageAdmin with Felix 3.2.2 to Felix
4.4.1 and am trying to find the equivalent code that can (for a given
class) determine a version number, if a bundle exports that class' package.
The code, which works with PackageAdmin, is like this (I've simplified):
// b is a bundle, in a loop:
// for (Bundle b : bundleContext.getBundles())
//
// c is the class of a service interface, in a loop:
//
Package p = c.getPackage();
String packageName = p.getName();
ExportedPackage[] exports = packageAdmin.getExportedPackages(b);
if (exports != null)
{
for (ExportedPackage export : exports)
{
if (packageName.equals(export.getName())) return export.getVersion();
}
}
I'm a bit stuck finding the equivalent code with the "bundlewiring"
package, which is apparently the equivalent in OSGi R5. I can't find
anything as obvious as "packages", it's all wires and requirements and
capabilities, which seem promising but I can't see how to just get at the
packages.
Thanks in advance for advice,
Christopher