aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1740364 - in /aries/branches/java6support/subsystem: ./ subsystem-core/ subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ subsystem-itests/ subsyste...
Date Thu, 21 Apr 2016 17:21:25 GMT
Author: jwross
Date: Thu Apr 21 17:21:24 2016
New Revision: 1740364

URL: http://svn.apache.org/viewvc?rev=1740364&view=rev
Log:
Merge ^/aries/trunk/subsystem r1728111 through r1740363 into java6support branch.

Added:
    aries/branches/java6support/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/
      - copied from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/
    aries/branches/java6support/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/
      - copied from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/
    aries/branches/java6support/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF
    aries/branches/java6support/subsystem/subsystem-itests/src/test/bundles/aries1523host/
      - copied from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/
    aries/branches/java6support/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/
      - copied from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/
    aries/branches/java6support/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/MANIFEST.MF
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/MANIFEST.MF
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1338Test.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1338Test.java
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1417Test.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1417Test.java
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1441Test.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1441Test.java
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1442Test.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1442Test.java
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1443Test.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1443Test.java
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1445Test.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1445Test.java
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1522Test.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1522Test.java
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1523Test.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1523Test.java
    aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/OsgiWiringHostCapability.java
      - copied unchanged from r1740363, aries/trunk/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/OsgiWiringHostCapability.java
Modified:
    aries/branches/java6support/subsystem/   (props changed)
    aries/branches/java6support/subsystem/subsystem-core/pom.xml
    aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java
    aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BasicSubsystem.java
    aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
    aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java
    aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/UninstallAction.java
    aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Utils.java
    aries/branches/java6support/subsystem/subsystem-itests/pom.xml
    aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
    aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java
    aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixRequirementAdapter.java
    aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java
    aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo
    aries/branches/java6support/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java

Propchange: aries/branches/java6support/subsystem/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Apr 21 17:21:24 2016
@@ -0,0 +1,2 @@
+/aries/branches/1.0-prototype/subsystem:1306564-1337594
+/aries/trunk/subsystem:1728111-1740363

Modified: aries/branches/java6support/subsystem/subsystem-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-core/pom.xml?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-core/pom.xml (original)
+++ aries/branches/java6support/subsystem/subsystem-core/pom.xml Thu Apr 21 17:21:24 2016
@@ -56,6 +56,15 @@
             org.apache.aries.subsystem.core.*
         </aries.osgi.private.pkg>
         <lastReleaseVersion>1.0.0</lastReleaseVersion>
+        <aries.osgi.provide.capability>
+        	osgi.implementation;
+    			osgi.implementation="osgi.subsystem";
+    			version:Version="1.1";
+    			uses:="org.osgi.service.subsystem",
+    		osgi.service;
+    			objectClass:List&lt;String&gt;="org.osgi.service.subsystem.Subsystem,org.apache.aries.subsystem.AriesSubsystem";
+    			uses:="org.osgi.service.subsystem,org.apache.aries.subsystem"
+        </aries.osgi.provide.capability>
     </properties>
 
     <dependencies>
@@ -138,6 +147,36 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.0</version>
+                <extensions>true</extensions>
+                <inherited>true</inherited>
+                <configuration>
+                    <excludeDependencies>${aries.osgi.exclude.dependencies}</excludeDependencies>
+                    <instructions>
+                        <Bundle-Name>${project.name}</Bundle-Name>
+                        <Bundle-SymbolicName>${aries.osgi.symbolic.name}</Bundle-SymbolicName>
+                        <Bundle-Activator>${aries.osgi.activator}</Bundle-Activator>
+                        <Export-Package>${aries.osgi.export}</Export-Package>
+                        <Import-Package>${aries.osgi.import}</Import-Package>
+                        <DynamicImport-Package>${aries.osgi.dynamic}</DynamicImport-Package>
+                        <Private-Package>${aries.osgi.private.pkg}</Private-Package>
+                        <Implementation-Title>Apache Aries</Implementation-Title>
+                        <Implementation-Version>${project.version}</Implementation-Version>
+                        <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+                        <Include-Resource>${aries.osgi.include.resource}</Include-Resource>
+                        <_removeheaders>${aries.osgi.remove.headers}}</_removeheaders>
+                        <_failok>${aries.osgi.failok}</_failok>
+                        <_consumer-policy>${aries.osgi.import.default.version}</_consumer-policy>
+                        <_provider-policy>$&lt;range;[==,=+)&gt;</_provider-policy>
+                        <Export-Service>${aries.osgi.export.service}</Export-Service>
+                        <Import-Service>${aries.osgi.import.service}</Import-Service>
+                        <Provide-Capability>${aries.osgi.provide.capability}</Provide-Capability>
+                    </instructions>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 

