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/20 17:44:22 UTC

svn commit: r1291354 [1/2] - in /aries/trunk/subsystem: ./ subsystem-api/src/main/java/org/osgi/service/repository/ subsystem-api/src/main/java/org/osgi/service/resolver/ subsystem-api/src/main/java/org/osgi/service/subsystem/ subsystem-core/src/main/j...

Author: jwross
Date: Mon Feb 20 16:44:20 2012
New Revision: 1291354

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

(1) Cleaned up some uninstall cleanup issues.
(2) Updated subsystems, resolver, and repository APIs to latest.
(3) Updated core and itests to reference new org.osgi.framework.namespace constants instead of ResourceConstants.

Note these updates will break the subsystems build for anyone who does not have access to the updated org.eclipse.equinox.coordinator and org.eclipse.osgi jars. These are not yet available in a public repository but will be soon. Please contact me if you need them (jwross@us.ibm.com).

Modified:
    aries/trunk/subsystem/readme.txt
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/ContentNamespace.java
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/Repository.java
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Environment.java
    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/ResourceHelper.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/AbstractHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ExportPackageHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemManifest.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/internal/OsgiIdentityRequirement.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixRepositoryAdapter.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixResourceAdapter.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/RepositoryAdminRepository.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-core/src/main/java/org/apache/felix/resolver/impl/Candidates.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/impl/HostResource.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/impl/HostedCapability.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/impl/HostedRequirement.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/impl/ResolverImpl.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/impl/Util.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java

Modified: aries/trunk/subsystem/readme.txt
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/readme.txt?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/readme.txt (original)
+++ aries/trunk/subsystem/readme.txt Mon Feb 20 16:44:20 2012
@@ -1,3 +1,12 @@
+***** NOTE ON CURRENT STATUS *****
+Recent changes require updated jars of org.eclipse.osgi and 
+org.eclipse.equinox.coordinator in your local m2 repository in order to build
+successfully. These jars are not yet available from a public repository but will
+be soon. In the meantime, if you require a successful subsystems build (note 
+that subsystems is not included as part of the normal Aries build), please 
+contact me for copies of these jars (jwross@us.ibm.com).
+***** END NOTE ON CURRENT STATUS *****
+
 The Subsystems subproject uses some unreleased and difficult to find equinox 
 artifacts.
 

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/ContentNamespace.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/ContentNamespace.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/ContentNamespace.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/ContentNamespace.java Mon Feb 20 16:44:20 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.
@@ -15,11 +15,11 @@
  */
 package org.osgi.service.repository;
 
