aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1501272 - in /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal: Activator.java BundleResource.java BundleRevisionResource.java
Date Tue, 09 Jul 2013 14:03:16 GMT
Author: jwross
Date: Tue Jul  9 14:03:16 2013
New Revision: 1501272

URL: http://svn.apache.org/r1501272
Log:
[aries-952] Make ModelledResourceManager service dependency optional.

Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleRevisionResource.java

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java?rev=1501272&r1=1501271&r2=1501272&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java
Tue Jul  9 14:03:16 2013
@@ -209,8 +209,7 @@ public class Activator implements Bundle
 	private boolean hasRequiredServices() {
 		return coordinator != null &&
 				regionDigraph != null &&
-				resolver != null &&
-				modelledResourceManager != null;
+				resolver != null;
 	}
 	
 	private boolean isActive() {

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java?rev=1501272&r1=1501271&r2=1501272&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java
Tue Jul  9 14:03:16 2013
@@ -71,11 +71,7 @@ public class BundleResource implements R
 		this.content = content;
 		IDirectory dir = content.isDirectory() ? content.convert() : content.convertNested();
 		manifest = computeManifest(dir);
-		// TODO Could use ModelledResourceManager.getServiceElements instead. 
-		// Only the service dependency info is being used right now.
-		ModelledResource resource = getModelledResourceManager().getModelledResource(dir);
-		computeRequirements(resource);
-		computeCapabilities(resource);
+		computeRequirementsAndCapabilities(dir);
 	}
 
 	public List<Capability> getCapabilities(String namespace) {
@@ -136,12 +132,11 @@ public class BundleResource implements R
         return content.toString();
     }
 	
-	private void computeCapabilities(ModelledResource resource) {
+	private void computeCapabilitiesOtherThanService() {
 		computeOsgiIdentityCapability();
 		computeOsgiWiringPackageCapabilities();
 		computeOsgiWiringBundleCapability();
 		computeGenericCapabilities();
-		computeOsgiServiceCapabilities(resource);
 	}
 	
 	private void computeGenericCapabilities() {
@@ -231,12 +226,24 @@ public class BundleResource implements R
 		if (iph != null)
 			requirements.addAll(iph.toRequirements(this));
 	}
-
-	private void computeRequirements(ModelledResource resource) {
+	
+	private void computeRequirementsAndCapabilities(IDirectory directory) throws ModellerException
{
+		computeRequirementsOtherThanService();
+		computeCapabilitiesOtherThanService();
+		ModelledResourceManager manager = getModelledResourceManager();
+		if (manager == null)
+			return;
+		// TODO Could use ModelledResourceManager.getServiceElements instead. 
+		// Only the service dependency info is being used right now.
+		ModelledResource resource = manager.getModelledResource(directory);
+		computeOsgiServiceRequirements(resource);
+		computeOsgiServiceCapabilities(resource);
+	}
+	
+	private void computeRequirementsOtherThanService() {
 		computeOsgiWiringPackageRequirements();
 		computeGenericRequirements();
 		computeOsgiWiringBundleRequirements();
-		computeOsgiServiceRequirements(resource);
 		computeOsgiExecutionEnvironmentRequirement();
 	}
 	

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleRevisionResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleRevisionResource.java?rev=1501272&r1=1501271&r2=1501272&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleRevisionResource.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleRevisionResource.java
Tue Jul  9 14:03:16 2013
@@ -75,6 +75,8 @@ public class BundleRevisionResource impl
 	private ModelledResource computeModelledResource() {
 		Activator activator = Activator.getInstance();
 		ModelledResourceManager manager = activator.getModelledResourceManager();
+		if (manager == null)
+			return null;
 		BundleDirectory directory = new BundleDirectory(revision.getBundle());
 		try {
 			return manager.getModelledResource(directory);
@@ -86,6 +88,8 @@ public class BundleRevisionResource impl
 	
 	private List<Capability> computeServiceCapabilities() {
 		ModelledResource resource = getModelledResource();
+		if (resource == null)
+			return Collections.emptyList();
 		Collection<? extends ExportedService> services = resource.getExportedServices();
 		if (services.isEmpty())
 			return Collections.emptyList();
@@ -102,6 +106,8 @@ public class BundleRevisionResource impl
 	
 	private List<Requirement> computeServiceRequirements() {
 		ModelledResource resource = getModelledResource();
+		if (resource == null)
+			return Collections.emptyList();
 		Collection<? extends ImportedService> services = resource.getImportedServices();
 		if (services.isEmpty())
 			return Collections.emptyList();



Mime
View raw message