Modified: aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java (original)
+++ aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java Thu Apr 21 17:21:24 2016
@@ -73,7 +73,7 @@ public class ImportPackageHeader extends
 		}
 		
 		public Clause(String path, Map<String, Parameter> parameters, Collection<Parameter> defaultParameters) {
-			super(path, parameters, defaultParameters);
+			super(path, parameters, defaultParameters == null ? Clause.defaultParameters : defaultParameters);
 		}
 		
 		public Clause(String clause) {
@@ -136,7 +136,20 @@ public class ImportPackageHeader extends
 		Collection<Clause> clauses = getClauses();
 		List<ImportPackageRequirement> result = new ArrayList<ImportPackageRequirement>(clauses.size());
 		for (Clause clause : clauses) {
-			result.add(clause.toRequirement(resource));
+			Collection<String> packageNames = clause.getPackageNames();
+			if (packageNames.size() > 1) {
+				for (String packageName : packageNames) {
+					Collection<Parameter> parameters = clause.getParameters();
+					Map<String, Parameter> name2parameter = new HashMap<String, Parameter>(parameters.size());
+					for (Parameter parameter : parameters) {
+						name2parameter.put(parameter.getName(), parameter);
+					}
+					result.add(new Clause(packageName, name2parameter, null).toRequirement(resource));
+				}
+			}
+			else {
+				result.add(clause.toRequirement(resource));
+			}
 		}
 		return result;
 	}

Modified: aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BasicSubsystem.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BasicSubsystem.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BasicSubsystem.java (original)
+++ aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BasicSubsystem.java Thu Apr 21 17:21:24 2016
@@ -157,40 +157,113 @@ public class BasicSubsystem implements R
 	
 	@Override
 	public List<Capability> getCapabilities(String namespace) {
+		// First, add the capabilities from the manifest.
 		SubsystemManifest manifest = getSubsystemManifest();
 		List<Capability> result = manifest.toCapabilities(this);
-		if (namespace != null)
-			for (Iterator<Capability> i = result.iterator(); i.hasNext();)
-				if (!i.next().getNamespace().equals(namespace))
+		if (namespace != null) {
+			for (Iterator<Capability> i = result.iterator(); i.hasNext();) {
+				if (!i.next().getNamespace().equals(namespace)) {
 					i.remove();
-		// TODO Somehow, exposing the capabilities of content resources of a
-		// feature is causing an infinite regression of feature2 installations
-		// in FeatureTest.testSharedContent() under certain conditions.
-		if (isScoped() || IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace))
+				}
+			}
+		}
+		if (isScoped() || IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace)) {
+			// Scoped subsystems have all capabilities explicitly declared in
+			// their manifests. Also, we do not want to include the osgi.identity
+			// capabilities of content since a resource must have zero or one
+			// osgi.identity capabilities.
 			return result;
-		SubsystemContentHeader header = manifest.getSubsystemContentHeader();
-		for (Resource constituent : getConstituents())
-			if (header.contains(constituent))
-				for (Capability capability : constituent.getCapabilities(namespace))
-					result.add(new BasicCapability(capability, this));
+		}
+		// This is an unscoped subsystem that implicitly exports everything.
+		// Its capabilities must be derived from its content.
+		if (resource == null) {
+			// This is a persisted subsystem. We no longer have access to the
+			// original content. We must look at constituents that are also 
+			// content.
+			SubsystemContentHeader header = manifest.getSubsystemContentHeader();
+			for (Resource constituent : getConstituents()) {
+				if (header.contains(constituent)) {
+					for (Capability capability : constituent.getCapabilities(namespace)) {
+						if (namespace == null && IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getNamespace())) {
+							// Don't want to include the osgi.identity capabilities of
+							// content. Need a second check here in case the namespace
+							// is null.
+							continue;
+						}
+						result.add(new BasicCapability(capability, this));
+					}
+				}
+			}
+			return result;
+		}
+		// This is a newly installing subsystem. We therefore have access to the
+		// original content via the SubsystemResource and can derive the
+		// capabilities from there.
+		Collection<Resource> installableContent = resource.getInstallableContent();
+		Collection<Resource> sharedContent = resource.getSharedContent();
+		Collection<Resource> contents = new ArrayList<Resource>(installableContent.size() + sharedContent.size());
+		contents.addAll(installableContent);
+		contents.addAll(sharedContent);
+		for (Resource content : contents) {
+			for (Capability capability : content.getCapabilities(namespace)) {
+				if (namespace == null && IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getNamespace())) {
+					// Don't want to include the osgi.identity capabilities of
+					// content. Need a second check here in case the namespace
+					// is null.
+					continue;
+				}
+				result.add(new BasicCapability(capability, this));
+			}
+		}
 		return result;
 	}
 
 	@Override
 	public List<Requirement> getRequirements(String namespace) {
+		// First, add the requirements from the manifest.
 		SubsystemManifest manifest = getSubsystemManifest();
 		List<Requirement> result = manifest.toRequirements(this);
-		if (namespace != null)
-			for (Iterator<Requirement> i = result.iterator(); i.hasNext();)
-				if (!i.next().getNamespace().equals(namespace))
+		if (namespace != null) {
+			for (Iterator<Requirement> i = result.iterator(); i.hasNext();) {
+				if (!i.next().getNamespace().equals(namespace)) {
 					i.remove();
-		if (isScoped())
+				}
+			}
+		}
+		if (isScoped()) {
+			// Scoped subsystems have all requirements explicitly declared in
+			// their manifests.
+			return result;
+		}
+		// This is an unscoped subsystem that implicitly imports everything.
+		// Its requirements must be derived from its content.
+		if (resource == null) {
+			// This is a persisted subsystem. We no longer have access to the
+			// original content. We must look at constituents that are also 
+			// content.
+			SubsystemContentHeader header = manifest.getSubsystemContentHeader();
+			for (Resource constituent : getConstituents()) {
+				if (header.contains(constituent)) {
+					for (Requirement requirement : constituent.getRequirements(namespace)) {
+						result.add(new BasicRequirement(requirement, this));
+					}
+				}
+			}
 			return result;
-		SubsystemContentHeader header = manifest.getSubsystemContentHeader();
-		for (Resource constituent : getConstituents())
-			if (header.contains(constituent))
-				for (Requirement requirement : constituent.getRequirements(namespace))
-					result.add(new BasicRequirement(requirement, this));
+		}
+		// This is a newly installing subsystem. We therefore have access to the
+		// original content via the SubsystemResource and can derive the
+		// requirements from there.
+		Collection<Resource> installableContent = resource.getInstallableContent();
+		Collection<Resource> sharedContent = resource.getSharedContent();
+		Collection<Resource> contents = new ArrayList<Resource>(installableContent.size() + sharedContent.size());
+		contents.addAll(installableContent);
+		contents.addAll(sharedContent);
+		for (Resource content : contents) {
+			for (Requirement requirement : content.getRequirements(namespace)) {
+				result.add(new BasicRequirement(requirement, this));
+			}
+		}
 		return result;
 	}
 	

