问题
Possible Duplicate:
Find the dependent bundles in Eclipse at runtime
How to get list of all dependent bundles from the updated bundle? For example, situation when some application loaded same bundles. In one time I will update one bundle. How can I get all bundles which depend on the updated bundle? This is necessary in order to restart all bundles which depend on the updated bundle, so they can see a new object of the updated bundle. Sorry my bad English. Best regards, Arthur.
回答1:
Use the FrameworkWiring.getDependencyClosure method.
回答2:
if you see Find the dependent bundles in Eclipse at runtime:
akr writes:
There is no easy way to determine the dependency. The best way is to go through the PackageAdmin interface. See the OSGi spec for PackageAdmin and getImportingBundles in particular: http://www.osgi.org/javadoc/r4v42/org/osgi/service/packageadmin/ExportedPackage.html#getImportingBundles()
You need to determine for all installed bundles, which one exports one or more packages >that your bundle is importing. The easiest way to achieve this is to call PackageAdmin.getExportedPackages(Bundle bundle) with bundles = null. This returns an array >of all exported packages. You then need to iterate of this array and call ExportPackage.getImportingBundles().
来源:https://stackoverflow.com/questions/11986935/felix-how-to-get-list-of-all-dependent-bundles-from-the-updated-bundle