}
@Override
@NotNull
public Set<Object> resolveDependenciesOf(@NotNull final Module module) {
BundleManifest manifest = getManifestByObject(module);
if (manifest == null) {
return Collections.emptySet();
}
// set of all manifest holders that are dependencies
Set<ManifestHolder> dependencyHolders = new HashSet<ManifestHolder>();
// resolve Import-Package
List<String> imports = manifest.getImports();
for (String anImport : imports) {
dependencyHolders.addAll(myBundleCache.whoProvides(anImport));
}
// Resolve Require-Bundle
List<String> requiredBundles = manifest.getRequiredBundles();
List<ManifestHolder> allRequiredBundles = new ArrayList<ManifestHolder>();
for (String requiredBundle : requiredBundles) {
resolveRequiredBundle(requiredBundle, allRequiredBundles);
}
dependencyHolders.addAll(allRequiredBundles);
// Resolve Fragment-Hosts
ManifestHolder manifestHolder = myBundleCache.getManifestHolder(module);
if (manifestHolder != null) {
dependencyHolders.addAll(myBundleCache.getFragmentHosts(manifestHolder));
}
// finally extract result objects from holders.
Set<Object> result = new HashSet<Object>();
for (ManifestHolder holder : dependencyHolders) {
try {
result.add(holder.getBoundObject());
}
catch (ManifestHolderDisposedException ignored) { }
}
// Resolve Bundle-ClassPath (this might contain non-osgi-bundles so we have to work on the library level here)
List<String> entries = manifest.getBundleClassPathEntries();
result.addAll(resolveBundleClassPath(entries));
return result;
}