Modified: aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java (original)
+++ aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java Thu Apr 21 17:21:24 2016
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.aries.subsystem.core.archive.ProvisionPolicyDirective;
+import org.apache.aries.subsystem.core.archive.SubsystemContentHeader;
 import org.apache.aries.subsystem.core.archive.SubsystemManifest;
 import org.apache.aries.subsystem.core.archive.SubsystemTypeHeader;
 import org.apache.aries.subsystem.core.internal.BundleResourceInstaller.BundleConstituent;
@@ -34,18 +35,20 @@ import org.eclipse.equinox.region.Region
 import org.osgi.framework.BundleException;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.namespace.ExecutionEnvironmentNamespace;
+import org.osgi.framework.namespace.HostNamespace;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.namespace.NativeNamespace;
+import org.osgi.framework.namespace.PackageNamespace;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.BundleWiring;
 import org.osgi.resource.Capability;
 import org.osgi.resource.Namespace;
 import org.osgi.resource.Requirement;
 import org.osgi.resource.Resource;
+import org.osgi.resource.Wire;
 import org.osgi.resource.Wiring;
 import org.osgi.service.resolver.HostedCapability;
 import org.osgi.service.subsystem.Subsystem.State;
-import org.osgi.service.subsystem.SubsystemException;
 
 public class ResolveContext extends org.osgi.service.resolver.ResolveContext {
 	private final Repository contentRepository;
@@ -94,44 +97,130 @@ public class ResolveContext extends org.
 			AccessController.doPrivileged(new StartAction(subsystem, subsystem, subsystem, Restriction.INSTALL_ONLY));
 		}
 	}