-import org.osgi.framework.resource.Requirement;
 
 /**
  * Constants for use in the "osgi.content" namespace. This namespace is used to
- * locate content via the {@link Repository#findProviders(Requirement)} method.
+ * locate content via the {@link Repository#findProviders(java.util.Collection)}
+ * method.
  */
 public final class ContentNamespace {
 	private ContentNamespace() {

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/Repository.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/Repository.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/Repository.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/Repository.java Mon Feb 20 16:44:20 2012
@@ -26,49 +26,50 @@ import java.util.Map;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
-import org.osgi.service.resolver.Environment;
 
 /**
  * Represents a repository that contains {@link Resource resources}.
  * 
  * <p>
- * Repositories may be registered as services and may be used as inputs to an
- * {@link Environment#findProviders(Requirement)} operation.
+ * Repositories may be registered as services and may be used as inputs to
+ * resolver operations.
  * 
  * <p>
  * Repositories registered as services may be filtered using standard service
  * properties.
  * 
  * @ThreadSafe
- * @version $Id: eb3d63491b6a021133bbec533295ad07ca88a348 $
+ * @version $Id: c8ac56d5b6e0376018c8a3bb872010596fc8087a $
  */
 public interface Repository {
-  /**
-   * Service attribute to uniquely identify this repository
-   */
-  final String ID = "repository.id";
+	/**
+	 * Service attribute to uniquely identify this repository
+	 */
+	String	ID				= "repository.id";
 
-  /**
-   * Service attribute to define the name of this repository
-   */
-  final String NAME = "repository.name";
+	/**
+	 * Service attribute to define the name of this repository
+	 */
+	String	NAME			= "repository.name";
 
-  /**
-   * Service attribute to provide a human readable name for this repository
-   */
-  final String DISPLAY_NAME = "repository.displayName";
+	/**
+	 * Service attribute to provide a human readable name for this repository
+	 */
+	String	DISPLAY_NAME	= "repository.displayName";
 
-  /**
-   * Find any capabilities that match the supplied requirements.
-   * 
-   * <p>
-   * See {@link Environment#findProviders} for a discussion on matching.
-   * 
-   * @param requirements the requirements that should be matched
-   *
-   * @return A map of requirements to capabilites that match the supplied requirements
-   * 
-   * @throws NullPointerException if requirements is null
-   */
-  Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements);
+	/**
+	 * Find any capabilities that match the supplied requirements.
+	 * 
+	 * <p>
+	 * See the Resolver specification for a discussion on matching.
+	 * 
+	 * @param requirements the requirements that should be matched
+	 * 
+	 * @return A map of requirements to capabilities that match the supplied
+	 *         requirements
+	 * 
+	 * @throws NullPointerException if requirements is null
+	 */
+	Map<Requirement, Collection<Capability>> findProviders(
+			Collection< ? extends Requirement> requirements);
 }

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Environment.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Environment.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Environment.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Environment.java Mon Feb 20 16:44:20 2012
@@ -47,8 +47,7 @@ import org.osgi.framework.resource.Wirin
  * 
  * <p>
  * An environment may be used to provide capabilities via local {@link Resource
- * resources} and/or remote {@link org.osgi.service.repository.Repository
- * repositories}.
+ * resources} and/or remote repositories.
  * 
  * <p>
  * A resolver may call the {@link #findProviders(Requirement)},
@@ -66,16 +65,17 @@ public interface Environment {
 	 * The returned list contains {@link HostedCapability} objects where the
 	 * Resource must be the declared Resource of the Capability. The Resolver
 	 * can then add additional {@link HostedCapability} objects with the
-	 * {@link #add(Resource, Capability, List)} method when it, for example,
-	 * attaches fragments. Those {@link HostedCapability} objects will then use
-	 * the host's Resource which likely differs from the declared Resource of
-	 * the corresponding Capability.
+	 * {@link #insertHostedCapability(Resource, Capability, List)} method when
+	 * it, for example, attaches fragments. Those {@link HostedCapability}
+	 * objects will then use the host's Resource which likely differs from the
+	 * declared Resource of the corresponding Capability.
 	 * <p>
 	 * The returned list is in priority order, the Capabilities with a lower
 	 * index have a preference over later {@link HostedCapability} objects.
 	 * <p>
 	 * The collection returned is unmodifiable but additional elements can be
-	 * added through the {@link #add(Resource, Capability, List)} method. In
+	 * added through the
+	 * {@link #insertHostedCapability(Resource, Capability, List)} method. In
 	 * general, this is necessary when the Resolver uses Capabilities declared
 	 * in a Resource but that must originate from an attached host.
 	 * <p>

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=1291354&r1=1291353&r2=1291354&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 Mon Feb 20 16:44:20 2012
@@ -23,10 +23,8 @@ import java.util.Map;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Version;
 import org.osgi.framework.hooks.resolver.ResolverHook;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
-import org.osgi.service.repository.Repository;
-import org.osgi.service.resolver.Resolver;
 
 /**
  * A subsystem is a collection of resources constituting a logical, possibly
@@ -34,20 +32,17 @@ import org.osgi.service.resolver.Resolve
  * <p/>
  * A subsystem may be scoped or unscoped. Scoped subsystems are isolated by
  * implicit or explicit sharing policies. Unscoped subsystems are not isolated
- * and, therefore, have no sharing policy. There are three standard {@link
- * SubsystemConstants#SUBSYSTEM_TYPE types} of subsystems.
+ * and, therefore, have no sharing policy. There are three standard
+ * {@link SubsystemConstants#SUBSYSTEM_TYPE types} of subsystems.
  * <ul>
- * 		<li>{@link SubsystemConstants#SUBSYSTEM_TYPE_APPLICATION Application} -
- *          An implicitly scoped subsystem. Nothing is exported, and imports are
- *          computed based on any unsatisfied content dependencies.
- * 		</li>
- * 		<li>{@link SubsystemConstants#SUBSYSTEM_TYPE_COMPOSITE Composite} - An
- *          explicitly scoped subsystem. The sharing policy is defined by
- *          metadata within the subsystem archive.
- * 		</li>
- * 		<li>{@link SubsystemConstants#SUBSYSTEM_TYPE_FEATURE Feature} - An
- *          unscoped subsystem.
- * 		</li>
+ * <li>{@link SubsystemConstants#SUBSYSTEM_TYPE_APPLICATION Application} - An
+ * implicitly scoped subsystem. Nothing is exported, and imports are computed
+ * based on any unsatisfied content dependencies.</li>
+ * <li>{@link SubsystemConstants#SUBSYSTEM_TYPE_COMPOSITE Composite} - An
+ * explicitly scoped subsystem. The sharing policy is defined by metadata within
+ * the subsystem archive.</li>
+ * <li>{@link SubsystemConstants#SUBSYSTEM_TYPE_FEATURE Feature} - An unscoped
+ * subsystem.</li>
  * </ul>
  * Conceptually, a subsystem may be thought of as existing in an isolated region
  * along with zero or more other subsystems. Each region has one and only one
@@ -69,20 +64,17 @@ import org.osgi.service.resolver.Resolve
  * <p/>
  * A subsystem has several unique identifiers.
  * <ul>
- * 		<li>{@link #getLocation() Location} - An identifier specified by the
- *          client as part of installation. It is guaranteed to be unique within
- *          the same framework.
- *     </li>
- * 		<li>{@link #getSubsystemId() ID} - An identifier generated by the
- *          implementation as part of installation. It is guaranteed to be
- *          unique within the same framework.
- * 		<li>{@link #getSymbolicName() Symbolic Name}/{@link #getVersion()
- *          Version} - The combination of symbolic name and version is
- *          guaranteed to be unique within the same region. Although {@link
- *          #getType() type} is not formally part of the identity, two
- *          subsystems with the same symbolic names and versions but different
- *          types are not considered to be equal.
- *     </li>
+ * <li>{@link #getLocation() Location} - An identifier specified by the client
+ * as part of installation. It is guaranteed to be unique within the same
+ * framework.</li>
+ * <li>{@link #getSubsystemId() ID} - An identifier generated by the
+ * implementation as part of installation. It is guaranteed to be unique within
+ * the same framework.
+ * <li>{@link #getSymbolicName() Symbolic Name}/{@link #getVersion() Version} -
+ * The combination of symbolic name and version is guaranteed to be unique
+ * within the same region. Although {@link #getType() type} is not formally part
+ * of the identity, two subsystems with the same symbolic names and versions but
+ * different types are not considered to be equal.</li>
  * </ul>
  * A subsystem has a well-defined {@link State life cycle}. Which stage a
  * subsystem is in may be obtained from the subsystem's {@link #getState()
@@ -91,43 +83,36 @@ import org.osgi.service.resolver.Resolve
  * life cycle operations and states.
  * <p/>
  * <table border="1">
- * 		<tr align="center">
- * 			<th>Operation</th>
- * 			<th>From State</th>
- * 			<th>To State</th>
- * 		</tr>
- * 		<tr align="center">
- * 			<td>{@link #install(String, InputStream) Install}</td>
- * 			<td> </td>
- * 			<td>{@link State#INSTALLING INSTALLING}, {@link State#INSTALL_FAILED
- *              INSTALL_FAILED}, {@link State#INSTALLED INSTALLED}
- *      	</td>
- * 		</tr>
- * 		<tr align="center">
- * 			<td>{@link #start() Start}</td>
- * 			<td>{@link State#INSTALLED INSTALLED}, {@link State#RESOLVED 
- *              RESOLVED}
- *          </td>
- * 			<td>{@link State#INSTALLED INSTALLED}, {@link State#RESOLVING
- *              RESOLVING}, {@link State#RESOLVED RESOLVED}, {@link
- *              State#STARTING STARTING}, {@link State#ACTIVE ACTIVE}
- *      	</td>
- * 		</tr>
- * 		<tr align="center">
- * 			<td>{@link #stop() Stop}</td>
- * 			<td>{@link State#ACTIVE ACTIVE}</td>
- * 			<td>{@link State#RESOLVED RESOLVED}, {@link State#STOPPING STOPPING}
- *      	</td>
- * 		</tr>
- * 		<tr align="center">
- * 			<td>{@link #uninstall() Uninstall}</td>
- * 			<td>{@link State#INSTALLED INSTALLED}, {@link State#RESOLVED
- *              RESOLVED}, {@link State#ACTIVE ACTIVE}
- *      	</td>
- * 			<td>{@link State#UNINSTALLING UNINSTALLING}, {@link
- *              State#UNINSTALLED UNINSTALLED}
- *      	</td>
- * 		</tr>
+ * <tr align="center">
+ * <th>Operation</th>
+ * <th>From State</th>
+ * <th>To State</th>
+ * </tr>
+ * <tr align="center">
+ * <td>{@link #install(String, InputStream) Install}</td>
+ * <td></td>
+ * <td>{@link State#INSTALLING INSTALLING}, {@link State#INSTALL_FAILED
+ * INSTALL_FAILED}, {@link State#INSTALLED INSTALLED}</td>
+ * </tr>
+ * <tr align="center">
+ * <td>{@link #start() Start}</td>
+ * <td>{@link State#INSTALLED INSTALLED}, {@link State#RESOLVED RESOLVED}</td>
+ * <td>{@link State#INSTALLED INSTALLED}, {@link State#RESOLVING RESOLVING},
+ * {@link State#RESOLVED RESOLVED}, {@link State#STARTING STARTING},
+ * {@link State#ACTIVE ACTIVE}</td>
+ * </tr>
+ * <tr align="center">
+ * <td>{@link #stop() Stop}</td>
+ * <td>{@link State#ACTIVE ACTIVE}</td>
+ * <td>{@link State#RESOLVED RESOLVED}, {@link State#STOPPING STOPPING}</td>
+ * </tr>
+ * <tr align="center">
+ * <td>{@link #uninstall() Uninstall}</td>
+ * <td>{@link State#INSTALLED INSTALLED}, {@link State#RESOLVED RESOLVED},
+ * {@link State#ACTIVE ACTIVE}</td>
+ * <td>{@link State#UNINSTALLING UNINSTALLING}, {@link State#UNINSTALLED
+ * UNINSTALLED}</td>
+ * </tr>
  * </table>
  * <p/>
  * A subsystem archive is a ZIP file having an ESA extension and containing
@@ -135,42 +120,31 @@ import org.osgi.service.resolver.Resolve
  * 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 five standard {@link
- * ResourceConstants#IDENTITY_TYPE_ATTRIBUTE types} of resources that may be
- * included in a subsystem.
+ * or localized formats. There are five standard
+ * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE types} of resources that
+ * may be included in a subsystem.
  * <ul>
- * 		<li>{@link ResourceConstants#IDENTITY_TYPE_BUNDLE Bundle} - A bundle
- *          that is not a fragment.
- * 		</li>
- * 		<li>{@link ResourceConstants#IDENTITY_TYPE_FRAGMENT Fragment} - A
- *          fragment bundle.
- * 		</li>
- * 		<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>
+ * <li>{@link IdentityNamespace#TYPE_BUNDLE Bundle} - A bundle that is not a
+ * fragment.</li>
+ * <li>{@link IdentityNamespace#TYPE_FRAGMENT Fragment} - A fragment bundle.</li>
+ * <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()
  * constituents}. There are several ways a resource may become a constituent of
  * a subsystem, at least some of which are listed below.
  * <p/>
  * <ul>
- * 		<li>A resource was listed as part of the subsystem's content.
- * 		</li>
- * 		<li>A subsystem resource is a child of the subsystem.
- * 		</li>
- * 		<li>The subsystem has a provision policy of accept transitive.
- * 		</li>
- * 		<li>A bundle resource was installed using the region bundle context.
- * 		</li>
- * 		<li>A bundle resource was installed using the bundle context of
- *          another resource contained by the subsystem.
- *      </li>
+ * <li>A resource was listed as part of the subsystem's content.</li>
+ * <li>A subsystem resource is a child of the subsystem.</li>
+ * <li>The subsystem has a provision policy of accept dependencies.</li>
+ * <li>A bundle resource was installed using the region bundle context.</li>
+ * <li>A bundle resource was installed using the bundle context of another
+ * resource contained by the subsystem.</li>
  * </ul>
  * In addition to invoking one of the install methods, a subsystem instance may
  * be obtained through the service registry. Every installed subsystem has a
@@ -178,42 +152,30 @@ import org.osgi.service.resolver.Resolve
  * properties.
  * <p/>
  * <ul>
- * 		<li>{@link SubsystemConstants#SUBSYSTEM_ID_PROPERTY ID} - Matches the ID
- *          of the subsystem.
- * 		</li>
- * 		<li>{@link SubsystemConstants#SUBSYSTEM_SYMBOLICNAME_PROPERTY Symbolic
- *          Name} - Matches the symbolic name of the subsystem.
- *      </li>
- * 		<li>{@link SubsystemConstants#SUBSYSTEM_VERSION_PROPERTY Version} -
- *          Matches the version of the subsystem.
- *      </li>
- * 		<li>{@link SubsystemConstants#SUBSYSTEM_TYPE_PROPERTY Type} - Matches
- *          the type of the subsystem.
- *      </li>
- * 		<li>{@link SubsystemConstants#SUBSYSTEM_STATE_PROPERTY State} - Matches
- *          the state of the subsystem.
- *      </li>
+ * <li>{@link SubsystemConstants#SUBSYSTEM_ID_PROPERTY ID} - Matches the ID of
+ * the subsystem.</li>
+ * <li>{@link SubsystemConstants#SUBSYSTEM_SYMBOLICNAME_PROPERTY Symbolic Name}
+ * - Matches the symbolic name of the subsystem.</li>
+ * <li>{@link SubsystemConstants#SUBSYSTEM_VERSION_PROPERTY Version} - Matches
+ * the version of the subsystem.</li>
+ * <li>{@link SubsystemConstants#SUBSYSTEM_TYPE_PROPERTY Type} - Matches the
+ * type of the subsystem.</li>
+ * <li>{@link SubsystemConstants#SUBSYSTEM_STATE_PROPERTY State} - Matches the
+ * state of the subsystem.</li>
  * </ul>
  * Because a subsystem must be used to install other subsystems, a root
  * subsystem is provided as a starting point and has the following
  * characteristics. The root subsystem may only be obtained as a service.
  * <p/>
  * <ul>
- * 		<li>The ID is {@code 0}.
- * 		</li>
- * 		<li>The symbolic name is {@code org.osgi.service.subsystem.root}.
- * 		</li>
- * 		<li>The version matches this specification's version.
- * 		</li>
- * 		<li>It has no parents.
- * 		</li>
- * 		<li>All existing bundles, including the system and subsystems
- *          implementation bundles, become constituents.
- *      </li>
- *      <li>The type is {@code osgi.application} with no imports.
- *      </li>
- * 		<li>The provision policy is {@code acceptTransitive}.
- * 		</li>
+ * <li>The ID is {@code 0}.</li>
+ * <li>The symbolic name is {@code org.osgi.service.subsystem.root}.</li>
+ * <li>The version matches this specification's version.</li>
+ * <li>It has no parents.</li>
+ * <li>All existing bundles, including the system and subsystems implementation
+ * bundles, become constituents.</li>
+ * <li>The type is {@code osgi.subsystem.application} with no imports.</li>
+ * <li>The provision policy is {@code acceptDependencies}.</li>
  * </ul>
  * 
  * @ThreadSafe
@@ -280,7 +242,7 @@ public interface Subsystem {
 		 * <p/>
 		 * A subsystem is in the STARTING state when its {@link Subsystem#
 		 * start() start} method is active, and attempts are being made to start
-		 * its content and transitive resources. If the start method completes
+		 * its content and dependencies. If the start method completes
 		 * without exception, then the subsystem has successfully started and
 		 * must move to the ACTIVE state. Otherwise, the subsystem has failed to
 		 * start and must move to the RESOLVED state.
@@ -289,8 +251,8 @@ public interface Subsystem {
 		/**
 		 * The subsystem is now running.
 		 * <p/>
-		 * A subsystem is in the ACTIVE state when its content and transitive
-		 * resources have been successfully started and activated.
+		 * A subsystem is in the ACTIVE state when its content and dependencies
+		 * have been successfully started and activated.
 		 */
 		ACTIVE,
 		/**
@@ -298,7 +260,7 @@ public interface Subsystem {
 		 * <p/>
 		 * A subsystem is in the STOPPING state when its {@link Subsystem#stop()
 		 * stop} method is active, and attempts are being made to stop its
-		 * content and transitive resources. When the stop method completes, the
+		 * content and dependencies. When the stop method completes, the
 		 * subsystem is stopped and must move to the RESOLVED state.
 		 */
 		STOPPING,
@@ -307,7 +269,7 @@ public interface Subsystem {
 		 * <p/>
 		 * A subsystem is in the UNINSTALLING state when its {@link Subsystem#
 		 * uninstall() uninstall} method is active, and attempts are being made
-		 * to uninstall its constituent and transitive resources. When the
+		 * to uninstall its constituent and dependencies. When the
 		 * uninstall method completes, the subsystem is uninstalled and must
 		 * move to the UNINSTALLED state.
 		 */
@@ -316,7 +278,7 @@ public interface Subsystem {
 		 * The subsystem is uninstalled and may not be used.
 		 * <p/>
 		 * The UNINSTALLED state is only visible after a subsystem's constituent
-		 * and transitive resources are uninstalled. The subsystem is in an
+		 * and dependencies are uninstalled. The subsystem is in an
 		 * unusable state but references to the subsystem object may still be
 		 * available and used for introspection.
 		 */
@@ -559,14 +521,14 @@ public interface Subsystem {
 	 * <p/>
 	 * If the specified {@code content} is null, a new input stream must be
 	 * created from which to read the subsystem by interpreting, in an
-	 * implementation dependent manner, the specified {@code location}. 
+	 * implementation dependent manner, the specified {@code location}.
 	 * <p/>
 	 * A subsystem installation must be persistent. That is, an installed
 	 * subsystem must remain installed across Framework and VM restarts.
 	 * <p/>
 	 * All references to changing the state of this subsystem include both
 	 * changing the state of the subsystem object as well as the state property
-	 * of the subsystem service registration. 
+	 * of the subsystem service registration.
 	 * <p/>
 	 * Implementations should be sensitive to the potential for long running
 	 * operations and periodically check the current thread for interruption. An
@@ -576,76 +538,53 @@ public interface Subsystem {
 	 * <p/>
 	 * All installation failure flows include the following, in order.
 	 * <ol>
-	 * 		<li>Uninstall all resources installed as part of this operation.
-	 *      </li>
-	 * 		<li>Change the state to INSTALL_FAILED.
-	 * 		</li>
-	 *      <li>Unregister the subsystem service.
-	 *      </li>
-	 *      <li>Uninstall the region context bundle.
-	 *      </li>
-	 *      <li>Throw a SubsystemException with the specified cause.
-	 *      </li>
+	 * <li>Uninstall all resources installed as part of this operation.</li>
+	 * <li>Change the state to INSTALL_FAILED.</li>
+	 * <li>Unregister the subsystem service.</li>
+	 * <li>Uninstall the region context bundle.</li>
+	 * <li>Throw a SubsystemException with the specified cause.</li>
 	 * </ol>
-	 * The following steps are required to install a subsystem. 
+	 * The following steps are required to install a subsystem.
 	 * <ol>
 	 * <li>If an installed subsystem with the specified {@code location}
-	 *     identifier already exists, return the installed subsystem.
-	 * </li>
+	 * identifier already exists, return the installed subsystem.</li>
 	 * <li>Read the specified {@code content} in order to determine the symbolic
-	 *     name, version, and type of the installing subsystem. If an error
-	 *     occurs while reading the content, an installation failure results.
-	 * </li>
+	 * name, version, and type of the installing subsystem. If an error occurs
+	 * while reading the content, an installation failure results.</li>
 	 * <li>If an installed subsystem with the same symbolic name and version
-	 *     already exists within this subsystem's region, complete the
-	 *     installation with one of the following.
-	 *     <ul>
-	 *     <li>If the installing and installed subsystems' types are not equal,
-	 *         an installation failure results.
-	 *     </li>
-	 *     <li>If the installing and installed subsystems' types are equal, and
-	 *         the installed subsystem is already a child of this subsystem,
-	 *         return the installed subsystem.
-	 *     </li>
-	 *     <li>If the installing and installed subsystems' types are equal, and
-	 *         the installed subsystem is not already a child of this subsystem,
-	 *         add the installed subsystem as a child of this subsystem,
-	 *         increment the installed subsystem's reference count by one, and
-	 *         return the installed subsystem.
-	 *     </li>
-	 *     </ul>
+	 * already exists within this subsystem's region, complete the installation
+	 * with one of the following.
+	 * <ul>
+	 * <li>If the installing and installed subsystems' types are not equal, an
+	 * installation failure results.</li>
+	 * <li>If the installing and installed subsystems' types are equal, and the
+	 * installed subsystem is already a child of this subsystem, return the
+	 * installed subsystem.</li>
+	 * <li>If the installing and installed subsystems' types are equal, and the
+	 * installed subsystem is not already a child of this subsystem, add the
+	 * installed subsystem as a child of this subsystem, increment the installed
+	 * subsystem's reference count by one, and return the installed subsystem.</li>
+	 * </ul>
 	 * </li>
 	 * <li>Create a new subsystem based on the specified {@code location} and
-	 *     {@code content}.
-	 * </li>
+	 * {@code content}.</li>
 	 * <li>If the subsystem is scoped, install and activate a new region context
-	 *     bundle.
-	 * </li>
-	 * <li>Change the state to INSTALLING and register a new subsystem service.
-	 * </li>
-	 * <li>{@link Repository Discover} the subsystem's content resources. If any
-	 *     mandatory resource is missing, an installation failure results.
-	 * </li>
-	 * <li>{@link Resolver Discover} the transitive resources required by the
-	 *     content resources. If any transitive resource is missing, an
-	 *     installation failure results.
-	 * </li>
-	 * <li>{@link ResolverHook Disable} runtime resolution for the resources.
-	 * </li>
+	 * bundle.</li>
+	 * <li>Change the state to INSTALLING and register a new subsystem service.</li>
+	 * <li>Discover the subsystem's content resources. If any mandatory resource
+	 * is missing, an installation failure results.</li>
+	 * <li>Discover the dependencies required by the content resources. If any
+	 * mandatory dependency is missing, an installation failure results.</li>
+	 * <li>{@link ResolverHook Disable} runtime resolution for the resources.</li>
 	 * <li>For each resource, increment the reference count by one. If the
-	 *     reference count is one, install the resource. All transitive
-	 *     resources must be installed before any content resource. If an error
-	 *     occurs while installing a resource, an install failure results with
-	 *     that error as the cause.
-	 * </li>
-	 * <li>If the subsystem is scoped, enable the import sharing policy.
-	 * </li>
-	 * <li>Enable runtime resolution for the resources.
-	 * </li>
-	 * <li>Change the state of the subsystem to INSTALLED.
-	 * </li>
-	 * <li>Return the new subsystem.
-	 * </li>
+	 * reference count is one, install the resource. All dependencies must be
+	 * installed before any content resource. If an error occurs while
+	 * installing a resource, an install failure results with that error as the
+	 * cause.</li>
+	 * <li>If the subsystem is scoped, enable the import sharing policy.</li>
+	 * <li>Enable runtime resolution for the resources.</li>
+	 * <li>Change the state of the subsystem to INSTALLED.</li>
+	 * <li>Return the new subsystem.</li>
 	 * </ol>
 	 * 
 	 * @param location - The location identifier of the subsystem to be
@@ -658,9 +597,9 @@ public interface Subsystem {
 	 * @throws IllegalStateException If this subsystem's state is in {INSTALLING
 	 *         , INSTALL_FAILED, UNINSTALLING, UNINSTALLED}.
 	 * @throws SubsystemException If the installation failed.
-	 * @throws SecurityException If the caller does not have the appropriate 
-	 *         SubsystemPermission[installed subsystem,LIFECYCLE], and the runtime
-	 *         supports permissions.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         SubsystemPermission[installed subsystem,LIFECYCLE], and the
+	 *         runtime supports permissions.
 	 */
 	public Subsystem install(String location, InputStream content) throws SubsystemException;
 	
@@ -763,7 +702,7 @@ public interface Subsystem {
 	 *      </li>
 	 *      <li>For each eligible resource, increment the activation count by
 	 *          one. If the activation count is one, start the resource. All
-	 *          transitive resources must be started before any content
+	 *          dependencies must be started before any content
 	 *          resource, and content resources must be started according to the
 	 *          specified {@link SubsystemConstants#START_LEVEL_DIRECTIVE start
 	 *          order}. If an error occurs while starting a resource, a start
@@ -862,8 +801,8 @@ public interface Subsystem {
 	 * 		</li>
 	 * 		<li>For each eligible resource, decrement the activation count by
 	 *          one. If the activation count is zero, stop the resource. All
-	 *          content resources must be stopped before any transitive
-	 *          resource, and content resources must be stopped in reverse
+	 *          content resources must be stopped before any dependencies,
+	 *          and content resources must be stopped in reverse
 	 *          {@link SubsystemConstants#START_LEVEL_DIRECTIVE start order}. If
 	 *          an error occurs while stopping a resource, a stop failure
 	 *          results with that error as the cause.
@@ -961,7 +900,7 @@ public interface Subsystem {
 	 * 		</li>
 	 * 		<li>For each resource, decrement the reference count by one. If the
 	 * 			reference count is zero, uninstall the resource. All content
-	 * 			resources must be uninstalled before any transitive resource. If
+	 * 			resources must be uninstalled before any dependencies. If
 	 *          an error occurs while uninstalling a resource, an uninstall
 	 *          failure results with that error as the cause.
 	 *      </li>

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=1291354&r1=1291353&r2=1291354&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 Mon Feb 20 16:44:20 2012
@@ -15,7 +15,7 @@
  */
 package org.osgi.service.subsystem;
 
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.framework.namespace.IdentityNamespace;
 
 /**
  * Defines the constants used by subsystems.
@@ -39,27 +39,27 @@ public class SubsystemConstants {
 	
 	/**
 	 * A value for the {@link #PROVISION_POLICY_DIRECTIVE provision-policy}
-	 * directive indicating the subsystem accepts transitive resources. The root
-	 * subsystem has this provision policy.
+	 * directive indicating the subsystem accepts dependency resources. The root
+	 * subsystem has this provision policy. 
 	 */
-	public static final String PROVISION_POLICY_ACCEPT_TRANSITIVE = "acceptTransitive";
+	public static final String PROVISION_POLICY_ACCEPT_DEPENDENCIES = "acceptDependencies";
 	
 	/**
 	 * Manifest header directive identifying the provision policy. The default 
-	 * value is {@link #PROVISION_POLICY_REJECT_TRANSITIVE rejectTransitive}.
+	 * value is {@link #PROVISION_POLICY_REJECT_DEPENDENCIES rejectDependencies}.
 	 */
 	public static final String PROVISION_POLICY_DIRECTIVE = "provision-policy";
 	
 	/**
 	 * A value for the {@link #PROVISION_POLICY_DIRECTIVE provision-policy}
-	 * directive indicating the subsystem does not accept transitive resources.
+	 * directive indicating the subsystem does not accept dependency resources.
 	 * This is the default value.
 	 */
-	public static final String PROVISION_POLICY_REJECT_TRANSITIVE = "rejectTransitive";
+	public static final String PROVISION_POLICY_REJECT_DEPENDENCIES = "rejectDependencies";
 
 	/**
 	 * Manifest header identifying the resources to be deployed to satisfy the 
-	 * transitive dependencies of a subsystem.
+	 * dependencies of a subsystem.
 	 */
 	public static final String PROVISION_RESOURCE = "Provision-Resource";
 
@@ -137,7 +137,7 @@ public class SubsystemConstants {
 	public static final String SUBSYSTEM_TYPE_PROPERTY = "subsystem.type";
 	
 	/**
-	 * An identity {@link ResourceConstants#IDENTITY_TYPE_ATTRIBUTE type}
+	 * An identity {@link IdentityNamespace#CAPABILITY_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;.
@@ -145,7 +145,7 @@ public class SubsystemConstants {
 	public static final String SUBSYSTEM_TYPE_APPLICATION = "osgi.subsystem.application";
 	
 	/**
-	 * An identity {@link ResourceConstants#IDENTITY_TYPE_ATTRIBUTE type}
+	 * An identity {@link IdentityNamespace#CAPABILITY_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;.
@@ -153,7 +153,7 @@ public class SubsystemConstants {
 	public static final String SUBSYSTEM_TYPE_COMPOSITE = "osgi.subsystem.composite";
 	
 	/**
-	 * An identity {@link ResourceConstants#IDENTITY_TYPE_ATTRIBUTE type}
+	 * An identity {@link IdentityNamespace#CAPABILITY_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;.

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/ResourceHelper.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/ResourceHelper.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/ResourceHelper.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/ResourceHelper.java Mon Feb 20 16:44:20 2012
@@ -26,10 +26,10 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.service.repository.Repository;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,7 +61,7 @@ public class ResourceHelper {
 	}
 	
 	public static Object getIdentityAttribute(Resource resource, String name) {
-		List<Capability> capabilities = resource.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE);
+		List<Capability> capabilities = resource.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
 		Capability capability = capabilities.get(0);
 		return capability.getAttributes().get(name);
 	}
@@ -73,18 +73,18 @@ public class ResourceHelper {
 	}
 	
 	public static String getSymbolicNameAttribute(Resource resource) {
-		return (String)getIdentityAttribute(resource, ResourceConstants.IDENTITY_NAMESPACE);
+		return (String)getIdentityAttribute(resource, IdentityNamespace.IDENTITY_NAMESPACE);
 	}
 	
 	public static String getTypeAttribute(Resource resource) {
-		String result = (String)getIdentityAttribute(resource, ResourceConstants.IDENTITY_TYPE_ATTRIBUTE);
+		String result = (String)getIdentityAttribute(resource, IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE);
 		if (result == null)
 			result = TypeAttribute.DEFAULT_VALUE;
 		return result;
 	}
 	
 	public static Version getVersionAttribute(Resource resource) {
-		Version result = (Version)getIdentityAttribute(resource, ResourceConstants.IDENTITY_VERSION_ATTRIBUTE);
+		Version result = (Version)getIdentityAttribute(resource, IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
 		if (result == null)
 			result = Version.emptyVersion;
 		return result;

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/AbstractHeader.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/AbstractHeader.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/AbstractHeader.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/AbstractHeader.java Mon Feb 20 16:44:20 2012
@@ -21,8 +21,8 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 
 public abstract class AbstractHeader implements Header {
 	protected static final String REGEX = Grammar.CLAUSE + "(?=,|\\z)";
@@ -30,10 +30,10 @@ public abstract class AbstractHeader imp
 	
 	// TODO This is specific to deployment manifests and shouldn't be at this level.
 	protected static void appendResource(Resource resource, StringBuilder builder) {
-		Map<String, Object> attributes = resource.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE).get(0).getAttributes();
-		String symbolicName = (String)attributes.get(ResourceConstants.IDENTITY_NAMESPACE);
-		Version version = (Version)attributes.get(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE);
-		String namespace = (String)attributes.get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE);
+		Map<String, Object> attributes = resource.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).get(0).getAttributes();
+		String symbolicName = (String)attributes.get(IdentityNamespace.IDENTITY_NAMESPACE);
+		Version version = (Version)attributes.get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
+		String namespace = (String)attributes.get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE);
 		builder.append(symbolicName)
 			.append(';')
 			.append(DeployedVersionAttribute.NAME)

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ExportPackageHeader.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ExportPackageHeader.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ExportPackageHeader.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ExportPackageHeader.java Mon Feb 20 16:44:20 2012
@@ -22,9 +22,9 @@ import java.util.Map;
 import org.apache.aries.subsystem.core.resource.AbstractCapability;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.PackageNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 
 public class ExportPackageHeader extends AbstractHeader {
 	public static final String NAME = Constants.EXPORT_PACKAGE;
@@ -41,7 +41,7 @@ public class ExportPackageHeader extends
 				capabilities.add(new AbstractCapability() {
 					@Override
 					public String getNamespace() {
-						return ResourceConstants.WIRING_PACKAGE_NAMESPACE;
+						return PackageNamespace.PACKAGE_NAMESPACE;
 					}
 
 					@Override
@@ -60,7 +60,7 @@ public class ExportPackageHeader extends
 						for (Attribute attribute : attributes)
 							result.put(attribute.getName(), attribute.getValue());
 						// Add the namespace attribute.
-						result.put(ResourceConstants.WIRING_PACKAGE_NAMESPACE, exportedPackage);
+						result.put(PackageNamespace.PACKAGE_NAMESPACE, exportedPackage);
 						// Add the default version, if necessary.
 						if (result.get(Constants.VERSION_ATTRIBUTE) == null)
 							result.put(Constants.VERSION_ATTRIBUTE, Version.emptyVersion);

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemManifest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemManifest.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemManifest.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemManifest.java Mon Feb 20 16:44:20 2012
@@ -16,9 +16,9 @@ import java.util.jar.Manifest;
 import org.apache.aries.util.manifest.ManifestProcessor;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.service.subsystem.SubsystemConstants;
 
 public class SubsystemManifest {
@@ -85,14 +85,14 @@ public class SubsystemManifest {
 			// TODO Better way than using StringBuilder? Would require a more robust SubsystemContentHeader in order to fulfill the Header contract.
 			StringBuilder sb = new StringBuilder();
 			for (Resource resource : content) {
-				Capability c = resource.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE).get(0);
+				Capability c = resource.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).get(0);
 				Map<String, Object> a = c.getAttributes();
-				String s = (String)a.get(ResourceConstants.IDENTITY_NAMESPACE);
-				Version v = (Version)a.get(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE);
-				String t = (String)a.get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE);
+				String s = (String)a.get(IdentityNamespace.IDENTITY_NAMESPACE);
+				Version v = (Version)a.get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
+				String t = (String)a.get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE);
 				sb.append(s).append(';')
-					.append(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE).append('=').append(v).append(';')
-					.append(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE).append('=').append(t).append(',');
+					.append(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE).append('=').append(v).append(';')
+					.append(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE).append('=').append(t).append(',');
 			}
 			if (sb.length() != 0) {
 				// Remove the trailing comma.

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=1291354&r1=1291353&r2=1291354&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 Mon Feb 20 16:44:20 2012
@@ -64,10 +64,10 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.FrameworkWiring;
 import org.osgi.service.coordinator.Coordination;
@@ -374,7 +374,7 @@ public class AriesSubsystem implements S
 	
 	@Override
 	public List<Capability> getCapabilities(String namespace) {
-		if (namespace == null || namespace.equals(ResourceConstants.IDENTITY_NAMESPACE)) {
+		if (namespace == null || namespace.equals(IdentityNamespace.IDENTITY_NAMESPACE)) {
 			Capability capability = new OsgiIdentityCapability(this, getSymbolicName(), getVersion(), getType());
 			return Arrays.asList(new Capability[]{capability});
 		}
@@ -449,53 +449,23 @@ public class AriesSubsystem implements S
 	
 	@Override
 	public Subsystem install(String location, InputStream content) throws SubsystemException {
-		SubsystemStreamResource ssr = null;
+		Coordination coordination = Activator.getInstance().getServiceProvider().getService(Coordinator.class).create(getSymbolicName() + '-' + getSubsystemId(), 0);
+		Subsystem result = null;
 		try {
-			TargetRegion region = new TargetRegion(this);
-			ssr = new SubsystemStreamResource(location, content);
-			AriesSubsystem subsystem = locationToSubsystem.get(location);
-			if (subsystem != null) {
-				if (!region.contains(subsystem))
-					throw new SubsystemException("Location already exists but existing subsystem is not part of target region: " + location);
-				if (!(subsystem.getSymbolicName().equals(ssr.getSubsystemSymbolicName())
-						&& subsystem.getVersion().equals(ssr.getSubsystemVersion())
-						&& subsystem.getType().equals(ssr.getSubsystemType())))
-					throw new SubsystemException("Location already exists but symbolic name, version, and type are not the same: " + location);
-				subsystemGraph.add(this, subsystem);
-				constituents.add(subsystem);
-				return subsystem;
-			}
-			subsystem = (AriesSubsystem)region.find(ssr.getSubsystemSymbolicName(), ssr.getSubsystemVersion());
-			if (subsystem != null) {
-				if (!subsystem.getType().equals(ssr.getSubsystemType()))
-					throw new SubsystemException("Subsystem already exists in target region but has a different type: " + location);
-				subsystemGraph.add(this, subsystem);
-				constituents.add(subsystem);
-				return subsystem;
-			}
-			subsystem = new AriesSubsystem(location, ssr.getContent(), this);
-			Coordination coordination = Activator.getInstance().getServiceProvider().getService(Coordinator.class).create(getSymbolicName() + '-' + getSubsystemId(), 0);
-			try {
-				installSubsystemResource(subsystem, coordination, false);
-				return subsystem;
-			}
-			catch (Exception e) {
-				coordination.fail(e);
-				throw e;
-			}
-			finally {
-				coordination.end();
-			}
+			result = install(location, content, coordination);
 		}
 		catch (Exception e) {
-			LOGGER.error("Subsystem failed to install: " + location, e);
-			throw new SubsystemException(e);
+			coordination.fail(e);
 		}
 		finally {
-			if (ssr != null)
-				ssr.close();
-			IOUtils.close(content);
+			try {
+				coordination.end();
+			}
+			catch (CoordinationException e) {
+				throw new SubsystemException(e);
+			}
 		}
+		return result;
 	}
 	
 	public boolean isApplication() {
@@ -625,40 +595,7 @@ public class AriesSubsystem implements S
 			stop();
 			uninstall();
 		}
-		setState(State.UNINSTALLING);
-		// Uninstall child subsystems first.
-		for (Subsystem subsystem : getChildren()) {
-			try {
-				uninstallSubsystemResource((AriesSubsystem)subsystem);
-			}
-			catch (Exception e) {
-				LOGGER.error("An error occurred while uninstalling resource " + subsystem + " of subsystem " + this, e);
-				// TODO Should FAILED go out for each failure?
-			}
-		}
-		// Uninstall any remaining constituents.
-		for (Resource resource : getConstituents()) {
-			// Don't uninstall the region context bundle here.
-			if (ResourceHelper.getSymbolicNameAttribute(resource).startsWith(RegionContextBundleHelper.SYMBOLICNAME_PREFIX))
-				continue;
-			try {
-				uninstallResource(resource);
-			}
-			catch (Exception e) {
-				LOGGER.error("An error occurred while uninstalling resource " + resource + " of subsystem " + this, e);
-				// TODO Should FAILED go out for each failure?
-			}
-		}
-		for (Subsystem parent : getParents()) {
-			((AriesSubsystem)parent).constituents.remove(this);
-		}
-		subsystemGraph.remove(this);
-		locationToSubsystem.remove(location);
-		deleteFile(directory);
-		setState(State.UNINSTALLED);
-		Activator.getInstance().getSubsystemServiceRegistrar().unregister(this);
-		if (!isFeature())
-			constituents.remove(RegionContextBundleHelper.uninstallRegionContextBundle(this));
+		uninstall(true);
 	}
 	
 	void bundleChanged(BundleEvent event) {
@@ -688,83 +625,17 @@ public class AriesSubsystem implements S
 		return region;
 	}
 	
-	synchronized void install() throws Exception {
-		if (!isFeature())
-			constituents.add(RegionContextBundleHelper.installRegionContextBundle(this));
-		Activator.getInstance().getSubsystemServiceRegistrar().register(this);
-		Set<Resource> contentResources = new TreeSet<Resource>(
-				new Comparator<Resource>() {
-					@Override
-					public int compare(Resource o1, Resource o2) {
-						if (o1.equals(o2))
-							// Consistent with equals.
-							return 0;
-						String t1 = ResourceHelper.getTypeAttribute(o1);
-						String t2 = ResourceHelper.getTypeAttribute(o2);
-						boolean b1 = ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(t1)
-								|| ResourceConstants.IDENTITY_TYPE_FRAGMENT.equals(t1);
-						boolean b2 = ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(t2)
-								|| ResourceConstants.IDENTITY_TYPE_FRAGMENT.equals(t2);
-						if (b1 && !b2)
-							// o1 is a bundle or fragment but o2 is not.
-							return -1;
-						if (!b1 && b2)
-							// o1 is not a bundle or fragment but o2 is.
-							return 1;
-						// Either both or neither are bundles or fragments. In this case we don't care about the order.
-						return -1;
-					}
-				});
-		List<Resource> transitiveDependencies = new ArrayList<Resource>();
-		DeploymentManifest manifest = getDeploymentManifest();
-		DeployedContentHeader contentHeader = manifest.getDeployedContentHeader();
-		if (contentHeader != null) {
-			for (DeployedContent content : contentHeader.getDeployedContents()) {
-				Collection<Capability> capabilities = environment.findProviders(
-						new OsgiIdentityRequirement(content.getName(), content.getDeployedVersion(), content.getNamespace(), false));
-				if (capabilities.isEmpty())
-					throw new SubsystemException("Subsystem content resource does not exist: " + content.getName() + ";version=" + content.getDeployedVersion());
-				Resource resource = capabilities.iterator().next().getResource();
-				contentResources.add(resource);
-			}
-		}
-		ProvisionResourceHeader resourceHeader = manifest.getProvisionResourceHeader();
-		if (resourceHeader != null) {
-			for (ProvisionedResource content : resourceHeader.getProvisionedResources()) {
-				Collection<Capability> capabilities = environment.findProviders(
-						new OsgiIdentityRequirement(content.getName(), content.getDeployedVersion(), content.getNamespace(), true));
-				if (capabilities.isEmpty())
-					throw new SubsystemException("Subsystem provisioned resource does not exist: " + content.getName() + ";version=" + content.getDeployedVersion());
-				Resource resource = capabilities.iterator().next().getResource();
-				transitiveDependencies.add(resource);
-			}
-		}
-		// Install content resources and transitive dependencies.
-		if (!contentResources.isEmpty()) {
-			Coordination coordination = Activator.getInstance().getServiceProvider().getService(Coordinator.class).create(getSymbolicName() + '-' + getSubsystemId(), 0);
-			try {
-				// Install the content resources.
-				for (Resource resource : contentResources) {
-					installResource(resource, coordination, false);
-				}
-				// Discover and install transitive dependencies.
-				for (Resource resource : transitiveDependencies) {
-					installResource(resource, coordination, true);
-				}
-			}
-			catch (Exception e) {
-				// TODO Log this exception? If not, who's responsible for logging it?
-				LOGGER.error("Failed to install subsystem", e);
-				coordination.fail(e);
-				throw e;
-			}
-			finally {
-				coordination.end();
-			}
+	void install() {
+		Coordination coordination = Activator.getInstance()
+				.getServiceProvider().getService(Coordinator.class)
+				.create(getSymbolicName() + "-" + getSubsystemId(), 0);
+		try {
+			install(coordination);
+		} catch (Exception e) {
+			coordination.fail(e);
+		} finally {
+			coordination.end();
 		}
-		setState(State.INSTALLED);
-		if (autostart)
-			start();
 	}
 	
 	void stop0() {
@@ -903,6 +774,109 @@ public class AriesSubsystem implements S
 		}
 		return provisionTo;
 	}
+	
+	private synchronized void install(Coordination coordination) throws Exception {
+		if (!isFeature())
+			constituents.add(RegionContextBundleHelper.installRegionContextBundle(this));
+		Activator.getInstance().getSubsystemServiceRegistrar().register(this);
+		Set<Resource> contentResources = new TreeSet<Resource>(
+				new Comparator<Resource>() {
+					@Override
+					public int compare(Resource o1, Resource o2) {
+						if (o1.equals(o2))
+							// Consistent with equals.
+							return 0;
+						String t1 = ResourceHelper.getTypeAttribute(o1);
+						String t2 = ResourceHelper.getTypeAttribute(o2);
+						boolean b1 = IdentityNamespace.TYPE_BUNDLE.equals(t1)
+								|| IdentityNamespace.TYPE_FRAGMENT.equals(t1);
+						boolean b2 = IdentityNamespace.TYPE_BUNDLE.equals(t2)
+								|| IdentityNamespace.TYPE_FRAGMENT.equals(t2);
+						if (b1 && !b2)
+							// o1 is a bundle or fragment but o2 is not.
+							return -1;
+						if (!b1 && b2)
+							// o1 is not a bundle or fragment but o2 is.
+							return 1;
+						// Either both or neither are bundles or fragments. In this case we don't care about the order.
+						return -1;
+					}
+				});
+		List<Resource> transitiveDependencies = new ArrayList<Resource>();
+		DeploymentManifest manifest = getDeploymentManifest();
+		DeployedContentHeader contentHeader = manifest.getDeployedContentHeader();
+		if (contentHeader != null) {
+			for (DeployedContent content : contentHeader.getDeployedContents()) {
+				Collection<Capability> capabilities = environment.findProviders(
+						new OsgiIdentityRequirement(content.getName(), content.getDeployedVersion(), content.getNamespace(), false));
+				if (capabilities.isEmpty())
+					throw new SubsystemException("Subsystem content resource does not exist: " + content.getName() + ";version=" + content.getDeployedVersion());
+				Resource resource = capabilities.iterator().next().getResource();
+				contentResources.add(resource);
+			}
+		}
+		ProvisionResourceHeader resourceHeader = manifest.getProvisionResourceHeader();
+		if (resourceHeader != null) {
+			for (ProvisionedResource content : resourceHeader.getProvisionedResources()) {
+				Collection<Capability> capabilities = environment.findProviders(
+						new OsgiIdentityRequirement(content.getName(), content.getDeployedVersion(), content.getNamespace(), true));
+				if (capabilities.isEmpty())
+					throw new SubsystemException("Subsystem provisioned resource does not exist: " + content.getName() + ";version=" + content.getDeployedVersion());
+				Resource resource = capabilities.iterator().next().getResource();
+				transitiveDependencies.add(resource);
+			}
+		}
+		// Install the content resources.
+		for (Resource resource : contentResources) {
+			installResource(resource, coordination, false);
+		}
+		// Discover and install transitive dependencies.
+		for (Resource resource : transitiveDependencies) {
+			installResource(resource, coordination, true);
+		}
+		setState(State.INSTALLED);
+		if (autostart)
+			start();
+	}
+	
+	private synchronized Subsystem install(String location, InputStream content, Coordination coordination) throws SubsystemException {
+		SubsystemStreamResource ssr = null;
+		try {
+			TargetRegion region = new TargetRegion(this);
+			ssr = new SubsystemStreamResource(location, content);
+			AriesSubsystem subsystem = locationToSubsystem.get(location);
+			if (subsystem != null) {
+				if (!region.contains(subsystem))
+					throw new SubsystemException("Location already exists but existing subsystem is not part of target region: " + location);
+				if (!(subsystem.getSymbolicName().equals(ssr.getSubsystemSymbolicName())
+						&& subsystem.getVersion().equals(ssr.getSubsystemVersion())
+						&& subsystem.getType().equals(ssr.getSubsystemType())))
+					throw new SubsystemException("Location already exists but symbolic name, version, and type are not the same: " + location);
+				subsystemGraph.add(this, subsystem);
+				constituents.add(subsystem);
+				return subsystem;
+			}
+			subsystem = (AriesSubsystem)region.find(ssr.getSubsystemSymbolicName(), ssr.getSubsystemVersion());
+			if (subsystem != null) {
+				if (!subsystem.getType().equals(ssr.getSubsystemType()))
+					throw new SubsystemException("Subsystem already exists in target region but has a different type: " + location);
+				subsystemGraph.add(this, subsystem);
+				constituents.add(subsystem);
+				return subsystem;
+			}
+			subsystem = new AriesSubsystem(location, ssr.getContent(), this);
+			installSubsystemResource(subsystem, coordination, false);
+			return subsystem;
+		}
+		catch (Exception e) {
+			throw new SubsystemException(e);
+		}
+		finally {
+			if (ssr != null)
+				ssr.close();
+			IOUtils.close(content);
+		}
+	}
 
 	private void installBundleResource(Resource resource, Coordination coordination, boolean transitive) throws BundleException, IOException {
 		AriesSubsystem provisionTo = null;
@@ -956,9 +930,9 @@ public class AriesSubsystem implements S
 				|| SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(type)
 				|| SubsystemConstants.SUBSYSTEM_TYPE_FEATURE.equals(type))
 			installSubsystemResource(resource, coordination, transitive);
-		else if (ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(type))
+		else if (IdentityNamespace.TYPE_BUNDLE.equals(type))
 			installBundleResource(resource, coordination, transitive);
-		else if (ResourceConstants.IDENTITY_TYPE_FRAGMENT.equals(type))
+		else if (IdentityNamespace.TYPE_FRAGMENT.equals(type))
 			installBundleResource(resource, coordination, transitive);
 		else
 			throw new SubsystemException("Unsupported resource type: " + type);
@@ -972,7 +946,7 @@ public class AriesSubsystem implements S
 		}
 		else if (resource instanceof SubsystemFileResource) {
 			SubsystemFileResource sfr = (SubsystemFileResource)resource;
-			subsystem = (AriesSubsystem)install(sfr.getLocation(), sfr.getContent());
+			subsystem = (AriesSubsystem)install(sfr.getLocation(), sfr.getContent(), coordination);
 			return;
 		}
 		else if (resource instanceof SubsystemDirectoryResource) {
@@ -982,34 +956,39 @@ public class AriesSubsystem implements S
 		}
 		else if (resource instanceof RepositoryContent) {
 			String location = getSubsystemId() + "@" + getSymbolicName() + "@" + ResourceHelper.getSymbolicNameAttribute(resource);
-			subsystem = (AriesSubsystem)install(location, ((RepositoryContent)resource).getContent());
+			subsystem = (AriesSubsystem)install(location, ((RepositoryContent)resource).getContent(), coordination);
 			return;
 		}
 		else {
 			throw new IllegalArgumentException("Unrecognized subsystem resource: " + resource);
 		}
-		Set<AriesSubsystem> subsystems = new HashSet<AriesSubsystem>();
-		subsystems.add(this);
-		resourceToSubsystems.put(subsystem, subsystems);
+		// Detect a cycle before becoming a participant; otherwise, install failure cleanup goes awry
+		// because the parent in the cycle (i.e. the subsystem attempting to install here) is cleaned up 
+		// before the child. This results in the child (i.e. this subsystem) being uninstalled as part
+		// of that process, but its state has not moved from INSTALLING to INSTALL_FAILED, which results
+		// in an eternal wait for a state change.
 		subsystemGraph.add(this, subsystem);
-		constituents.add(subsystem);
-		subsystem.install();
 		coordination.addParticipant(new Participant() {
 			public void ended(Coordination coordination) throws Exception {
 				// noop
 			}
 	
 			public void failed(Coordination coordination) throws Exception {
-				subsystem.uninstall();
+				subsystem.setState(State.INSTALL_FAILED);
+				subsystem.uninstall(false);
 				constituents.remove(subsystem);
 				Set<AriesSubsystem> subsystems = resourceToSubsystems.get(subsystem);
 				subsystems.remove(AriesSubsystem.this);
 				if (subsystems.isEmpty())
 					resourceToSubsystems.remove(subsystem);
 				locationToSubsystem.remove(location);
-				subsystem.setState(State.INSTALL_FAILED);
 			}
 		});
+		Set<AriesSubsystem> subsystems = new HashSet<AriesSubsystem>();
+		subsystems.add(this);
+		resourceToSubsystems.put(subsystem, subsystems);
+		constituents.add(subsystem);
+		subsystem.install(coordination);
 	}
 
 	private boolean isRoot() {
@@ -1095,9 +1074,9 @@ public class AriesSubsystem implements S
 				|| SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(type)
 				|| SubsystemConstants.SUBSYSTEM_TYPE_FEATURE.equals(type))
 			startSubsystemResource(resource, coordination);
-		else if (ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(type))
+		else if (IdentityNamespace.TYPE_BUNDLE.equals(type))
 			startBundleResource(resource, coordination);
-		else if (ResourceConstants.IDENTITY_TYPE_FRAGMENT.equals(type)) {
+		else if (IdentityNamespace.TYPE_FRAGMENT.equals(type)) {
 			// Fragments are not started.
 		}
 		else
@@ -1130,7 +1109,7 @@ public class AriesSubsystem implements S
 				|| SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(type)
 				|| SubsystemConstants.SUBSYSTEM_TYPE_FEATURE.equals(type))
 			stopSubsystemResource(resource);
-		else if (ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(type))
+		else if (IdentityNamespace.TYPE_BUNDLE.equals(type))
 			stopBundleResource(resource);
 		else
 			throw new SubsystemException("Unsupported resource type: " + type);
@@ -1139,6 +1118,45 @@ public class AriesSubsystem implements S
 	private void stopSubsystemResource(Resource resource) throws IOException {
 		((AriesSubsystem)resource).stop();
 	}
+	
+	private void uninstall(boolean changeState) {
+		if (changeState)
+			setState(State.UNINSTALLING);
+		// Uninstall child subsystems first.
+		for (Subsystem subsystem : getChildren()) {
+			try {
+				uninstallSubsystemResource((AriesSubsystem)subsystem);
+			}
+			catch (Exception e) {
+				LOGGER.error("An error occurred while uninstalling resource " + subsystem + " of subsystem " + this, e);
+				// TODO Should FAILED go out for each failure?
+			}
+		}
+		// Uninstall any remaining constituents.
+		for (Resource resource : getConstituents()) {
+			// Don't uninstall the region context bundle here.
+			if (ResourceHelper.getSymbolicNameAttribute(resource).startsWith(RegionContextBundleHelper.SYMBOLICNAME_PREFIX))
+				continue;
+			try {
+				uninstallResource(resource);
+			}
+			catch (Exception e) {
+				LOGGER.error("An error occurred while uninstalling resource " + resource + " of subsystem " + this, e);
+				// TODO Should FAILED go out for each failure?
+			}
+		}
+		for (Subsystem parent : getParents()) {
+			((AriesSubsystem)parent).constituents.remove(this);
+		}
+		subsystemGraph.remove(this);
+		locationToSubsystem.remove(location);
+		deleteFile(directory);
+		if (changeState)
+			setState(State.UNINSTALLED);
+		Activator.getInstance().getSubsystemServiceRegistrar().unregister(this);
+		if (!isFeature())
+			constituents.remove(RegionContextBundleHelper.uninstallRegionContextBundle(this));
+	}
 
 	private void uninstallBundleResource(Resource resource) throws BundleException {
 		LOGGER.debug(LOG_ENTRY, "uninstallBundleResource", resource);
@@ -1175,7 +1193,7 @@ public class AriesSubsystem implements S
 				|| SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE.equals(type)
 				|| SubsystemConstants.SUBSYSTEM_TYPE_FEATURE.equals(type))
 			uninstallSubsystemResource(resource);
-		else if (ResourceConstants.IDENTITY_TYPE_BUNDLE.equals(type))
+		else if (IdentityNamespace.TYPE_BUNDLE.equals(type))
 			uninstallBundleResource(resource);
 		else
 			throw new SubsystemException("Unsupported resource type: " + type);

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=1291354&r1=1291353&r2=1291354&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 Mon Feb 20 16:44:20 2012
@@ -22,8 +22,8 @@ import org.apache.aries.subsystem.core.a
 import org.apache.aries.subsystem.core.resource.AbstractCapability;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 
 public class OsgiIdentityCapability extends AbstractCapability {
 	private final Map<String, Object> attributes = new HashMap<String, Object>();
@@ -34,19 +34,19 @@ public class OsgiIdentityCapability exte
 	}
 	
 	public OsgiIdentityCapability(Resource resource, String symbolicName, Version version) {
-		this(resource, symbolicName, version, ResourceConstants.IDENTITY_TYPE_BUNDLE);
+		this(resource, symbolicName, version, IdentityNamespace.TYPE_BUNDLE);
 	}
 	
 	public OsgiIdentityCapability(Resource resource, String symbolicName, Version version, String identityType) {
 		this.resource = resource;
 		attributes.put(
-				ResourceConstants.IDENTITY_NAMESPACE, 
+				IdentityNamespace.IDENTITY_NAMESPACE, 
 				symbolicName);
 		attributes.put(
-				ResourceConstants.IDENTITY_VERSION_ATTRIBUTE, 
+				IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, 
 				version);
 		attributes.put(
-				ResourceConstants.IDENTITY_TYPE_ATTRIBUTE, 
+				IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, 
 				identityType);
 		// TODO Add directives, particularly "effective" and "singleton".
 	}
@@ -64,7 +64,7 @@ public class OsgiIdentityCapability exte
 				resource,
 				manifest.getHeader(Constants.BUNDLE_SYMBOLICNAME).getValue(),
 				Version.parseVersion(manifest.getHeader(Constants.BUNDLE_VERSION).getValue()),
-				ResourceConstants.IDENTITY_TYPE_BUNDLE);
+				IdentityNamespace.TYPE_BUNDLE);
 	}
 
 	public Map<String, Object> getAttributes() {
@@ -76,7 +76,7 @@ public class OsgiIdentityCapability exte
 	}
 
 	public String getNamespace() {
-		return ResourceConstants.IDENTITY_NAMESPACE;
+		return IdentityNamespace.IDENTITY_NAMESPACE;
 	}
 
 	public Resource getResource() {

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiIdentityRequirement.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiIdentityRequirement.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiIdentityRequirement.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiIdentityRequirement.java Mon Feb 20 16:44:20 2012
@@ -25,8 +25,8 @@ import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.service.subsystem.SubsystemException;
 
 public class OsgiIdentityRequirement extends AbstractRequirement {
@@ -35,7 +35,7 @@ public class OsgiIdentityRequirement ext
 				symbolicName,
 				new StringBuilder()
 					.append('(')
-					.append(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE)
+					.append(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)
 					.append('=')
 					.append(version)
 					.append(')')
@@ -51,10 +51,10 @@ public class OsgiIdentityRequirement ext
 	}
 	
 	private static Filter createFilter(Resource resource) {
-		Map<String, Object> attributes = resource.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE).get(0).getAttributes();
-		String symbolicName = String.valueOf(attributes.get(ResourceConstants.IDENTITY_NAMESPACE));
-		Version version = Version.parseVersion(String.valueOf(attributes.get(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE)));
-		String type = String.valueOf(attributes.get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE));
+		Map<String, Object> attributes = resource.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).get(0).getAttributes();
+		String symbolicName = String.valueOf(attributes.get(IdentityNamespace.IDENTITY_NAMESPACE));
+		Version version = Version.parseVersion(String.valueOf(attributes.get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)));
+		String type = String.valueOf(attributes.get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE));
 		return createFilter(symbolicName, version, type);
 	}
 	
@@ -69,13 +69,13 @@ public class OsgiIdentityRequirement ext
 	
 	private static String createFilterString(String symbolicName, String versionFilter, String type) {
 		return new StringBuilder("(&(")
-			.append(ResourceConstants.IDENTITY_NAMESPACE)
+			.append(IdentityNamespace.IDENTITY_NAMESPACE)
 			.append('=')
 			.append(symbolicName)
 			.append(')')
 			.append(versionFilter)
 			.append('(')
-			.append(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE)
+			.append(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE)
 			.append('=')
 			.append(type)
 			.append("))").toString();
@@ -119,7 +119,7 @@ public class OsgiIdentityRequirement ext
 
 	@Override
 	public String getNamespace() {
-		return ResourceConstants.IDENTITY_NAMESPACE;
+		return IdentityNamespace.IDENTITY_NAMESPACE;
 	}
 
 	@Override

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixRepositoryAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixRepositoryAdapter.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixRepositoryAdapter.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixRepositoryAdapter.java Mon Feb 20 16:44:20 2012
@@ -29,10 +29,10 @@ import java.util.regex.Pattern;
 import org.apache.aries.subsystem.core.ResourceHelper;
 import org.apache.aries.subsystem.core.internal.OsgiIdentityCapability;
 import org.osgi.framework.Constants;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.service.repository.Repository;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -73,7 +73,7 @@ public class FelixRepositoryAdapter impl
 		logger.debug(LOG_ENTRY, "findProviders", requirement);
 		update();
 		List<Capability> result = Collections.emptyList();
-		if (ResourceConstants.IDENTITY_NAMESPACE.equals(requirement.getNamespace())) {
+		if (IdentityNamespace.IDENTITY_NAMESPACE.equals(requirement.getNamespace())) {
 			String symbolicName = new IdentityRequirementFilter(requirement.getDirectives().get(Constants.FILTER_DIRECTIVE)).getSymbolicName();
 			logger.debug("Looking for symbolic name {}", symbolicName);
 			Collection<Capability> capabilities = identityIndex.get(symbolicName);
@@ -141,7 +141,7 @@ public class FelixRepositoryAdapter impl
 									resource.getVersion(),
 									// TODO Assuming all resources are bundles. Need to support 
 									// type fragment as well, but how do we know?
-									ResourceConstants.IDENTITY_TYPE_BUNDLE);
+									IdentityNamespace.TYPE_BUNDLE);
 						logger.debug("Indexing capability {}", capability);
 						capabilities.add(capability);
 					}

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixResourceAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixResourceAdapter.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixResourceAdapter.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixResourceAdapter.java Mon Feb 20 16:44:20 2012
@@ -22,10 +22,10 @@ import java.util.List;
 import org.apache.aries.subsystem.core.ResourceHelper;
 import org.apache.aries.subsystem.core.internal.OsgiContentCapability;
 import org.apache.aries.subsystem.core.internal.OsgiIdentityCapability;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.service.repository.RepositoryContent;
 
@@ -73,7 +73,7 @@ public class FelixResourceAdapter implem
 		namespace = toFelixNamespace(namespace);
 		org.apache.felix.bundlerepository.Capability[] capabilities = resource.getCapabilities();
 		ArrayList<Capability> result = new ArrayList<Capability>(capabilities.length);
-		if (namespace == null || namespace.equals(ResourceConstants.IDENTITY_NAMESPACE)) {
+		if (namespace == null || namespace.equals(IdentityNamespace.IDENTITY_NAMESPACE)) {
 			result.add(
 					// TODO Assuming these are all of type osgi.bundle.
 					new OsgiIdentityCapability(

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/RepositoryAdminRepository.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/RepositoryAdminRepository.java?rev=1291354&r1=1291353&r2=1291354&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/RepositoryAdminRepository.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/RepositoryAdminRepository.java Mon Feb 20 16:44:20 2012
@@ -25,9 +25,9 @@ import java.util.Map;
 
 import org.apache.felix.bundlerepository.RepositoryAdmin;
 import org.apache.felix.bundlerepository.Resource;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.service.repository.Repository;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -50,7 +50,7 @@ public class RepositoryAdminRepository i
 	public Collection<Capability> findProviders(Requirement requirement) {
 		logger.debug(LOG_ENTRY, "findProviders", requirement);
 		Collection<Capability> result = Collections.emptyList();
-		if (ResourceConstants.IDENTITY_NAMESPACE.equals(requirement.getNamespace())) {
+		if (IdentityNamespace.IDENTITY_NAMESPACE.equals(requirement.getNamespace())) {
 			result = new ArrayList<Capability>();
 			for (Repository repository : repositories) {
 				Map<Requirement, Collection<Capability>> map = repository.findProviders(Arrays.asList(requirement));

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=1291354&r1=1291353&r2=1291354&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 Mon Feb 20 16:44:20 2012
@@ -8,10 +8,10 @@ import java.util.List;
 import org.apache.aries.subsystem.core.archive.SubsystemArchive;
 import org.apache.aries.subsystem.core.archive.SubsystemManifest;
 import org.apache.aries.subsystem.core.internal.OsgiIdentityCapability;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 
 public class SubsystemDirectoryResource implements Resource {
 	private final SubsystemArchive archive;
@@ -35,7 +35,7 @@ public class SubsystemDirectoryResource 
 	
 	@Override
 	public List<Capability> getCapabilities(String namespace) {
-		if (namespace == null || ResourceConstants.IDENTITY_NAMESPACE.equals(namespace))
+		if (namespace == null || IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace))
 			return capabilities;
 		return Collections.emptyList();
 	}

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=1291354&r1=1291353&r2=1291354&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 Mon Feb 20 16:44:20 2012
@@ -17,10 +17,10 @@ import org.apache.aries.util.filesystem.
 import org.apache.aries.util.filesystem.IDirectory;
 import org.apache.aries.util.manifest.ManifestProcessor;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.service.repository.RepositoryContent;
 import org.osgi.service.subsystem.SubsystemConstants;
 
@@ -72,7 +72,7 @@ public class SubsystemFileResource imple
 	
 	@Override
 	public List<Capability> getCapabilities(String namespace) {
-		if (namespace == null || ResourceConstants.IDENTITY_NAMESPACE.equals(namespace))
+		if (namespace == null || IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace))
 			return capabilities;
 		return Collections.emptyList();
 	}

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=1291354&r1=1291353&r2=1291354&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 Mon Feb 20 16:44:20 2012
@@ -20,10 +20,10 @@ import org.apache.aries.util.filesystem.
 import org.apache.aries.util.io.IOUtils;
 import org.apache.aries.util.manifest.ManifestProcessor;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
 import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.service.repository.RepositoryContent;
 import org.osgi.service.subsystem.SubsystemConstants;
 
@@ -90,7 +90,7 @@ public class SubsystemStreamResource imp
 	
 	@Override
 	public List<Capability> getCapabilities(String namespace) {
-		if (namespace == null || ResourceConstants.IDENTITY_NAMESPACE.equals(namespace))
+		if (namespace == null || IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace))
 			return capabilities;
 		return Collections.emptyList();
 	}
@@ -107,16 +107,16 @@ public class SubsystemStreamResource imp
 	
 	public String getSubsystemSymbolicName() {
 		Capability identity = capabilities.get(0);
-		return (String)identity.getAttributes().get(ResourceConstants.IDENTITY_NAMESPACE);
+		return (String)identity.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE);
 	}
 	
 	public String getSubsystemType() {
 		Capability identity = capabilities.get(0);
-		return (String)identity.getAttributes().get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE);
+		return (String)identity.getAttributes().get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE);
 	}
 	
 	public Version getSubsystemVersion() {
 		Capability identity = capabilities.get(0);
-		return (Version)identity.getAttributes().get(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE);
+		return (Version)identity.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
 	}
 }