aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1399722 - /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java
Date Thu, 18 Oct 2012 16:19:26 GMT
Author: jwross
Date: Thu Oct 18 16:19:26 2012
New Revision: 1399722

URL: http://svn.apache.org/viewvc?rev=1399722&view=rev
Log:
ARIES-870: Return the correct current wiring from the resolve context used when resolving
a subsystem.

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

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java?rev=1399722&r1=1399721&r2=1399722&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResource.java
Thu Oct 18 16:19:26 2012
@@ -20,6 +20,7 @@ import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -471,6 +472,19 @@ public class SubsystemResource implement
 	
 	private ResolveContext createResolveContext() {
 		return new ResolveContext() {
+			private final Map<Resource, Wiring> wirings = computeWirings();
+			
+			private Map<Resource, Wiring> computeWirings() {
+				Map<Resource, Wiring> wirings = new HashMap<Resource, Wiring>();
+				for (AriesSubsystem subsystem : Activator.getInstance().getSubsystems().getSubsystems())
+					for (Resource constituent : subsystem.getConstituents())
+						if (constituent instanceof BundleRevision) {
+							BundleRevision revision = (BundleRevision)constituent;
+							wirings.put(revision, revision.getWiring());
+						}
+				return Collections.unmodifiableMap(wirings);
+			}
+			
 			@Override
 			public List<Capability> findProviders(Requirement requirement) {
 				List<Capability> result = new ArrayList<Capability>();
@@ -519,8 +533,8 @@ public class SubsystemResource implement
 			}
 
 			@Override
-			public Map<Resource, Wiring> getWirings() {
-				return Collections.emptyMap();
+			public synchronized Map<Resource, Wiring> getWirings() {
+				return wirings;
 			}
 		};
 	}



Mime
View raw message