-
-	@Override
-	public List<Capability> findProviders(Requirement requirement) {
-		installDependenciesOfRequirerIfNecessary(requirement);
-		ArrayList<Capability> result = new ArrayList<Capability>();
+	
+	private boolean isResolved(Resource resource) {
+		return wirings.containsKey(resource);
+	}
+	
+	private boolean isProcessableAsFragment(Requirement requirement) {
+		Resource resource = requirement.getResource();
+		String namespace = requirement.getNamespace();
+		return Utils.isFragment(resource)
+				&& !(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE.equals(namespace)
+						|| HostNamespace.HOST_NAMESPACE.equals(namespace));
+	}
+	
+	private void processAsFragment(Requirement requirement, List<Capability> capabilities) {
+		String namespace = requirement.getNamespace();
+		Resource fragment = requirement.getResource();
+		Wiring fragmentWiring = wirings.get(fragment);
+		List<Wire> fragmentWires = fragmentWiring.getRequiredResourceWires(HostNamespace.HOST_NAMESPACE);
+		for (Wire fragmentWire : fragmentWires) {
+			Resource host = fragmentWire.getProvider();
+			Wiring hostWiring = wirings.get(host);
+			List<Wire> hostWires = hostWiring.getRequiredResourceWires(namespace);
+			processWires(hostWires, requirement, capabilities);
+		}
+	}
+	
+	private void processWires(Collection<Wire> wires, Requirement requirement, List<Capability> capabilities) {
+		for (Wire wire : wires) {
+			processWire(wire, requirement, capabilities);
+		}
+	}
+	
+	private void processWire(Wire wire, Requirement requirement, List<Capability> capabilities) {
+		Capability capability = wire.getCapability();
+		processCapability(capability, requirement, capabilities);
+	}
+	
+	private void processCapability(Capability capability, Requirement requirement, List<Capability> capabilities) {
+		if (ResourceHelper.matches(requirement, capability)) {
+			capabilities.add(capability);
+		}
+	}
+	
+	private void processResourceCapabilities(Collection<Capability> resourceCapabilities, Requirement requirement, List<Capability> capabilities) {
+		for (Capability resourceCapability : resourceCapabilities) {
+			processCapability(resourceCapability, requirement, capabilities);
+		}
+	}
+	
+	private void processAsBundle(Requirement requirement, List<Capability> capabilities) {
+		String namespace = requirement.getNamespace();
+		Resource bundle = requirement.getResource();
+		Wiring wiring = wirings.get(bundle);
+		List<Wire> wires = wiring.getRequiredResourceWires(namespace);
+		processWires(wires, requirement, capabilities);
+	}
+	
+	private void processAsSubstitutableExport(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);
+	}
+	
+	private void processAlreadyResolvedResource(Resource resource, Requirement requirement, List<Capability> capabilities) {
+		if (isProcessableAsFragment(requirement)) {
+			processAsFragment(requirement, capabilities);
+		}
+		else {
+			processAsBundle(requirement, capabilities);
+		}
+		if (capabilities.isEmpty() && Utils.isMandatory(requirement)) {
+			processAsSubstitutableExport(requirement, capabilities);
+		}
+	}
+	
+	private void processNewlyResolvedResource(Resource resource, Requirement requirement, List<Capability> capabilities) {
 		try {
 			// Only check the system repository for osgi.ee and osgi.native
 			if (ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE.equals(requirement.getNamespace())
 					|| NativeNamespace.NATIVE_NAMESPACE.equals(requirement.getNamespace())) {
-				addDependenciesFromSystemRepository(requirement, result);
+				addDependenciesFromSystemRepository(requirement, capabilities);
 			} else {
-				addDependenciesFromContentRepository(requirement, result);
-				addDependenciesFromPreferredProviderRepository(requirement, result);
-				addDependenciesFromSystemRepository(requirement, result);
-				addDependenciesFromLocalRepository(requirement, result);
-				if (result.isEmpty()) {
-					addDependenciesFromRepositoryServiceRepositories(requirement, result);
+				addDependenciesFromContentRepository(requirement, capabilities);
+				addDependenciesFromPreferredProviderRepository(requirement, capabilities);
+				addDependenciesFromSystemRepository(requirement, capabilities);
+				addDependenciesFromLocalRepository(requirement, capabilities);
+				if (capabilities.isEmpty()) {
+					addDependenciesFromRepositoryServiceRepositories(requirement, capabilities);
 				}
 			}
-			if (result.isEmpty()) {
+			if (capabilities.isEmpty()) {
 				// Is the requirement optional?
 				String resolution = requirement.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE);
 				if (Namespace.RESOLUTION_OPTIONAL.equals(resolution)) {
 					// Yes, it's optional. Add a missing capability to ensure
 					// it gets added to the sharing policy per the specification.
-					result.add(new MissingCapability(requirement));
+					capabilities.add(new MissingCapability(requirement));
 				}
 			}
 		}
 		catch (Throwable t) {
-			if (t instanceof SubsystemException)
-				throw (SubsystemException)t;
-			if (t instanceof SecurityException)
-				throw (SecurityException)t;
-			throw new SubsystemException(t);
+			Utils.handleTrowable(t);
 		}
-		result.trimToSize();
-		return result;
+	}
+
+	@Override
+	public List<Capability> findProviders(Requirement requirement) {
+		ArrayList<Capability> capabilities = new ArrayList<Capability>();
+		Resource resource = requirement.getResource();
+		if (isResolved(resource)
+				&& Utils.isEffectiveResolve(requirement)) {
+			processAlreadyResolvedResource(resource, requirement, capabilities);
+		}
+		else {
+			installDependenciesOfRequirerIfNecessary(requirement);
+			processNewlyResolvedResource(resource, requirement, capabilities);
+		}
+		capabilities.trimToSize();
+		return capabilities;
 	}
 
 	@Override
@@ -163,7 +252,7 @@ public class ResolveContext extends org.
 
 	@Override
 	public Map<Resource, Wiring> getWirings() {
-		return wirings;
+		return Collections.emptyMap();
 	}
 
 	private boolean addDependencies(Repository repository, Requirement requirement, List<Capability> capabilities, boolean validate) throws BundleException, IOException, InvalidSyntaxException, URISyntaxException {
@@ -250,8 +339,17 @@ public class ResolveContext extends org.
 	private boolean isValid(Capability capability, Requirement requirement) throws BundleException, IOException, InvalidSyntaxException, URISyntaxException {
 		if (IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getNamespace()))
 			return true;
-		Region from = findRegionForCapabilityValidation(capability.getResource());
-		Region to = findRegionForCapabilityValidation(requirement.getResource());
+		Resource provider = capability.getResource();
+		Resource requirer = requirement.getResource();
+		SubsystemManifest manifest = resource.getSubsystemManifest();
+		SubsystemContentHeader header = manifest.getSubsystemContentHeader();
+		if (header.contains(provider) && header.contains(requirer)) {
+			// Shortcut. If both the provider and requirer are content then they
+			// are in the same region and the capability will be visible.
+			return true;
+		}
+		Region from = findRegionForCapabilityValidation(provider);
+		Region to = findRegionForCapabilityValidation(requirer);
 		return new SharingPolicyValidator(from, to).isValid(capability);
 	}
 	

Modified: aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java (original)
+++ aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java Thu Apr 21 17:21:24 2016
@@ -294,15 +294,6 @@ public class SubsystemResource implement
 			sharedContent.add(resource);
 	}
 
