sb.append("No package dependencies");
} else {
sb.append("<b>Static dependencies via packages</b><br>");
for(Iterator it = pkgClosure.iterator(); it.hasNext();) {
Bundle depB = (Bundle)it.next();
sb.append(" ");
Util.bundleLink(sb, depB);
sb.append("<br>");
}
}
sb.append("<br>");
Set serviceClosure = new TreeSet(Util.bundleIdComparator);
for(int i = 0; i < targets.length; i++) {
serviceClosure.addAll(Util.getServiceClosure(targets[i], null));
}
// remove myself
// serviceClosure.remove(b);
if(serviceClosure.size() == 0) {
sb.append("No service dependencies");
} else {
sb.append("<b>Runtime dependencies via services</b><br>");
for(Iterator it = serviceClosure.iterator(); it.hasNext();) {
Bundle depB = (Bundle)it.next();
sb.append(" ");
Util.bundleLink(sb, depB);
sb.append("<br>");
}
}
sb.append("<br>");
Set fragments = new TreeSet(Util.bundleIdComparator);
for(int i = 0; i < targets.length; i++) {
Bundle[] fragmentBundles = pkgAdmin.getFragments(targets[i]);
if (fragmentBundles != null) {
for (int b = 0; b < fragmentBundles.length; b++) {
fragments.add(fragmentBundles[b]);
}
}
}
if(fragments.size() == 0) {
sb.append("No fragments");
} else {
sb.append("<b>Fragments</b><br>");
for(Iterator it = fragments.iterator(); it.hasNext();) {
Bundle depB = (Bundle)it.next();
sb.append(" ");
Util.bundleLink(sb, depB);
sb.append("<br>");
}
}
sb.append("<br>");
Set hosts = new TreeSet(Util.bundleIdComparator);
for(int i = 0; i < targets.length; i++) {
Bundle[] hostBundles = pkgAdmin.getHosts(targets[i]);
if (hostBundles != null) {
for (int b = 0; b < hostBundles.length; b++) {
hosts.add(hostBundles[b]);
}
}
}
if(hosts.size() == 0) {
sb.append("No host");
} else {
sb.append("<b>Host</b><br>");
for(Iterator it = hosts.iterator(); it.hasNext();) {
Bundle depB = (Bundle)it.next();
sb.append(" ");
Util.bundleLink(sb, depB);
sb.append("<br>");
}
}
sb.append("<br>");
Set required = new TreeSet(Util.bundleIdComparator);
Set requiredBy = new TreeSet(Util.bundleIdComparator);
try { // untested code
RequiredBundle[] requiredBundles = pkgAdmin.getRequiredBundles(null);
if (requiredBundles != null) {
for (int rb = 0; rb < requiredBundles.length; rb++) {
for (int t = 0; t < targets.length; t++) {
Bundle[] requiringBundles = requiredBundles[rb].getRequiringBundles();
if (requiringBundles != null) {
if (requiredBundles[rb].getBundle().equals(targets[t])) {
for (int ring = 0; ring < requiringBundles.length; ring++) {
requiredBy.add(requiringBundles[ring]);
}
} else {
for (int ring = 0; ring < requiringBundles.length; ring++) {
if (requiringBundles[ring].equals(targets[t])) {
required.add(requiredBundles[rb].getBundle());
}
}
}
}
}
}
}
} catch (Throwable ignored) {}
Activator.getTargetBC_ungetService(sr);
if (required.size() == 0) {
sb.append("No required bundles");
} else {
sb.append("<b>Required bundles</b><br>");
for(Iterator it = required.iterator(); it.hasNext();) {
Bundle depB = (Bundle)it.next();
sb.append(" ");
Util.bundleLink(sb, depB);
sb.append("<br>");
}
}
sb.append("<br>");
if (requiredBy.size() == 0) {
sb.append("No requiring bundles");
} else {
sb.append("<b>Requiring bundles</b><br>");
for(Iterator it = requiredBy.iterator(); it.hasNext();) {
Bundle depB = (Bundle)it.next();
sb.append(" ");
Util.bundleLink(sb, depB);
sb.append("<br>");
}
}