/*
* Create a child node for a given import (by finding a matching export in the currently installed bundles)
*/
private void createNodeForImport(Node<Bundle> node, Bundle bundle, Clause i) {
VersionRange range = VersionRange.parseVersionRange(i.getAttribute(Constants.VERSION_ATTRIBUTE));
boolean foundMatch = false;
for (Bundle b : bundleContext.getBundles()) {
BundleWiring wiring = b.adapt(BundleWiring.class);
if (wiring != null) {
List<BundleCapability> caps = wiring.getCapabilities(BundleRevision.PACKAGE_NAMESPACE);
if (caps != null) {
for (BundleCapability cap : caps) {
String n = getAttribute(cap, BundleRevision.PACKAGE_NAMESPACE);
String v = getAttribute(cap, Constants.VERSION_ATTRIBUTE);
if (i.getName().equals(n) && range.contains(VersionTable.getVersion(v))) {
boolean existing = tree.flatten().contains(b);
System.out.printf("- import %s: resolved using %s%n", i, b);
foundMatch = true;
if (!node.hasChild(b)) {
Node<Bundle> child = node.addChild(b);