-	private void addDependency(Resource resource) {
-		if (resource == null)
-			return;
-		if (isInstallable(resource))
-			installableDependencies.add(resource);
-		else
-			sharedDependencies.add(resource);
-	}
-
 	private void addMissingResource(DeployedContentHeader.Clause resource) {
 		missingResources.add(resource);
 	}
@@ -383,9 +374,17 @@ public class SubsystemResource implement
 	        }
 	    }
 	}
+	
+	private void addDependency(Resource resource) {
+		if (resource == null)
+			return;
+		if (isInstallable(resource))
+			installableDependencies.add(resource);
+		else
+			sharedDependencies.add(resource);
+	}
 
 	private void computeDependencies(SubsystemManifest manifest, Coordination coordination)  {
-		SubsystemContentHeader contentHeader = manifest.getSubsystemContentHeader();
 		try {
 			// The following line is necessary in order to ensure that the
 			// export sharing policies of composites are in place for capability
@@ -393,36 +392,29 @@ public class SubsystemResource implement
 			StartAction.setExportPolicyOfAllInstallingSubsystemsWithProvisionDependenciesResolve(coordination);
 			Map<Resource, List<Wire>> resolution = Activator.getInstance().getResolver().resolve(createResolveContext());
 			setImportIsolationPolicy(resolution);
-			for (Map.Entry<Resource, List<Wire>> entry : resolution.entrySet()) {
-				Resource key = entry.getKey();
-				String type = ResourceHelper.getTypeAttribute(key);
-				// Do not include synthetic resources in the dependencies.
-				if (!Constants.ResourceTypeSynthesized.equals(type)
-						&& !contentHeader.contains(key)) {
-					addDependency(key);
-				}
-				for (Wire wire : entry.getValue()) {
-					Resource provider = wire.getProvider();
-					type = ResourceHelper.getTypeAttribute(provider);
-					// Do not include synthetic resources in the dependencies.
-					if (!Constants.ResourceTypeSynthesized.equals(type)
-							&& !contentHeader.contains(provider)) {
-						addDependency(provider);
-					}
-				}
-			}
-		}
-		catch (ResolutionException e) {
-			throw new SubsystemException(e);
+			addDependencies(resolution);
 		}
 		catch (Exception e) {
-			if (e instanceof SubsystemException) {
-				throw (SubsystemException)e;
-			}
-			if (e instanceof SecurityException) {
-				throw (SecurityException)e;
-			}
-			throw new SubsystemException(e);
+			Utils.handleTrowable(e);
+		}
+	}
+	
+	private void addDependencies(Map<Resource, List<Wire>> resolution) {
+		for (Map.Entry<Resource, List<Wire>> entry : resolution.entrySet()) {
+			addDependencies(entry, resolution);
+		}
+	}
+	
+	private void addDependencies(Map.Entry<Resource, List<Wire>> entry, Map<Resource, List<Wire>> resolution) {
+		addDependencies(entry.getKey(), entry, resolution);
+	}
+	
+	private void addDependencies(Resource resource, Map.Entry<Resource, List<Wire>> entry, Map<Resource, List<Wire>> resolution) {
+		String type = ResourceHelper.getTypeAttribute(resource);
+		SubsystemContentHeader contentHeader = getSubsystemManifest().getSubsystemContentHeader();
+		if (!Constants.ResourceTypeSynthesized.equals(type) // Do not include synthetic resources as dependencies.
+				&& !contentHeader.contains(resource)) { // Do not include content as dependencies.
+			addDependency(resource);
 		}
 	}
 

