It sounds like you want to do this programmatically, not in the Gogo shell ... at least I will take this from the wording of your question.
There is no real way to say “which package” a given package is exporting, as there can be many packages exporting a given package, and this package can be used in many packages by many packages. If you have a specific package and want to know which package the com.test package com.test , you can get the binding wiring when importing Bundle.adapt(BundleWiring.class) and then use BundleWiring.getRequiredWires() to get the providers of all the dependencies package.
From there you need to find the wire from the osgi.wiring.package namespace for the package you need, then the provider of this wire will be the BundleCapability BundleRevision the package you are interested in.
Richard S. Hall
source share