aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1330565 - in /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core: internal/ resource/ resource/tmp/
Date Wed, 25 Apr 2012 21:22:47 GMT
Author: jwross
Date: Wed Apr 25 21:22:47 2012
New Revision: 1330565

URL: http://svn.apache.org/viewvc?rev=1330565&view=rev
Log:
ARIES-825: Factored out functionality from resolve context into repository service repository.

Added:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RepositoryServiceRepository.java
      - copied, changed from r1330054, aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/RepositoryServiceRepository.java
Removed:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/RepositoryServiceRepository.java
Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolveContext.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemFileResource.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/tmp/SubsystemResource.java

Copied: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RepositoryServiceRepository.java
(from r1330054, aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/RepositoryServiceRepository.java)
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RepositoryServiceRepository.java?p2=aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RepositoryServiceRepository.java&p1=aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/RepositoryServiceRepository.java&r1=1330054&r2=1330565&rev=1330565&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/RepositoryServiceRepository.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RepositoryServiceRepository.java
Wed Apr 25 21:22:47 2012
@@ -1,4 +1,4 @@
-package org.apache.aries.subsystem.core.resource;
+package org.apache.aries.subsystem.core.internal;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -17,6 +17,10 @@ import org.osgi.service.repository.Repos
 public class RepositoryServiceRepository implements Repository {
 	private final BundleContext context;
 	
+	public RepositoryServiceRepository() {
+		this(Activator.getInstance().getBundleContext());
+	}
+	
 	public RepositoryServiceRepository(BundleContext context) {
 		this.context = context;
 	}

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolveContext.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolveContext.java?rev=1330565&r1=1330564&r2=1330565&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolveContext.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolveContext.java
Wed Apr 25 21:22:47 2012
@@ -144,13 +144,13 @@ public class SubsystemResolveContext ext
 			if (subsystem.isFeature() || identity.isTransitiveDependency())
 				capabilities.addAll(new SystemRepository(subsystem).findProviders(requirement));
 			findArchiveProviders(capabilities, identity);
-			findRepositoryServiceProviders(capabilities, identity);
+			capabilities.addAll(new RepositoryServiceRepository().findProviders(identity));
 		}
 		else {
 			logger.debug("The requirement is NOT an instance of OsgiIdentityRequirement");
 			// This means we're looking for capabilities satisfying a requirement within a content
resource or transitive dependency.
 			findArchiveProviders(capabilities, requirement);
-			findRepositoryServiceProviders(capabilities, requirement);
+			capabilities.addAll(new RepositoryServiceRepository().findProviders(requirement));
 			// TODO The following is a quick fix to ensure this environment always returns capabilities
provided by the system bundle. Needs some more thought.
 			capabilities.addAll(new SystemRepository(subsystem).findProviders(requirement));
 		}
@@ -258,28 +258,6 @@ public class SubsystemResolveContext ext
 		logger.debug(LOG_EXIT, "findArchiveProviders");
 	}
 	
-	private void findRepositoryServiceProviders(Collection<Capability> capabilities, Requirement
requirement) {
-		if (logger.isDebugEnabled())
-			logger.debug(LOG_ENTRY, "findRepositoryServiceProviders", new Object[]{capabilities, requirement});
-		Collection<Repository> repositories = Activator.getInstance().getRepositories();
-		for (Repository repository : repositories) {
-			logger.debug("Evaluating repository: {}", repository);
-			Map<Requirement, Collection<Capability>> map = repository.findProviders(Arrays.asList(requirement));
-			Collection<Capability> caps = map.get(requirement);
-			if (caps != null) {
-				for (Capability capability : caps) {
-					logger.debug("Adding capability: {}", capability);
-					// Filter out capabilities offered by dependencies that will be or
-					// already are provisioned to an out of scope region.
-					if (!requirement.getNamespace().equals(IdentityNamespace.IDENTITY_NAMESPACE) &&
!isContentResource(capability.getResource()) && !validator.isValid(capability))
-						continue;
-					capabilities.add(capability);
-				}
-			}
-		}
-		logger.debug(LOG_EXIT, "findRepositoryServiceProviders");
-	}
-	
 	private void initializeResources(Collection<Resource> resources) {
 		for (Resource resource : resources) {
 			if (isMandatory(resource))

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemFileResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemFileResource.java?rev=1330565&r1=1330564&r2=1330565&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemFileResource.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemFileResource.java
Wed Apr 25 21:22:47 2012
@@ -22,6 +22,7 @@ import org.apache.aries.subsystem.core.a
 import org.apache.aries.subsystem.core.archive.SubsystemTypeHeader;
 import org.apache.aries.subsystem.core.archive.SubsystemVersionHeader;
 import org.apache.aries.subsystem.core.internal.Activator;
+import org.apache.aries.subsystem.core.internal.RepositoryServiceRepository;
 import org.apache.aries.util.filesystem.FileSystem;
 import org.apache.aries.util.filesystem.IDirectory;
 import org.apache.aries.util.filesystem.IFile;

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/tmp/SubsystemResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/tmp/SubsystemResource.java?rev=1330565&r1=1330564&r2=1330565&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/tmp/SubsystemResource.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/tmp/SubsystemResource.java
Wed Apr 25 21:22:47 2012
@@ -24,12 +24,12 @@ import org.apache.aries.subsystem.core.a
 import org.apache.aries.subsystem.core.archive.SubsystemTypeHeader;
 import org.apache.aries.subsystem.core.archive.SubsystemVersionHeader;
 import org.apache.aries.subsystem.core.internal.Activator;
+import org.apache.aries.subsystem.core.internal.RepositoryServiceRepository;
 import org.apache.aries.subsystem.core.internal.SubsystemUri;
 import org.apache.aries.subsystem.core.resource.BundleResource;
 import org.apache.aries.subsystem.core.resource.CompositeRepository;
 import org.apache.aries.subsystem.core.resource.DependencyCalculator;
 import org.apache.aries.subsystem.core.resource.LocalRepository;
-import org.apache.aries.subsystem.core.resource.RepositoryServiceRepository;
 import org.apache.aries.util.filesystem.FileSystem;
 import org.apache.aries.util.filesystem.IDirectory;
 import org.apache.aries.util.filesystem.IFile;



Mime
View raw message