Modified: aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/UninstallAction.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/UninstallAction.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/UninstallAction.java (original)
+++ aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/UninstallAction.java Thu Apr 21 17:21:24 2016
@@ -25,12 +25,13 @@ public class UninstallAction extends Abs
 	@Override
 	public Object run() {
 		// Protect against re-entry now that cycles are supported.
-		if (!LockingStrategy.set(State.STOPPING, target)) {
+		if (!LockingStrategy.set(State.UNINSTALLING, target)) {
 			return null;
 		}
 		try {
-			// Acquire the global write lock to prevent all other operations until
-			// the installation is complete. There is no need to hold any other locks.
+			// Acquire the global write lock to prevent all other operations 
+			// until the uninstall is complete. There is no need to hold any 
+			// other locks.
 			LockingStrategy.writeLock();
 			try {
 				checkRoot();
@@ -51,7 +52,7 @@ public class UninstallAction extends Abs
 		}
 		finally {
 			// Protection against re-entry no longer required.
-			LockingStrategy.unset(State.STOPPING, target);
+			LockingStrategy.unset(State.UNINSTALLING, target);
 		}
 		return null;
 	}

Modified: aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Utils.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Utils.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Utils.java (original)
+++ aries/branches/java6support/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Utils.java Thu Apr 21 17:21:24 2016
@@ -14,6 +14,7 @@
 package org.apache.aries.subsystem.core.internal;
 
 import java.util.Collection;
+import java.util.Map;
 
 import org.apache.aries.subsystem.core.archive.DeploymentManifest;
 import org.apache.aries.subsystem.core.archive.ProvisionResourceHeader;
@@ -21,11 +22,14 @@ import org.apache.aries.subsystem.core.a
 import org.apache.aries.subsystem.core.archive.SubsystemManifest;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.resource.Namespace;
+import org.osgi.resource.Requirement;
 import org.osgi.resource.Resource;
 import org.osgi.service.coordinator.Coordination;
 import org.osgi.service.coordinator.CoordinationException;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
+import org.osgi.service.subsystem.SubsystemException;
 import org.osgi.service.subsystem.Subsystem.State;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -84,9 +88,14 @@ public class Utils {
 
 	public static int getActiveUseCount(Resource resource) {
 		int result = 0;
-		for (BasicSubsystem subsystem : Activator.getInstance().getSubsystems().getSubsystemsReferencing(resource))
-			if (Subsystem.State.ACTIVE.equals(subsystem.getState()))
+		for (BasicSubsystem subsystem : Activator.getInstance().getSubsystems().getSubsystemsReferencing(resource)) {
+			if (	// ACTIVE subsystem referencing the resource.
+					Subsystem.State.ACTIVE.equals(subsystem.getState())
+					// Ensure unmanaged bundle constituents of the root subsystem are not stopped or uninstalled.
+					|| (subsystem.isRoot() && isBundle(resource))) { 
 				result++;
+			}
+		}
 		return result;
 	}
 	
@@ -98,6 +107,16 @@ public class Utils {
 		return -1;
 	}
 	
+	public static void handleTrowable(Throwable t) {
+		if (t instanceof SubsystemException) {
+			throw (SubsystemException)t;
+		}
+		if (t instanceof SecurityException) {
+			throw (SecurityException)t;
+		}
+		throw new SubsystemException(t);
+	}
+	
 	public static void installResource(Resource resource, BasicSubsystem subsystem) {
 		Coordination coordination = Utils.createCoordination(subsystem);
 		try {
@@ -126,6 +145,23 @@ public class Utils {
 				IdentityNamespace.TYPE_FRAGMENT.equals(type);
 	}
 	
+	public static boolean isFragment(Resource resource) {
+		String type = ResourceHelper.getTypeAttribute(resource);
+		return IdentityNamespace.TYPE_FRAGMENT.equals(type);
+	}
+	
+	public static boolean isEffectiveResolve(Requirement requirement) {
+		Map<String, String> directives = requirement.getDirectives();
+		String value = directives.get(Namespace.REQUIREMENT_EFFECTIVE_DIRECTIVE);
+		return value == null || Namespace.EFFECTIVE_RESOLVE.equals(value);
+	}
+	
+	public static boolean isMandatory(Requirement requirement) {
+		Map<String, String> directives = requirement.getDirectives();
+		String value = directives.get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE);
+		return value == null || Namespace.RESOLUTION_MANDATORY.equals(value);
+	}
+	
 	/*
 	 * The Deployed-Content header in the deployment manifest is used to store
 	 * information about explicitly installed resources and provisioned

Modified: aries/branches/java6support/subsystem/subsystem-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-itests/pom.xml?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-itests/pom.xml (original)
+++ aries/branches/java6support/subsystem/subsystem-itests/pom.xml Thu Apr 21 17:21:24 2016
@@ -177,7 +177,7 @@
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.bundlerepository</artifactId>
             <scope>test</scope>
-            <version>1.6.4</version>
+            <version>1.6.6</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.osgi</groupId>
@@ -580,6 +580,44 @@
                     </execution>
 
                     <!-- End of new pom for hello tests, part 1 -->
+                    
+                    <execution>
+                        <id>aries1523host</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <archive>
+                                <manifestFile>src/test/bundles/aries1523host/META-INF/MANIFEST.MF</manifestFile>
+                            </archive>
+                            <classesDirectory>${project.build.directory}/test-classes</classesDirectory>
+                            <includes>
+                                <include>org/apache/aries/subsystem/itests/aries1523host/**</include>
+                            </includes>
+                            <outputDirectory>${project.build.directory}/test-classes/aries1523</outputDirectory>
+                            <finalName>aries1523host</finalName>
+                        </configuration>
+                        <phase>process-test-classes</phase>
+                    </execution>
+                    
+                    <execution>
+                        <id>aries1523fragment</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <archive>
+                                <manifestFile>src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF</manifestFile>
+                            </archive>
+                            <classesDirectory>${project.build.directory}/test-classes</classesDirectory>
+                            <includes>
+                                <include>org/apache/aries/subsystem/itests/aries1523fragment/**</include>
+                            </includes>
+                            <outputDirectory>${project.build.directory}/test-classes/aries1523</outputDirectory>
+                            <finalName>aries1523fragment</finalName>
+                        </configuration>
+                        <phase>process-test-classes</phase>
+                    </execution>
 
                 </executions>
             </plugin>
@@ -679,6 +717,32 @@
                     </execution>
 
                     <!-- End of new pom for hello tests, part 2 -->
+                    
+                    <execution>
+                        <id>add-source-aries1523host</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>src/test/bundles/aries1523host</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                    
+                    <execution>
+                        <id>add-source-aries1523fragment</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>src/test/bundles/aries1523fragment</source>
+                            </sources>
+                        </configuration>
+                    </execution>
 
                     <execution>
                         <id>add-source-classes</id>

Modified: aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java (original)
+++ aries/branches/java6support/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java Thu Apr 21 17:21:24 2016
@@ -155,6 +155,8 @@ public abstract class SubsystemTest exte
                 mavenBundle("org.ops4j.pax.logging",        "pax-logging-service").versionAsInProject(),
                 mavenBundle("org.ops4j.pax.tinybundles",    "tinybundles").versionAsInProject(),
                 mavenBundle("biz.aQute.bnd",                "bndlib").versionAsInProject(),
+                mavenBundle("org.apache.aries.subsystem",	"org.apache.aries.subsystem.obr").versionAsInProject(),
+                mavenBundle("org.apache.felix",				"org.apache.felix.bundlerepository").versionAsInProject(),	
 //				org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777"),
 		};
 	}

Modified: aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java (original)
+++ aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/obr/internal/NamespaceTranslator.java Thu Apr 21 17:21:24 2016
@@ -18,7 +18,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.osgi.framework.namespace.BundleNamespace;
-import org.osgi.framework.namespace.HostNamespace;
 import org.osgi.framework.namespace.PackageNamespace;
 import org.osgi.namespace.service.ServiceNamespace;
 
@@ -30,11 +29,9 @@ public class NamespaceTranslator {
 		result.put(PackageNamespace.PACKAGE_NAMESPACE, org.apache.felix.bundlerepository.Capability.PACKAGE);
 		result.put(ServiceNamespace.SERVICE_NAMESPACE, org.apache.felix.bundlerepository.Capability.SERVICE);
 		result.put(BundleNamespace.BUNDLE_NAMESPACE, org.apache.felix.bundlerepository.Capability.BUNDLE);
-		result.put(HostNamespace.HOST_NAMESPACE, org.apache.felix.bundlerepository.Capability.FRAGMENT);
 		result.put(org.apache.felix.bundlerepository.Capability.PACKAGE, PackageNamespace.PACKAGE_NAMESPACE);
 		result.put(org.apache.felix.bundlerepository.Capability.SERVICE, ServiceNamespace.SERVICE_NAMESPACE);
 		result.put(org.apache.felix.bundlerepository.Capability.BUNDLE, BundleNamespace.BUNDLE_NAMESPACE);
-		result.put(org.apache.felix.bundlerepository.Capability.FRAGMENT, HostNamespace.HOST_NAMESPACE);
 		return Collections.unmodifiableMap(result);
 	}
 	

Modified: aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixRequirementAdapter.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixRequirementAdapter.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixRequirementAdapter.java (original)
+++ aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixRequirementAdapter.java Thu Apr 21 17:21:24 2016
@@ -19,6 +19,7 @@ import java.util.Map;
 
 import org.apache.aries.subsystem.obr.internal.AbstractRequirement;
 import org.apache.aries.subsystem.obr.internal.NamespaceTranslator;
+import org.osgi.framework.namespace.BundleNamespace;
 import org.osgi.resource.Capability;
 import org.osgi.resource.Namespace;
 import org.osgi.resource.Resource;
@@ -63,11 +64,17 @@ public class FelixRequirementAdapter ext
 		/* (1) The Felix OBR specific "mandatory:<*" syntax must be stripped out of the filter.
 		 * (2) The namespace must be translated.
 		 */
-		result.put(Namespace.REQUIREMENT_FILTER_DIRECTIVE, requirement.getFilter()
+		String namespace = getNamespace();
+		String filter = requirement.getFilter()
 				.replaceAll("\\(mandatory\\:\\<\\*[^\\)]*\\)", "")
 				.replaceAll("\\(service\\=[^\\)]*\\)", "")
 				.replaceAll("objectclass", "objectClass")
-				.replaceAll(requirement.getName() + '=', getNamespace() + '='));
+				.replaceAll(requirement.getName() + '=', namespace + '=');
+		if (BundleNamespace.BUNDLE_NAMESPACE.equals(namespace)) {
+			filter = filter.replaceAll("symbolicname", namespace)
+					.replaceAll("version", BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE);
+		}
+		result.put(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter);
 		result.put(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE, requirement.isOptional() ? Namespace.RESOLUTION_OPTIONAL : Namespace.RESOLUTION_MANDATORY);
 		result.put(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE, requirement.isMultiple() ? Namespace.CARDINALITY_MULTIPLE : Namespace.CARDINALITY_SINGLE);
 		return Collections.unmodifiableMap(result);

Modified: aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java (original)
+++ aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/FelixResourceAdapter.java Thu Apr 21 17:21:24 2016
@@ -22,6 +22,7 @@ import java.util.Map;
 
 import org.apache.aries.subsystem.obr.internal.NamespaceTranslator;
 import org.apache.aries.subsystem.obr.internal.ResourceHelper;
+import org.osgi.framework.namespace.HostNamespace;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.resource.Capability;
 import org.osgi.resource.Requirement;
@@ -74,6 +75,13 @@ public class FelixResourceAdapter implem
 			if (namespace != null) {
 				result.trimToSize();
 			    return Collections.unmodifiableList(result);
+			}
+		}
+		if (namespace == null || namespace.equals(HostNamespace.HOST_NAMESPACE)) {
+			result.add(new OsgiWiringHostCapability(this, resource.getSymbolicName(), resource.getVersion()));
+			if (namespace != null) {
+				result.trimToSize();
+			    return Collections.unmodifiableList(result);
 			}
 		}
 		org.apache.felix.bundlerepository.Capability[] capabilities = resource.getCapabilities();

Modified: aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo (original)
+++ aries/branches/java6support/subsystem/subsystem-obr/src/main/java/org/apache/aries/subsystem/util/felix/packageinfo Thu Apr 21 17:21:24 2016
@@ -16,4 +16,4 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-version 1.0.1
+version 1.1.0

Modified: aries/branches/java6support/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java
URL: http://svn.apache.org/viewvc/aries/branches/java6support/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java?rev=1740364&r1=1740363&r2=1740364&view=diff
==============================================================================
--- aries/branches/java6support/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java (original)
+++ aries/branches/java6support/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java Thu Apr 21 17:21:24 2016
@@ -41,6 +41,7 @@ public class FelixResourceAdapterTest {
 		EasyMock.replay(resource);
 		FelixResourceAdapter adapter = new FelixResourceAdapter(resource);
 		List<org.osgi.resource.Capability> caps = adapter.getCapabilities(null);
-		assertEquals("Null namespace should return all capabilities", 3, caps.size());
+		// osgi.identity, osgi.content. osgi.wiring.host, and osgi.wiring.package
+		assertEquals("Null namespace should return all capabilities", 4, caps.size());
 	}
 }



Mime
View raw message