aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1741050 - /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
Date Tue, 26 Apr 2016 14:56:14 GMT
Author: jwross
Date: Tue Apr 26 14:56:14 2016
New Revision: 1741050

URL: http://svn.apache.org/viewvc?rev=1741050&view=rev
Log:
[ARIES-1538] Never fail a subsystem resolution because an already resolved resource has a
missing dependency.

When processing substitutable exports, the resource capabilities of host bundles must be inspected
when the requirement resource is a fragment.

Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java?rev=1741050&r1=1741049&r2=1741050&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
Tue Apr 26 14:56:14 2016
@@ -154,26 +154,44 @@ public class ResolveContext extends org.
 		processWires(wires, requirement, capabilities);
 	}
 	
-	private void processAsSubstitutableExport(Requirement requirement, List<Capability>
capabilities) {
+	private void processAsSubstitutableExport(boolean isFragment, Requirement requirement, List<Capability>
capabilities) {
 		String namespace = requirement.getNamespace();
 		if (!PackageNamespace.PACKAGE_NAMESPACE.equals(namespace)) {
 			return;
 		}
 		Resource resource = requirement.getResource();
 		Wiring wiring = wirings.get(resource);
-		List<Capability> resourceCapabilities = wiring.getResourceCapabilities(namespace);
-		processResourceCapabilities(resourceCapabilities, requirement, capabilities);
+		if (isFragment) {
+			List<Wire> fragmentWires = wiring.getRequiredResourceWires(HostNamespace.HOST_NAMESPACE);
+			for (Wire fragmentWire : fragmentWires) {
+				Resource host = fragmentWire.getProvider();
+				processResourceCapabilities(
+						wirings.get(host).getResourceCapabilities(namespace),
+						requirement,
+						capabilities);
+			}
+		}
+		else {
+			List<Capability> resourceCapabilities = wiring.getResourceCapabilities(namespace);
+			processResourceCapabilities(resourceCapabilities, requirement, capabilities);
+		}
 	}
 	
 	private void processAlreadyResolvedResource(Resource resource, Requirement requirement,
List<Capability> capabilities) {
-		if (isProcessableAsFragment(requirement)) {
+		boolean isFragment = isProcessableAsFragment(requirement);
+		if (isFragment) {
 			processAsFragment(requirement, capabilities);
 		}
 		else {
 			processAsBundle(requirement, capabilities);
 		}
 		if (capabilities.isEmpty() && Utils.isMandatory(requirement)) {
-			processAsSubstitutableExport(requirement, capabilities);
+			processAsSubstitutableExport(isFragment, requirement, capabilities);
+			if (capabilities.isEmpty()) {
+				// ARIES-1538. Do not fail subsystem resolution if an already
+				// resolved resource has a missing dependency.
+				capabilities.add(new MissingCapability(requirement));
+			}
 		}
 	}
 	



Mime
View raw message