You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by jw...@apache.org on 2012/02/16 20:50:18 UTC

svn commit: r1245137 - in /aries/trunk/subsystem: subsystem-api/src/main/java/org/osgi/service/subsystem/ subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ subsy...

Author: jwross
Date: Thu Feb 16 19:50:17 2012
New Revision: 1245137

URL: http://svn.apache.org/viewvc?rev=1245137&view=rev
Log:
ARIES-825: Update subsystems to latest Subsystem, Resolver, and Repository APIs.

(1) now fails install if composite specifies version ranges in content header
(2) updated subsystem api with the latest changes from the f2f
(3) updated code to use new subsystem type constants as values for osgi.identity type attribute
(4) Updated tests to use new subsystem type constants.

Added:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemManifestValidator.java
Modified:
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/Subsystem.java
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/SubsystemConstants.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeploymentManifest.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemTypeHeader.java
    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/OsgiIdentityCapability.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemDirectoryResource.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/SubsystemStreamResource.java
    aries/trunk/subsystem/subsystem-itests/src/test/resources/emptyFeature/OSGI-INF/SUBSYSTEM.MF
    aries/trunk/subsystem/subsystem-itests/src/test/resources/feature1/OSGI-INF/SUBSYSTEM.MF
    aries/trunk/subsystem/subsystem-itests/src/test/resources/feature2/OSGI-INF/SUBSYSTEM.MF
    aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/Subsystem.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/Subsystem.java?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/Subsystem.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/Subsystem.java Thu Feb 16 19:50:17 2012
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -98,7 +98,7 @@ import org.osgi.service.resolver.Resolve
  * 		</tr>
  * 		<tr align="center">
  * 			<td>{@link #install(String, InputStream) Install}</td>
- * 			<td>&nbsp;</td>
+ * 			<td> </td>
  * 			<td>{@link State#INSTALLING INSTALLING}, {@link State#INSTALL_FAILED
  *              INSTALL_FAILED}, {@link State#INSTALLED INSTALLED}
  *      	</td>
@@ -130,12 +130,12 @@ import org.osgi.service.resolver.Resolve
  * 		</tr>
  * </table>
  * <p/>
- * A subsystem archive is a ZIP file having an SSA extension and containing
+ * A subsystem archive is a ZIP file having an ESA extension and containing
  * metadata describing the subsystem. The form of the metadata may be a
  * subsystem or deployment manifest, as well as any content resource files. The
  * manifests are optional and will be computed if not present. The subsystem
  * manifest headers may be {@link #getSubsystemHeaders(Locale) retrieved} in raw
- * or localized formats. There are three standard {@link
+ * or localized formats. There are five standard {@link
  * ResourceConstants#IDENTITY_TYPE_ATTRIBUTE types} of resources that may be
  * included in a subsystem.
  * <ul>
@@ -145,8 +145,14 @@ import org.osgi.service.resolver.Resolve
  * 		<li>{@link ResourceConstants#IDENTITY_TYPE_FRAGMENT Fragment} - A
  *          fragment bundle.
  * 		</li>
- * 		<li>{@link SubsystemConstants#IDENTITY_TYPE_SUBSYSTEM Subsystem} - A
- *          subsystem defined by this specification.
+ * 		<li>{@link SubsystemConstants#SUBSYSTEM_TYPE_APPLICATION Application 
+ *          Subsystem} - An application subsystem defined by this specification.
+ * 		</li>
+ * 		<li>{@link SubsystemConstants#SUBSYSTEM_TYPE_COMPOSITE Composite  
+ *          Subsystem} - A composite subsystem defined by this specification.
+ * 		</li>
+ * 		<li>{@link SubsystemConstants#SUBSYSTEM_TYPE_FEATURE Feature 
+ *          Subsystem} - A feature subsystem defined by this specification.
  * 		</li>
  * </ul>
  * Resources contained by a subsystem are called {@link #getConstituents()
@@ -204,7 +210,7 @@ import org.osgi.service.resolver.Resolve
  * 		<li>All existing bundles, including the system and subsystems
  *          implementation bundles, become constituents.
  *      </li>
- *      <li>The type is {@code osgi.composite} with no imports or exports.
+ *      <li>The type is {@code osgi.application} with no imports.
  *      </li>
  * 		<li>The provision policy is {@code acceptTransitive}.
  * 		</li>
@@ -359,7 +365,7 @@ public interface Subsystem {
 	 * map value is the corresponding header value. Because header names are
 	 * case-insensitive, the methods of the map must treat them in a
 	 * case-insensitive manner. If the header name is not found, null is
-	 * returned. Both original and synthesized headers will be included.
+	 * returned. Both original and derived headers will be included.
 	 * <p/>
 	 * The header values are translated according to the specified locale. If
 	 * the specified locale is null or not supported, the raw values are
@@ -484,11 +490,9 @@ public interface Subsystem {
 	 * Returns the {@link SubsystemConstants#SUBSYSTEM_TYPE type} of this
 	 * subsystem.
 	 * <p/>
-	 * The type of the root subsystem is {@link
-	 * SubsystemConstants#SUBSYSTEM_TYPE_COMPOSITE composite}. This method must
-	 * continue to return this subsystem's type while this subsystem is in the
-	 * {@link State#INSTALL_FAILED INSTALL_FAILED} or {@link State#UNINSTALLED
-	 * UNINSTALLED} states.
+	 * This method must continue to return this subsystem's type while this
+	 * subsystem is in the {@link State#INSTALL_FAILED INSTALL_FAILED} or
+	 * {@link State#UNINSTALLED UNINSTALLED} states.
 	 * 
 	 * @return The type of this subsystem.
 	 */
@@ -789,10 +793,10 @@ public interface Subsystem {
 	 * determine how to proceed. An action of Return means this method returns
 	 * immediately without taking any other action.
 	 * <p/>
-	 * <table border="1"">
+	 * <table border="1">
 	 * 		<tr>
-	 * 			<th>State</td>
-	 * 			<th>Action</td>
+	 * 			<th>State</th>
+	 * 			<th>Action</th>
 	 * 		</tr>
 	 * 		<tr align="center">
 	 * 			<td>INSTALLING</td>

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/SubsystemConstants.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/SubsystemConstants.java?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/SubsystemConstants.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/SubsystemConstants.java Thu Feb 16 19:50:17 2012
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,13 +30,6 @@ public class SubsystemConstants {
 	 * Manifest header attribute identifying the deployed version.
 	 */
 	public static final String DEPLOYED_VERSION_ATTRIBUTE = "deployed-version";
-
-	/**
-	 * An identity {@link ResourceConstants#IDENTITY_TYPE_ATTRIBUTE type} 
-	 * attribute value identifying a subsystem resource type.
-	 * It is defined to be &quot;osgi.subsystem.&quot;.
-	 */
-	public static final String IDENTITY_TYPE_SUBSYSTEM = "osgi.subsystem";
 	
 	/**
 	 * Manifest header used to express a preference for particular resources to
@@ -76,12 +69,12 @@ public class SubsystemConstants {
 	public static final String START_LEVEL_DIRECTIVE = "start-level";
 	
 	/**
-	 * The list of subsystem contents identified by a symbolic name and version.
+	 * Manifest header identifying the list of subsystem contents identified by a symbolic name and version.
 	 */
 	public static final String SUBSYSTEM_CONTENT = "Subsystem-Content";
 	
 	/**
-	 * Human readable description.
+	 * Manifest header identifying the human readable description.
 	 */
 	public static final String SUBSYSTEM_DESCRIPTION = "Subsystem-Description";
 	
@@ -103,13 +96,12 @@ public class SubsystemConstants {
 	public static final String SUBSYSTEM_IMPORTSERVICE = "Subsystem-ImportService";
 	
 	/**
-	 * The subsystem manifest version header must be present and equals to 1.0 
-	 * for this version of applications. 
+	 * Manifest header identifying the subsystem manifest version.  If not present, the default value is 1.
 	 */
 	public static final String SUBSYSTEM_MANIFESTVERSION = "Subsystem-ManifestVersion";
 	
 	/**
-	 * Human readable subsystem name.
+	 * Manifest header identifying the human readable subsystem name.
 	 */
 	public static final String SUBSYSTEM_NAME = "Subsystem-Name";
 	
@@ -121,7 +113,7 @@ public class SubsystemConstants {
 	public static final String SUBSYSTEM_STATE_PROPERTY = "subsystem.state";
 	
 	/**
-	 * Symbolic name for the application. Must be present.
+	 * Manifest header value identifying the symbolic name for the subsystem. Must be present.
 	 */
 	public static final String SUBSYSTEM_SYMBOLICNAME = "Subsystem-SymbolicName";
 	
@@ -145,25 +137,31 @@ public class SubsystemConstants {
 	public static final String SUBSYSTEM_TYPE_PROPERTY = "subsystem.type";
 	
 	/**
-	 * Manifest header value identifying an application subsystem.
-	 * It is defined to be &quot;osgi.application&quot;.
+	 * An identity {@link ResourceConstants#IDENTITY_TYPE_ATTRIBUTE type}
+	 * attribute and subsystem {@link #SUBSYSTEM_TYPE type} manifest header
+	 * value identifying an application subsystem. It is defined to be
+	 * &quot;osgi.subsystem.application&quot;.
 	 */
-	public static final String SUBSYSTEM_TYPE_APPLICATION = "osgi.application";
+	public static final String SUBSYSTEM_TYPE_APPLICATION = "osgi.subsystem.application";
 	
 	/**
-	 * Manifest header value identifying a composite subsystem.
-	 * It is defined to be &quot;osgi.composite&quot;.
+	 * An identity {@link ResourceConstants#IDENTITY_TYPE_ATTRIBUTE type}
+	 * attribute and subsystem {@link #SUBSYSTEM_TYPE type} manifest header
+	 * value identifying a composite subsystem. It is defined to be
+	 * &quot;osgi.subsystem.composite&quot;.
 	 */
-	public static final String SUBSYSTEM_TYPE_COMPOSITE = "osgi.composite";
+	public static final String SUBSYSTEM_TYPE_COMPOSITE = "osgi.subsystem.composite";
 	
 	/**
-	 * Manifest header value identifying a feature subsystem.
-	 * It is defined to be &quot;osgi.feature&quot;.
+	 * An identity {@link ResourceConstants#IDENTITY_TYPE_ATTRIBUTE type}
+	 * attribute and subsystem {@link #SUBSYSTEM_TYPE type} manifest header
+	 * value identifying a feature subsystem. It is defined to be
+	 * &quot;osgi.subsystem.feature&quot;.
 	 */
-	public static final String SUBSYSTEM_TYPE_FEATURE = "osgi.feature";
+	public static final String SUBSYSTEM_TYPE_FEATURE = "osgi.subsystem.feature";
 	
 	/**
-	 * Version of the application. If not present, the default value is 0.0.0.
+	 * Manifest header value identifying the version of the subsystem. If not present, the default value is 0.0.0.
 	 */
 	public static final String SUBSYSTEM_VERSION = "Subsystem-Version";
 	

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeploymentManifest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeploymentManifest.java?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeploymentManifest.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeploymentManifest.java Thu Feb 16 19:50:17 2012
@@ -57,19 +57,6 @@ public class DeploymentManifest {
 		this.headers = Collections.unmodifiableMap(headers);
 	}
 	
-//	public DeploymentManifest(DeploymentManifest manifest, boolean autostart, long id, long lastId, String location) {
-//		Map<String, Header<?>> headers = new HashMap<String, Header<?>>(manifest.getHeaders());
-//		headers.put(ARIESSUBSYSTEM_AUTOSTART, new GenericHeader(ARIESSUBSYSTEM_AUTOSTART, Boolean.toString(autostart)));
-//		headers.put(ARIESSUBSYSTEM_ID, new GenericHeader(ARIESSUBSYSTEM_ID, Long.toString(id)));
-//		headers.put(ARIESSUBSYSTEM_LOCATION, new GenericHeader(ARIESSUBSYSTEM_LOCATION, location));
-//		headers.put(ARIESSUBSYSTEM_LASTID, new GenericHeader(ARIESSUBSYSTEM_LASTID, Long.toString(lastId)));
-//		this.headers = Collections.unmodifiableMap(headers);
-//	}
-//	
-//	public DeploymentManifest(SubsystemManifest manifest, SubsystemEnvironment environment) {
-//		this(null, manifest, environment);
-//	}
-	
 	public DeploymentManifest(
 			DeploymentManifest deploymentManifest, 
 			SubsystemManifest subsystemManifest, 
@@ -117,12 +104,11 @@ public class DeploymentManifest {
 			headers.put(SUBSYSTEM_SYMBOLICNAME, subsystemManifest.getSubsystemSymbolicNameHeader());
 			headers.put(SUBSYSTEM_VERSION, subsystemManifest.getSubsystemVersionHeader());
 			SubsystemTypeHeader typeHeader = subsystemManifest.getSubsystemTypeHeader();
-			// TODO Add to constants.
-			if ("osgi.application".equals(typeHeader.getValue())) {
+			if (SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION.equals(typeHeader.getValue())) {
 				// TODO Compute additional headers for an application.
 			}
 			// TODO Add to constants.
-			else if ("osgi.composite".equals(typeHeader.getValue())) {
+			else if (SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(typeHeader.getValue())) {
 				// TODO Compute additional headers for a composite. 
 			}
 			// Features require no additional headers.
@@ -138,57 +124,6 @@ public class DeploymentManifest {
 		this.headers = Collections.unmodifiableMap(headers);
 	}
 	
-//	public DeploymentManifest(DeploymentManifest deploymentManifest, SubsystemManifest subsystemManifest, SubsystemEnvironment environment) {
-//		Map<String, Header<?>> headers;
-//		if (deploymentManifest == null)
-//			headers = new HashMap<String, Header<?>>();
-//		else
-//			headers = new HashMap<String, Header<?>>(deploymentManifest.getHeaders());
-//		// TODO DEPLOYMENT_MANIFESTVERSION
-//		Collection<Resource> resources = new HashSet<Resource>();
-//		SubsystemContentHeader contentHeader = subsystemManifest.getSubsystemContentHeader();
-//		if (contentHeader != null) {
-//			for (SubsystemContentHeader.Content content : contentHeader.getContents()) {
-//				OsgiIdentityRequirement requirement = new OsgiIdentityRequirement(content.getName(), content.getVersionRange(), content.getType(), false);
-//				Resource resource = environment.findResource(requirement);
-//				// If the resource is null, can't continue.
-//				// TODO Actually, can continue if resource is optional.
-//				if (resource == null)
-//					throw new SubsystemException("Resource does not exist: " + requirement);
-//				resources.add(resource);
-//			}
-//			// TODO This does not validate that all content bundles were found.
-//			Map<Resource, List<Wire>> resolution = Activator.getInstance().getServiceProvider().getService(Resolver.class).resolve(environment, new ArrayList<Resource>(resources), Collections.EMPTY_LIST);
-//			// TODO Once we have a resolver that actually returns lists of wires, we can use them to compute other manifest headers such as Import-Package.
-//			Collection<Resource> deployedContent = new HashSet<Resource>();
-//			Collection<Resource> provisionResource = new HashSet<Resource>();
-//			for (Resource resource : resolution.keySet()) {
-//				if (contentHeader.contains(resource))
-//					deployedContent.add(resource);
-//				else
-//					provisionResource.add(resource);
-//			}
-//			// Make sure any already resolved content resources are added back in.
-//			deployedContent.addAll(resources);
-//			headers.put(DEPLOYED_CONTENT, DeployedContentHeader.newInstance(deployedContent));
-//			if (!provisionResource.isEmpty())
-//				headers.put(PROVISION_RESOURCE, ProvisionResourceHeader.newInstance(provisionResource));
-//		}
-//		headers.put(SUBSYSTEM_SYMBOLICNAME, subsystemManifest.getSubsystemSymbolicNameHeader());
-//		headers.put(SUBSYSTEM_VERSION, subsystemManifest.getSubsystemVersionHeader());
-//		SubsystemTypeHeader typeHeader = subsystemManifest.getSubsystemTypeHeader();
-//		// TODO Add to constants.
-//		if ("osgi.application".equals(typeHeader.getValue())) {
-//			// TODO Compute additional headers for an application.
-//		}
-//		// TODO Add to constants.
-//		else if ("osgi.composite".equals(typeHeader.getValue())) {
-//			// TODO Compute additional headers for a composite. 
-//		}
-//		// Features require no additional headers.
-//		this.headers = Collections.unmodifiableMap(headers);
-//	}
-	
 	public DeployedContentHeader getDeployedContentHeader() {
 		return (DeployedContentHeader)getHeaders().get(DEPLOYED_CONTENT);
 	}

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemTypeHeader.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemTypeHeader.java?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemTypeHeader.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemTypeHeader.java Thu Feb 16 19:50:17 2012
@@ -13,12 +13,12 @@
  */
 package org.apache.aries.subsystem.core.archive;
 
+import org.osgi.service.subsystem.SubsystemConstants;
+
 public class SubsystemTypeHeader extends AbstractHeader {
 	public static final SubsystemTypeHeader DEFAULT = new SubsystemTypeHeader();
-	// TODO Add to constants.
-	public static final String DEFAULT_VALUE = "osgi.application";
-	// TODO Add to constants.
-	public static final String NAME = "Subsystem-Type";
+	public static final String DEFAULT_VALUE = SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION;
+	public static final String NAME = SubsystemConstants.SUBSYSTEM_TYPE;
 	
 	public SubsystemTypeHeader() {
 		this(DEFAULT_VALUE);

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=1245137&r1=1245136&r2=1245137&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 Feb 16 19:50:17 2012
@@ -314,6 +314,7 @@ public class AriesSubsystem implements S
 					uri == null ? null : uri.getSymbolicName(), 
 					uri == null ? null : uri.getVersion(), 
 					archive.getResources()));
+			SubsystemManifestValidator.validate(this, archive.getSubsystemManifest());
 			// Unscoped subsystems don't get their own region. They share the region with their scoped parent.
 			if (isFeature())
 				region = parent.region;
@@ -372,7 +373,7 @@ public class AriesSubsystem implements S
 	@Override
 	public List<Capability> getCapabilities(String namespace) {
 		if (namespace == null || namespace.equals(ResourceConstants.IDENTITY_NAMESPACE)) {
-			Capability capability = new OsgiIdentityCapability(this, getSymbolicName(), getVersion(), SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM, getType());
+			Capability capability = new OsgiIdentityCapability(this, getSymbolicName(), getVersion(), getType());
 			return Arrays.asList(new Capability[]{capability});
 		}
 		return Collections.emptyList();
@@ -950,7 +951,9 @@ public class AriesSubsystem implements S
 
 	private void installResource(Resource resource, Coordination coordination, boolean transitive) throws Exception {
 		String type = ResourceHelper.getTypeAttribute(resource);
-		if (SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM.equals(type))
+		if (SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION.equals(type)
+				|| SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(type)
+				|| SubsystemConstants.SUBSYSTEM_TYPE_FEATURE.equals(type))
 			installSubsystemResource(resource, coordination, transitive);
 		else if (ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(type))
 			installBundleResource(resource, coordination, transitive);
@@ -1088,8 +1091,9 @@ public class AriesSubsystem implements S
 
 	private void startResource(Resource resource, Coordination coordination) throws BundleException, IOException {
 		String type = ResourceHelper.getTypeAttribute(resource);
-		// TODO Add to constants.
-		if (SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM.equals(type))
+		if (SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION.equals(type)
+				|| SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(type)
+				|| SubsystemConstants.SUBSYSTEM_TYPE_FEATURE.equals(type))
 			startSubsystemResource(resource, coordination);
 		else if (ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(type))
 			startBundleResource(resource, coordination);
@@ -1122,8 +1126,9 @@ public class AriesSubsystem implements S
 
 	private void stopResource(Resource resource) throws BundleException, IOException {
 		String type = ResourceHelper.getTypeAttribute(resource);
-		// TODO Add to constants.
-		if (SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM.equals(type))
+		if (SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION.equals(type)
+				|| SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(type)
+				|| SubsystemConstants.SUBSYSTEM_TYPE_FEATURE.equals(type))
 			stopSubsystemResource(resource);
 		else if (ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(type))
 			stopBundleResource(resource);
@@ -1166,7 +1171,9 @@ public class AriesSubsystem implements S
 			});
 		}
 		String type = ResourceHelper.getTypeAttribute(resource);
-		if (SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM.equals(type))
+		if (SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION.equals(type)
+				|| SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(type)
+				|| SubsystemConstants.SUBSYSTEM_TYPE_FEATURE.equals(type))
 			uninstallSubsystemResource(resource);
 		else if (ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(type))
 			uninstallBundleResource(resource);

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiIdentityCapability.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiIdentityCapability.java?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiIdentityCapability.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiIdentityCapability.java Thu Feb 16 19:50:17 2012
@@ -24,7 +24,6 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 import org.osgi.framework.resource.Resource;
 import org.osgi.framework.resource.ResourceConstants;
-import org.osgi.service.subsystem.SubsystemConstants;
 
 public class OsgiIdentityCapability extends AbstractCapability {
 	private final Map<String, Object> attributes = new HashMap<String, Object>();
@@ -38,11 +37,7 @@ public class OsgiIdentityCapability exte
 		this(resource, symbolicName, version, ResourceConstants.IDENTITY_TYPE_BUNDLE);
 	}
 	
-	public OsgiIdentityCapability(Resource resource, String symbolicName, Version version, String type) {
-		this(resource, symbolicName, version, type, null);
-	}
-	
-	public OsgiIdentityCapability(Resource resource, String symbolicName, Version version, String identityType, String subsystemType) {
+	public OsgiIdentityCapability(Resource resource, String symbolicName, Version version, String identityType) {
 		this.resource = resource;
 		attributes.put(
 				ResourceConstants.IDENTITY_NAMESPACE, 
@@ -53,9 +48,6 @@ public class OsgiIdentityCapability exte
 		attributes.put(
 				ResourceConstants.IDENTITY_TYPE_ATTRIBUTE, 
 				identityType);
-		if (subsystemType != null)
-			// TODO Add to constants.
-			attributes.put("subsystem-type", subsystemType);
 		// TODO Add directives, particularly "effective" and "singleton".
 	}
 	
@@ -64,7 +56,6 @@ public class OsgiIdentityCapability exte
 				resource,
 				manifest.getSubsystemSymbolicNameHeader().getSymbolicName(),
 				manifest.getSubsystemVersionHeader().getVersion(),
-				SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM,
 				manifest.getSubsystemTypeHeader().getValue());
 	}
 	

Added: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemManifestValidator.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemManifestValidator.java?rev=1245137&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemManifestValidator.java (added)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemManifestValidator.java Thu Feb 16 19:50:17 2012
@@ -0,0 +1,19 @@
+package org.apache.aries.subsystem.core.internal;
+
+import org.apache.aries.subsystem.core.archive.SubsystemContentHeader;
+import org.apache.aries.subsystem.core.archive.SubsystemManifest;
+import org.osgi.service.subsystem.SubsystemException;
+
+public class SubsystemManifestValidator {
+	public static void validate(AriesSubsystem subsystem, SubsystemManifest manifest) {
+		if (subsystem.isComposite()) {
+			SubsystemContentHeader header = manifest.getSubsystemContentHeader();
+			if (header == null)
+				return;
+			for (SubsystemContentHeader.Content content : header.getContents()) {
+				if (!content.getVersionRange().isExactVersion())
+					throw new SubsystemException("Composite subsystem using version range for content: " + content);
+			}
+		}
+	}
+}

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemDirectoryResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemDirectoryResource.java?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemDirectoryResource.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemDirectoryResource.java Thu Feb 16 19:50:17 2012
@@ -12,7 +12,6 @@ import org.osgi.framework.resource.Capab
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
 import org.osgi.framework.resource.ResourceConstants;
-import org.osgi.service.subsystem.SubsystemConstants;
 
 public class SubsystemDirectoryResource implements Resource {
 	private final SubsystemArchive archive;
@@ -26,7 +25,6 @@ public class SubsystemDirectoryResource 
 				this, 
 				manifest.getSubsystemSymbolicNameHeader().getSymbolicName(), 
 				manifest.getSubsystemVersionHeader().getVersion(), 
-				SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM,
 				manifest.getSubsystemTypeHeader().getValue()));
 		this.capabilities = Collections.unmodifiableList(capabilities);
 	}

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=1245137&r1=1245136&r2=1245137&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 Thu Feb 16 19:50:17 2012
@@ -65,7 +65,7 @@ public class SubsystemFileResource imple
 				version = Version.parseVersion(group);
 		}
 		List<Capability> capabilities = new ArrayList<Capability>(1);
-		capabilities.add(new OsgiIdentityCapability(this, symbolicName, version, SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM, type));
+		capabilities.add(new OsgiIdentityCapability(this, symbolicName, version, type));
 		this.capabilities = Collections.unmodifiableList(capabilities);
 		location = "subsystem://?" + SubsystemConstants.SUBSYSTEM_SYMBOLICNAME + '=' + symbolicName + '&' + SubsystemConstants.SUBSYSTEM_VERSION + '=' + version;
 	}

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemStreamResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemStreamResource.java?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemStreamResource.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemStreamResource.java Thu Feb 16 19:50:17 2012
@@ -80,7 +80,7 @@ public class SubsystemStreamResource imp
 		if (version == Version.emptyVersion && uri != null)
 			version = uri.getVersion();
 		List<Capability> capabilities = new ArrayList<Capability>(1);
-		capabilities.add(new OsgiIdentityCapability(this, symbolicName, version, SubsystemConstants.IDENTITY_TYPE_SUBSYSTEM, type));
+		capabilities.add(new OsgiIdentityCapability(this, symbolicName, version, type));
 		this.capabilities = Collections.unmodifiableList(capabilities);
 	}
 	
@@ -112,8 +112,7 @@ public class SubsystemStreamResource imp
 	
 	public String getSubsystemType() {
 		Capability identity = capabilities.get(0);
-		// TODO Add to constants.
-		return (String)identity.getAttributes().get("subsystem-type");
+		return (String)identity.getAttributes().get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE);
 	}
 	
 	public Version getSubsystemVersion() {

Modified: aries/trunk/subsystem/subsystem-itests/src/test/resources/emptyFeature/OSGI-INF/SUBSYSTEM.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/emptyFeature/OSGI-INF/SUBSYSTEM.MF?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/resources/emptyFeature/OSGI-INF/SUBSYSTEM.MF (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/resources/emptyFeature/OSGI-INF/SUBSYSTEM.MF Thu Feb 16 19:50:17 2012
@@ -2,4 +2,4 @@ Manifest-Version: 2.0
 Subsystem-ManifestVersion: 1.0
 Subsystem-SymbolicName: org.apache.aries.subsystem.itests.feature.empty
 Subsystem-Version: 1.1.2
-Subsystem-Type: osgi.feature
\ No newline at end of file
+Subsystem-Type: osgi.subsystem.feature
\ No newline at end of file

Modified: aries/trunk/subsystem/subsystem-itests/src/test/resources/feature1/OSGI-INF/SUBSYSTEM.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/feature1/OSGI-INF/SUBSYSTEM.MF?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/resources/feature1/OSGI-INF/SUBSYSTEM.MF (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/resources/feature1/OSGI-INF/SUBSYSTEM.MF Thu Feb 16 19:50:17 2012
@@ -7,6 +7,6 @@ Subsystem-Description: %feature1.descrip
 Subsystem-Content: org.apache.aries.subsystem.itests.tb1,
  derby;version=10.5.0,
  org.apache.felix.fileinstall;version="[2.0,3.0)",
- org.apache.aries.subsystem.feature2;version=1.0.0;type=osgi.subsystem;start-order:=2,
+ org.apache.aries.subsystem.feature2;version=1.0.0;type=osgi.subsystem.feature;start-order:=2,
  org.apache.aries.subsystem.itests.tb3
-Subsystem-Type: osgi.feature
+Subsystem-Type: osgi.subsystem.feature

Modified: aries/trunk/subsystem/subsystem-itests/src/test/resources/feature2/OSGI-INF/SUBSYSTEM.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/feature2/OSGI-INF/SUBSYSTEM.MF?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/resources/feature2/OSGI-INF/SUBSYSTEM.MF (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/resources/feature2/OSGI-INF/SUBSYSTEM.MF Thu Feb 16 19:50:17 2012
@@ -1,5 +1,5 @@
 Subsystem-SymbolicName: org.apache.aries.subsystem.feature2
 Subsystem-Version: 1.0.0
-Subsystem-Type: osgi.feature
+Subsystem-Type: osgi.subsystem.feature
 Subsystem-Content: org.apache.aries.subsystem.itests.tb2;version=2.0.0,
  org.apache.aries.subsystem.itests.tb3

Modified: aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF?rev=1245137&r1=1245136&r2=1245137&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF Thu Feb 16 19:50:17 2012
@@ -1,3 +1,3 @@
 Subsystem-SymbolicName: org.apache.aries.subsystem.feature3
-Subsystem-Type: osgi.feature
+Subsystem-Type: osgi.subsystem.feature
 Subsystem-Content: org.apache.aries.subsystem.itests.tb3
\ No newline at end of file