Inject wiring into extension bundles so their dependency information
is insectable like normal bundles. (FELIX-2467)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1157856 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
index acc1df4..3f40797 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
@@ -45,6 +45,7 @@
import org.apache.felix.framework.cache.Content;
import org.apache.felix.framework.util.manifestparser.R4Library;
import org.apache.felix.framework.wiring.BundleCapabilityImpl;
+import org.apache.felix.framework.wiring.BundleWireImpl;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
@@ -53,7 +54,9 @@
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
/**
@@ -380,6 +383,21 @@
throw ex;
}
+ BundleRevisionImpl bri = (BundleRevisionImpl) bundle.adapt(BundleRevision.class);
+ List<BundleRequirement> reqs = bri.getDeclaredRequirements(BundleRevision.HOST_NAMESPACE);
+ List<BundleCapability> caps = getCapabilities(BundleRevision.HOST_NAMESPACE);
+ BundleWire bw = new BundleWireImpl(bri, reqs.get(0), m_systemBundleRevision, caps.get(0));
+ bri.resolve(
+ new BundleWiringImpl(
+ m_logger,
+ m_configMap,
+ null,
+ bri,
+ null,
+ Collections.singletonList(bw),
+ Collections.EMPTY_MAP,
+ Collections.EMPTY_MAP));
+ felix.getDependencies().addDependent(bw);
felix.setBundleStateAndNotify(bundle, Bundle.RESOLVED);
}