aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1347690 - in /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal: AriesSubsystem.java StartAction.java SubsystemResource.java
Date Thu, 07 Jun 2012 15:48:47 GMT
Author: jwross
Date: Thu Jun  7 15:48:47 2012
New Revision: 1347690

URL: http://svn.apache.org/viewvc?rev=1347690&view=rev
Log:
ARIES-825: Some minor clean up and tweaks before tackling persistence.

Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java
    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/AriesSubsystem.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java?rev=1347690&r1=1347689&r2=1347690&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java
Thu Jun  7 15:48:47 2012
@@ -88,7 +88,6 @@ public class AriesSubsystem implements S
 	
 	private static final Logger LOGGER = LoggerFactory.getLogger(AriesSubsystem.class);
 	
-	final SubsystemResource resource;
 	boolean autostart;
 	
 	private final SubsystemArchive archive;
@@ -96,6 +95,7 @@ public class AriesSubsystem implements S
 	private final long id;
 	private final String location;
 	private final Region region;
+	private final SubsystemResource resource;
 	
 	private Subsystem.State state = State.INSTALLING;
 	 
@@ -180,10 +180,6 @@ public class AriesSubsystem implements S
 		}
 	}
 	
-	public SubsystemArchive getArchive() {
-		return archive;
-	}
-	
 	@Override
 	public BundleContext getBundleContext() {
 		SecurityManager.checkContextPermission(this);
@@ -289,18 +285,6 @@ public class AriesSubsystem implements S
 		}
 	}
 	
-	public boolean isApplication() {
-		return archive.getSubsystemManifest().getSubsystemTypeHeader().isApplication();
-	}
-
-	public boolean isComposite() {
-		return archive.getSubsystemManifest().getSubsystemTypeHeader().isComposite();
-	}
-
-	public boolean isFeature() {
-		return archive.getSubsystemManifest().getSubsystemTypeHeader().isFeature();
-	}
-	
 	/* INSTALLING	Wait, Start
 	 * INSTALLED	-
 	 * RESOLVING	Wait, Start
@@ -390,6 +374,10 @@ public class AriesSubsystem implements S
 		return result;
 	}
 	
+	SubsystemArchive getArchive() {
+		return archive;
+	}
+
 	File getDirectory() {
 		return directory;
 	}
@@ -398,10 +386,12 @@ public class AriesSubsystem implements S
 		return region;
 	}
 	
+	SubsystemManifest getSubsystemManifest() {
+		return resource.getSubsystemManifest();
+	}
+	
 	void install() {
-		Coordination coordination = Activator.getInstance()
-				.getCoordinator()
-				.create(getSymbolicName() + "-" + getSubsystemId(), 0);
+		Coordination coordination = Utils.createCoordination(this);
 		try {
 			// TODO Begin proof of concept.
 			// This is a proof of concept for initializing the relationships between the root subsystem
and bundles
@@ -445,14 +435,14 @@ public class AriesSubsystem implements S
 		// provisioned to regions that are out of scope. This doesn't hurt
 		// anything since the resources are disabled from resolving anyway.
 		setImportIsolationPolicy();
-		// The subsystem resource will be null for the root subsystem.
-		if (this.resource != null) {
+		if (!isRoot()) {
 			Comparator<Resource> comparator = new InstallResourceComparator();
 			// Install dependencies first...
 			List<Resource> dependencies = new ArrayList<Resource>(resource.getInstallableDependencies());
 			Collections.sort(dependencies, comparator);
 			for (Resource resource : dependencies)
 				installResource(resource, coordination, true);
+			// TODO Why aren't shared dependencies being installed here?
 			// ...followed by content.
 			List<Resource> content = new ArrayList<Resource>(resource.getInstallableContent());
 			Collections.sort(content, comparator);
@@ -502,6 +492,22 @@ public class AriesSubsystem implements S
 		else
 			throw new SubsystemException("Unsupported resource type: " + type);
 	}
+	
+	boolean isApplication() {
+		return archive.getSubsystemManifest().getSubsystemTypeHeader().isApplication();
+	}
+
+	boolean isComposite() {
+		return archive.getSubsystemManifest().getSubsystemTypeHeader().isComposite();
+	}
+
+	boolean isFeature() {
+		return archive.getSubsystemManifest().getSubsystemTypeHeader().isFeature();
+	}
+
+	boolean isRoot() {
+		return ROOT_LOCATION.equals(getLocation());
+	}
 
 	boolean isScoped() {
 		return isApplication() || isComposite();
@@ -569,10 +575,8 @@ public class AriesSubsystem implements S
 		// For non-root subsystems, stop any remaining constituents.
 		if (!isRoot()){
 			List<Resource> resources = new ArrayList<Resource>(Activator.getInstance().getSubsystems().getResourcesReferencedBy(this));
-			if (resource != null) {
-				Collections.sort(resources, new StartResourceComparator(resource.getSubsystemManifest().getSubsystemContentHeader()));
-				Collections.reverse(resources);
-			}
+			Collections.sort(resources, new StartResourceComparator(getSubsystemManifest().getSubsystemContentHeader()));
+			Collections.reverse(resources);
 			for (Resource resource : resources) {
 				// Don't stop the region context bundle.
 				if (ResourceHelper.getSymbolicNameAttribute(resource).startsWith(RegionContextBundleHelper.SYMBOLICNAME_PREFIX))
@@ -695,10 +699,6 @@ public class AriesSubsystem implements S
 		return archive.getDeploymentManifest();
 	}
 	
-	private boolean isRoot() {
-		return ROOT_LOCATION.equals(getLocation());
-	}
-	
 	private boolean isUnscoped() {
 		return !isScoped();
 	}

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java?rev=1347690&r1=1347689&r2=1347690&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java
Thu Jun  7 15:48:47 2012
@@ -42,8 +42,8 @@ public class StartAction implements Priv
 				.create(subsystem.getSymbolicName() + '-' + subsystem.getSubsystemId(), 0);
 		try {
 			List<Resource> resources = new ArrayList<Resource>(Activator.getInstance().getSubsystems().getResourcesReferencedBy(subsystem));
-			if (subsystem.resource != null)
-				Collections.sort(resources, new StartResourceComparator(subsystem.resource.getSubsystemManifest().getSubsystemContentHeader()));
+			if (!subsystem.isRoot())
+				Collections.sort(resources, new StartResourceComparator(subsystem.getSubsystemManifest().getSubsystemContentHeader()));
 			for (Resource resource : resources)
 				subsystem.startResource(resource, coordination);
 			subsystem.setState(State.ACTIVE);

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=1347690&r1=1347689&r2=1347690&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 Jun  7 15:48:47 2012
@@ -282,6 +282,8 @@ public class SubsystemResource implement
 	
 	private Resource findContent(OsgiIdentityRequirement requirement) {
 		Map<Requirement, Collection<Capability>> map;
+		// TODO System repository for scoped subsystems should be searched in
+		// the case of a persisted subsystem.
 		if (isUnscoped()) {
 			map = Activator.getInstance().getSystemRepository().findProviders(Collections.singleton(requirement));
 			if (map.containsKey(requirement)) {



Mime
View raw message