aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1163349 [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/java...
Date Tue, 30 Aug 2011 19:36:36 GMT
Author: jwross
Date: Tue Aug 30 19:36:35 2011
New Revision: 1163349

URL: http://svn.apache.org/viewvc?rev=1163349&view=rev
Log:
ARIES-739: Update code based on latest resource, resolver, repository, and subsystem APIs.

Added:
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/package-info.java
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/packageinfo
Modified:
    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/repository/RepositoryBuilder.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/resolver/Resolver.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/Archive.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeployedContentHeader.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/ExportPackageHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/HeaderFactory.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvisionResourceHeader.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/Activator.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/BundleEventHandler.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiContentCapability.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/internal/SubsystemSynchronousBundleListener.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemEnvironment.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemResolver.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixCapabilityAdapter.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/FelixRequirementAdapter.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/OsgiCapabilityAdapter.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/OsgiRequirementAdapter.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/OsgiResourceAdapter.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/BundleResource.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/ResourceFactory.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/SubsystemResource.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/InstallTest.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/RepositoryDescriptorGenerator.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -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(org.osgi.framework.wiring.Requirement...)}
- * method.
+ * locate content via the {@link Repository#findProviders(Requirement)} method.
  */
 public interface 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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -23,23 +23,24 @@ package org.osgi.service.repository;
 import java.net.URL;
 import java.util.Collection;
 
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
+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 org.osgi.service.resolver.Environment#findProviders(Requirement)} operation.
+ * {@link Environment#findProviders(Requirement)} operation.
  * 
  * <p>
  * Repositories registered as services may be filtered using standard service
  * properties.
  * 
  * @ThreadSafe
- * @version $Id: f4cc0fc98cdf67253d3fbca9b39f6a2d6e1464f5 $
+ * @version $Id: bd0cfbdace9a99e3a9d2b16208d7169d3cc6d993 $
  */
 public interface Repository {
   /**
@@ -52,7 +53,7 @@ public interface Repository {
    *  
    * @throws NullPointerException if the requirement is null
    */
-  Collection<Capability> findProviders(Requirement requirement) throws NullPointerException;
+  Collection<Capability> findProviders(Requirement requirement);
 
   /**
    * Lookup the URL where the supplied resource may be accessed, if any.
@@ -68,5 +69,5 @@ public interface Repository {
    *         
    * @throws NullPointerException if the resource is null 
    */
-  URL getContent(Resource resource) throws NullPointerException;
+  URL getContent(Resource resource);
 }

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -20,10 +20,10 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.Wire;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Requirement;
+import org.osgi.framework.resource.Resource;
+import org.osgi.framework.resource.Wire;
 
 /**
  * An environment provides options and constraints to the potential solution of
@@ -76,7 +76,7 @@ public interface Environment {
    *         
    * @throws NullPointerException if the requirement is null 
    */
-  Collection<Capability> findProviders(Requirement requirement) throws NullPointerException;
+  Collection<Capability> findProviders(Requirement requirement);
 
   /**
    * Test if a given requirement should be wired in a given resolve
@@ -94,7 +94,7 @@ public interface Environment {
    * 
    * @throws NullPointerException if requirement is null
    */
-  boolean isEffective(Requirement requirement) throws NullPointerException;
+  boolean isEffective(Requirement requirement);
 
   /**
    * An immutable map of wires between revisions. Multiple calls to this method

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Resolver.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Resolver.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Resolver.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Resolver.java Tue Aug 30 19:36:35 2011
@@ -20,70 +20,90 @@
 
 package org.osgi.service.resolver;
 
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.Wire;
+import org.osgi.framework.resource.Resource;
+import org.osgi.framework.resource.Wire;
 
 /**
  * A resolver is a service interface that can be used to find resolutions for
- * specified {@link Requirement requirements} based on a supplied
- * {@link Environment}.
+ * specified {@link Resource resources} based on a supplied {@link Environment}.
  * 
  * @ThreadSafe
- * @version $Id: 357d1fac9e40b3ed69480dad90f8277714274729 $
+ * @version $Id: 93375420122cbe48e6fba5af207af43826a508fa $
  */
 public interface Resolver {
   /**
-   * Attempt to resolve the requirements based on the specified environment and
-   * return any new revisions or wires to the caller.
+   * Attempt to resolve the resources based on the specified environment and
+   * return any new resources and wires to the caller.
    * 
    * <p>
+   * The resolver considers two groups of resources:
+   * <ul>
+   * <li>Mandatory - any resource in the mandatory group must be resolved, a
+   * failure to satisfy any mandatory requirement for these resources will
+   * result in a {@link ResolutionException}</li>
+   * <li>Optional - any resource in the optional group may be resolved, a
+   * failure to satisfy a mandatory requirement for a resource in this group
+   * will not fail the overall resolution but no resources or wires will be
+   * returned for this resource.</li>
+   * </ul>
+   * 
+   * <h3>Delta</h3>
+   * <p>
    * The resolve method returns the delta between the start state defined by
    * {@link Environment#getWiring()} and the end resolved state, i.e. only new
    * resources and wires are included. To get the complete resolution the caller
    * can merge the start state and the delta using something like the following:
    * 
-   * <pre>Map&lt;Resource, List&lt;Wire&gt;&gt; delta = resolver.resolve(env, requirement);
-Map&lt;Resource, List&lt;Wire&gt;&gt; wiring = env.getWiring();
-      
-for(Map.Entry&lt;Resource, List&lt;Wire&gt;&gt; e : delta.entrySet()) {
-  Resource res = e.getKey();
-  List&lt;Wire&gt; newWires = e.getValue();
-  
-  List&lt;Wire&gt; currentWires = wiring.get(res);
-  if (currentWires != null) {
-    newWires.addAll(currentWires);
-  }
-  
-  wiring.put(res, newWires);
-}</pre>
+   * <pre>
+   * Map&lt;Resource, List&lt;Wire&gt;&gt; delta = resolver.resolve(env, resources, null);
+   * Map&lt;Resource, List&lt;Wire&gt;&gt; wiring = env.getWiring();
+   * 
+   * for (Map.Entry&lt;Resource, List&lt;Wire&gt;&gt; e : delta.entrySet()) {
+   *   Resource res = e.getKey();
+   *   List&lt;Wire&gt; newWires = e.getValue();
+   * 
+   *   List&lt;Wire&gt; currentWires = wiring.get(res);
+   *   if (currentWires != null) {
+   *     newWires.addAll(currentWires);
+   *   }
+   * 
+   *   wiring.put(res, newWires);
+   * }
+   * </pre>
    * 
    * <h3>Consistency</h3>
    * <p>
-   * For a given resolve call an environment should return a consistent set of
-   * capabilities and wires. The simplest mechanism of achieving this is by
-   * creating an immutable snapshot of the environment state and passing this to
-   * the resolve method.
+   * For a given resolve operation the parameters to the resolve method should be
+   * considered immutable. This means that resources should have constant
+   * capabilities and requirements and an environment should return a consistent
+   * set of capabilities, wires and effective requirements.
    * 
    * <p>
-   * If {@link Requirement#getResource} returns null then the
-   * requirement can be wired to any matching capability regardless of the
-   * "uses" constraint directive from the capability. This is because there is
-   * no Resource available to do a class space consistency check against.
+   * The behavior of the resolver is not defined if resources or the environment
+   * supply inconsistent information.
    * 
    * @param environment
    *          the environment into which to resolve the requirements
+   * @param mandatoryResources
+   *          The resources that must be resolved during this resolution step or
+   *          null if no resources must be resolved
+   * @param optionalResources
+   *          Any resources which the resolver should attempt to resolve but
+   *          that will not cause an exception if resolution is impossible or
+   *          null if no resources are optional.
    * 
-   * @param requirements The requirements that the resolver must satisfy
    * @return the new resources and wires required to satisfy the requirements
    * 
-   * @throws ResolutionException if the resolution cannot be satisified for any reason
-   * @throws NullPointerException if environment or any of the requirements are null
+   * @throws ResolutionException
+   *           if the resolution cannot be satisfied for any reason
+   * @throws NullPointerException
+   *           if environment is null
    */
   Map<Resource, List<Wire>> resolve(Environment environment,
-      Requirement... requirements) throws ResolutionException,
-      NullPointerException;  
+      Collection<Resource> mandatoryResources,
+      Collection<Resource> optionalResources) throws ResolutionException;
 }

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -20,19 +20,7 @@ import java.util.Collection;
 import java.util.Map;
 
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Resource;
-
-/*
- * TODO
- * (1) How will the root subsystem handle install, start, stop, update, and
- * uninstall?
- * (2) ResourceProcesser will accept Coordination again. No chaining. Processor
- * is responsible for failing the coordination or throwing exception from ended
- * or failed.
- * (3) Remove coordination from Resource.
- * (4) Do we need to return Resources and Bundles? Just Resources? What?
- * (5) Add description of root subsystem. List unsupported operations.
- */
+import org.osgi.framework.resource.Resource;
 
 /**
  * A representation of a subsystem in the framework. A subsystem is a 
@@ -114,7 +102,12 @@ public interface Subsystem {
 	 * Gets the subsystems managed by this service. This only includes the 
 	 * top-level Subsystems installed in the Framework, CoompositeBundle or 
 	 * Subsystem from which this service has been retrieved.
+	 * 
 	 * @return The Subsystems managed by this service.
+	 * @throws IllegalStateException If the subsystem is in the {@link 
+	 *         State#INSTALLING installing state} or transitioned to the {@link 
+	 *         State#UNINSTALLED uninstalled state} due to a failed 
+	 *         installation.
 	 */
 	public Collection<Subsystem> getChildren();
 	
@@ -125,28 +118,42 @@ public interface Subsystem {
 	 * 
 	 * @return A snapshot of all {@code Resources} currently constituting this
 	 *         {@code Subsystem}.
+	 * @throws IllegalStateException If the subsystem is in the {@link 
+	 *         State#INSTALLING installing state} or transitioned to the {@link 
+	 *         State#UNINSTALLED uninstalled state} due to a failed 
+	 *         installation.
 	 */
 	public Collection<Resource> getConstituents();
 	
 	/**
 	 * Gets the headers used to define this subsystem. The headers will be 
 	 * localized using the locale returned by java.util.Locale.getDefault. This 
-	 * is equivalent to calling getHeaders(null). 
+	 * is equivalent to calling getHeaders(null).
+	 * 
 	 * @return The headers used to define this subsystem.
 	 * @throws SecurityException If the caller does not have the appropriate 
 	 *         AdminPermission[this,METADATA] and the runtime supports 
 	 *         permissions.
+	 * @throws IllegalStateException If the subsystem is in the {@link 
+	 *         State#INSTALLING installing state} or transitioned to the {@link 
+	 *         State#UNINSTALLED uninstalled state} due to a failed 
+	 *         installation.
 	 */
 	public Map<String, String> getHeaders();
 	
 	/**
 	 * Gets the headers used to define this subsystem.
+	 * 
 	 * @param locale The locale name to be used to localize the headers. If the 
 	 *        locale is null then the locale returned by 
 	 *        java.util.Locale.getDefault is used. If the value is the empty 
 	 *        string then the returned headers are returned unlocalized. 
 	 * @return the headers used to define this subsystem, localized to the 
-	 *         specified locale. 
+	 *         specified locale.
+	 * @throws IllegalStateException If the subsystem is in the {@link 
+	 *         State#INSTALLING installing state} or transitioned to the {@link 
+	 *         State#UNINSTALLED uninstalled state} due to a failed 
+	 *         installation.
 	 */
 	public Map<String, String> getHeaders(String locale);
 	
@@ -161,8 +168,13 @@ public interface Subsystem {
 	
 	/**
 	 * Gets the parent Subsystem that scopes this subsystem instance.
+	 * 
 	 * @return The Subsystem that scopes this subsystem or null if there is no 
 	 *         parent subsystem (e.g. if the outer scope is the framework).
+	 * @throws IllegalStateException If the subsystem is in the {@link 
+	 *         State#INSTALLING installing state} or transitioned to the {@link 
+	 *         State#UNINSTALLED uninstalled state} due to a failed 
+	 *         installation.
 	 */
 	public Subsystem getParent();
 	
@@ -181,13 +193,23 @@ public interface Subsystem {
 	
 	/**
 	 * Gets the symbolic name of this subsystem.
+	 * 
 	 * @return The symbolic name of this subsystem.
+	 * @throws IllegalStateException If the subsystem is in the {@link 
+	 *         State#INSTALLING installing state} or transitioned to the {@link 
+	 *         State#UNINSTALLED uninstalled state} due to a failed 
+	 *         installation.
 	 */
 	public String getSymbolicName();
 	
 	/**
 	 * Gets the version of this subsystem.
+	 * 
 	 * @return The version of this subsystem.
+	 * @throws IllegalStateException If the subsystem is in the {@link 
+	 *         State#INSTALLING installing state} or transitioned to the {@link 
+	 *         State#UNINSTALLED uninstalled state} due to a failed 
+	 *         installation.
 	 */
 	public Version getVersion();
 	
@@ -227,28 +249,32 @@ public interface Subsystem {
 	 * The following steps are required to install a subsystem:
 	 * <ol>
 	 * 		<li>If there is an existing subsystem containing the same location 
-	 *          identifier as the Subsystem to be installed, then a Future is 
-	 *          returned that has the existing subsystem immediately available 
-	 *          as its result.</li>
-	 * 		<li>If there is already an install in progress for a subsystem with 
-	 *          the same location identifier, then the Future returned is the 
-	 *          same as the Future returned for the first install and a new 
-	 *          install is not started.</li>
-	 * 		<li>If this is a new install, then a new Future is returned with 
-	 *          the installation process following the remaining step.</li>
+	 *          identifier as the subsystem to be installed, then the existing
+	 *          subsystem is returned.</li>
+	 * 		<li>If this is a new install, then a new Subsystem is created with 
+	 *          its id set to the next available value (ascending order).</li>
+	 * 		<li>The subsystem's state is set to INSTALLING and if EventAdmin is 
+	 *          available, an event of type INSTALLING is fired.</li>
+	 *      <li>The following installation steps are then started and performed 
+	 *          asynchronously and the new subsystem is returned to the caller.</li>
 	 * 		<li>The subsystem content is read from the input stream.</li>
-	 * 		<li>Isolation is set up while the install is in progress, such that 
-	 *          none of the content can be resolved with bundles outside the 
-	 *          subsystem.</li>
-	 * 		<li>The resources are into the framework through the use of 
-	 *          ResourceProcessors.</li>
-	 * 		<li>Isolation is configured appropriate for the subsystem such that 
-	 *          the content can be resolved with bundles outside the subsystem.</li>
-	 * 		<li>The subsystem's state is set to INSTALLED.</li>
-	 * 		<li>The subsystem event of type INSTALLED is fired.</li>
-	 * 		<li>The subsystem content is started.</li>
-	 * 		<li>The subsystem object for the newly installed subsystem is made 
-	 *          available from the Future.</li>
+	 * 		<li>If the subsystem requires isolation (i.e. is an application or 
+	 *          a composite), then isolation is set up while the install is in 
+	 *          progress, such that none of the content bundles can be resolved.
+	 *          This isolation is not changed until the subsystem is explicitly 
+	 *          requested to resolve (i.e. as a result of a Subsystem.start() 
+	 *          operation).</li>
+	 * 		<li>If the subsystem does not include a deployment manifest, then 
+	 *          the subsystem runtime must calculate one.</li>
+	 * 		<li>The resources identified in the deployment manifest are 
+	 *          installed into the framework.  All content resources are 
+	 *          installed into the Subsystem, whereas transitive dependencies 
+	 *          are installed into an ancestor subsystem. If any resources fail 
+	 *          to install, then the entire installation is failed. Transitive 
+	 *          resources are free to resolve and start independent of the 
+	 *          subsystem they were installed for.</li>
+	 * 		<li>The subsystem's state is set to INSTALLED and if EventAdmin is 
+	 *          available an INSTALLED event is fired.</li>
 	 * </ol>
 	 * @param location The location identifier of the subsystem to be installed.
 	 * @param content The InputStream from where the subsystem is to be 
@@ -293,11 +319,9 @@ public interface Subsystem {
 	 * This method causes the Framework to notify other bundles and subsystems 
 	 * that this subsystem is being uninstalled, and then puts this subsystem 
 	 * into the UNINSTALLED state. The Framework must remove any resources 
-	 * related to this subsystem that it is able to remove. It does so using the 
-	 * appropriate ResourceProcessor.uninstall(Subsystem, Resource, 
-	 * Coordination) for the resource namespace. If this subsystem has exported 
-	 * any packages, the Framework must continue to make these packages 
-	 * available to their importing bundles or subsystems until the 
+	 * related to this subsystem that it is able to remove. If this subsystem 
+	 * has exported any packages, the Framework must continue to make these 
+	 * packages available to their importing bundles or subsystems until the 
 	 * org.osgi.service.packageadmin.PackageAdmin.refreshPackages(
 	 * org.osgi.framework.Bundle[]) method has been called or the Framework is 
 	 * relaunched. The following steps are required to uninstall a subsystem:

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -15,21 +15,12 @@
  */
 package org.osgi.service.subsystem;
 
-/*
- * TODO
- * There are disparities within the ODT between Field Summary and Field Detail.
- * This interface is currently combines Field Summary and Field Detail.
- */
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+import org.osgi.framework.resource.ResourceConstants;
 
 /**
- * Defines the constants used by subsystems. These fall into four categories: 
- * <ol>
- * 		<li>Headers for the applications subsystem type.</li>
- * 		<li>Headers for the composite bundle subsystem type. Where appropriate, 
- *          these header values are identical to those for a bundle.</li> 
- * 		<li>Headers for the library subsystem type.</li>
- * 		<li>Attributes used in the above headers</li>
- * </ol>
+ * Defines the constants used by subsystems.
  */
 public class SubsystemConstants {
 	private SubsystemConstants() {
@@ -37,245 +28,56 @@ public class SubsystemConstants {
 	}
 	
 	/**
-	 * The list of application contents identified by a symbolic name and 
-	 * version.
-	 */
-	public static final String APPLICATION_CONTENT = "";
-	/**
-	 * Human readable description.
-	 */
-	public static final String APPLICATION_DESCRIPTION = "";
-	/**
-	 * Name of the resource to use for localized headers.
-	 */
-	public static final String APPLICATION_LOCALIZATION = "";
-	/**
-	 * The subsystem manifest version header must be present and equals to 1.0 
-	 * for this version of applications. 
-	 */
-	public static final String APPLICATION_MANIFESTVERSION = "";
-	/**
-	 * Human readable application name.
-	 */
-	public static final String APPLICATION_NAME = "";
-	/**
-	 * Descriptions of resources contained within the application archive which 
-	 * cannot be determine reflectively. 
-	 */
-	public static final String APPLICATION_RESOURCES = "";
-	/**
-	 * Symbolic name for the application. Must be present.
-	 */
-	public static final String APPLICATION_SYMBOLICNAME = "";
-	/**
-	 * Location to use when updating the application.
-	 */
-	public static final String APPLICATION_UPDATELOCATION = "";
-	/**
-	 * Version of the application. If not present, the default value is 0.0.0.
-	 */
-	public static final String APPLICATION_VERSION = "";
-	/**
-	 * The human readable composite bundle description (re-using the bundle 
-	 * header). 
+	 * Manifest header identifying the resources to be deployed.
 	 */
-	public static final String BUNDLE_DESCRIPTION = "";
-	/**
-	 * The packages to be exported by the composite bundle for use outside the 
-	 * composite bundle (re-using the bundle header). The packages declarations 
-	 * must match a package provide by a bundle listed in the composite bundle 
-	 * content. 
-	 */
-	public static final String BUNDLE_EXPORTPACKAGE = "";
-	/**
-	 * The packages to be imported into the composite bundle for use by the 
-	 * composite bundle contents (re-using the bundle header). 
-	 */
-	public static final String BUNDLE_IMPORTPACKAGE = "";
-	/**
-	 * Name of the resource to use for localized headers (re-using the bundle 
-	 * header). 
-	 */
-	public static final String BUNDLE_LOCALIZATION = "";
-	/**
-	 * The human readable composite bundle name (re-using the bundle header). 
-	 */
-	public static final String BUNDLE_NAME = "";
-	/**
-	 * A list of Bundles the composite bundle requires (re-using the bundle 
-	 * header). These bundles are made available to satisfy Require-Bundle 
-	 * statements for the composite bundle content bundles. 
-	 */
-	public static final String BUNDLE_REQUIREBUNDLE = "";
-	/**
-	 * Symbolic name for the composite bundle (re-using the bundle header). 
-	 * Must be present. 
-	 */
-	public static final String BUNDLE_SYMBOLICNAME = "";
-	/**
-	 * Location to use when updating the composite bundle (re-using the bundle 
-	 * header). 
-	 */
-	public static final String BUNDLE_UPDATELOCATION = "";
-	/**
-	 * Version of the composite bundle (re-using the bundle header). If not 
-	 * present, the default value is 0.0.0. 
-	 */
-	public static final String BUNDLE_VERSION = "";
-	/**
-	 * The list of composite bundle contents identified by a symbolic name and 
-	 * version.
-	 */
-	public static final String COMPOSITEBUNDLE_CONTENT = "";
-	/**
-	 * A list of service filters used to identify the services provided by 
-	 * bundles inside the composite bundle that can be exported outside the 
-	 * composite bundle. 
-	 */
-	public static final String COMPOSITEBUNDLE_EXPORTSERVICE = "";
-	/**
-	 * A list of service filters used to identify services that this composite 
-	 * bundle requires. 
-	 */
-	public static final String COMPOSITEBUNDLE_IMPORTSERVICE = "";
-	/**
-	 * The composite bundle manifest version header must be present and equal 
-	 * to 1.0 for this version of composite bundles. 
-	 */
-	public static final String COMPOSITEBUNDLE_MANIFESTVERSION = "";
-	/**
-	 * Descriptions of resources contained within the composite bundle archive 
-	 * which cannot be determine reflectively. 
-	 */
-	public static final String COMPOSITEBUNDLE_RESOURCES = "";
-	/**
-	 * 
-	 */
-	public static final String FEATURE_CONTENT = "Feature-Content";
-	/**
-	 * 
-	 */
-	public static final String FEATURE_DESCRIPTION = "Feature-Description";
-	/**
-	 * 
-	 */
-	public static final String FEATURE_MANIFESTVERSION = "Feature-ManifestVersion";
-	/**
-	 * 
-	 */
-	public static final String FEATURE_NAME = "Feature-Name";
-	/**
-	 * 
-	 */
-	public static final String FEATURE_SYMBOLICNAME = "Feature-SymbolicName";
-	/**
-	 * 
-	 */
-	public static final String FEATURE_VERSION = "Feature-Version";
-	/**
-	 * The list of library contents identified by a symbolic name and version.
-	 */
-	public static final String LIBRARY_CONTENT = "";
-	/**
-	 * Human readable library description.
-	 */
-	public static final String LIBRARY_DESCRIPTION = "";
-	/**
-	 * Name of the resource to use for localized headers.
-	 */
-	public static final String LIBRARY_LOCALIZATION = "";
-	/**
-	 * The subsystem manifest version header must be present and equals to 1.0 
-	 * for this version of applications.
-	 */
-	public static final String LIBRARY_MANIFESTVERSION = "";
-	/**
-	 * Human readable library name.
-	 */
-	public static final String LIBRARY_NAME = "";
-	/**
-	 * Descriptions of resources contained within the library archive which 
-	 * cannot be determine reflectively. 
-	 */
-	public static final String LIBRARY_RESOURCES = "";
-	/**
-	 * Symbolic name for the application. Must be present.
-	 */
-	public static final String LIBRARY_SYMBOLICNAME = "";
-	/**
-	 * Location to use when updating the library.
-	 */
-	public static final String LIBRARY_UPDATELOCATION = "";
-	/**
-	 * Version of the application. If not present, the default value is 0.0.0.
-	 */
-	public static final String LIBRARY_VERSION = "";
-	/**
-	 * Service property to be set on ResourceProcessor services to indicate 
-	 * which namespaces of resource it can process.
-	 */
-	public static final String OSGI_RESOURCE_NAMESPACE = "";
-	/**
-	 * Attribute to indicate the location of a resource.
-	 */
-	public static final String RESOURCE_LOCATION_ATTRIBUTE = "";
-	/**
-	 * Attribute to indicate the namespace of a resource.
-	 */
-	public static final String RESOURCE_NAMESPACE_ATTRIBUTE = "osgi.resource.namespace";
-	/**
-	 * Identify resources that are bundles (this is the default type).
-	 */
-	public static final String RESOURCE_NAMESPACE_BUNDLE = "";
-	/**
-	 * Identify resources that are subsystems.
-	 */
-	public static final String RESOURCE_NAMESPACE_SUBSYSTEM = "";
+	public static final String DEPLOYED_CONTENT = "Deployed-Content";
+
 	/**
-	 * Attribute to indicate a bundle needs to be started, defaults to true.
+	 * Manifest header attribute identifying the deployed version.
 	 */
-	public static final String RESOURCE_START_ATTRIBUTE = "";
+	public static final String DEPLOYED_VERSION_ATTRIBUTE = "deployed-version";
+
 	/**
-	 * Attribute to indicate the start level that must be associated to a 
-	 * constituent bundle or subsystem.
+	 * Key for the event property that holds the subsystem id.
 	 */
-	public static final String RESOURCE_START_LEVEL_ATTRIBUTE = "";
+	public static final String EVENT_SUBSYSTEM_ID = "subsystem.id";
+	
 	/**
-	 * Attribute to indicate the type on a resource.
+	 * Key for the event property that holds the subsystem location.
 	 */
-	public static final String RESOURCE_TYPE_ATTRIBUTE = "";
+	public static final String EVENT_SUBSYSTEM_LOCATION = "subsystem.location";
+	
 	/**
-	 * Identify resources that are bundles (this is the default type).
+	 * Key for the event property that holds the subsystem state.
 	 */
-	public static final String RESOURCE_TYPE_BUNDLE = "";
+	public static final String EVENT_SUBYSTEM_STATE = "subsystem.state";
+	
 	/**
-	 * Identify resources that are subsystems.
+	 * Key for the event property that holds the subsystem symbolic name.
 	 */
-	public static final String RESOURCE_TYPE_SUBSYSTEM = "";
+	public static final String EVENT_SUBSYSTEM_SYMBOLICNAME = "subsystem.symbolicname";
+	
 	/**
-	 * Attribute to indicate a bundle needs to be forced updated, even if the 
-	 * version is the same, defaults to false
+	 * Key for the event property that holds the subsystem version.
 	 */
-	public static final String RESOURCE_UPDATE_ATTRIBUTE = "";
+	public static final String EVENT_SUBSYSTEM_VERSION = "subsystem.version";
+	
 	/**
-	 * Service property to be set on ResourceProcessor services to indicate 
-	 * which types of resource it can process. 
+	 * The topic for subsystem event admin events.
 	 */
-	public static final String SERVICE_RESOURCE_TYPE = "";
+	public static final String EVENT_TOPIC = "org/osgi/service/Subsystem/";
+	
 	/**
-	 * Directive on the manifest header of a composite indicating the composite 
-	 * is managed as a subsystem. 
+	 * The topic for subsystem internal event admin events.
 	 */
-	public static final String SUBSYSTEM_DIRECTIVE = "";
-	
-	// Event related constants.
+	public static final String EVENT_TOPIC_INTERNALS = "org/osgi/service/SubsystemInternals/";
 
 	/**
 	 * The subsystem lifecycle event types that can be produced by a subsystem. 
 	 * See ? and Subsystem for details on the circumstances under which these 
 	 * events are fired.
 	 */
-	public static enum EventType {
+	public static enum EVENT_TYPE {
 		/**
 		 * Event type used to indicate a subsystem is installing.
 		 */
@@ -340,32 +142,149 @@ public class SubsystemConstants {
 		 */
 		FAILED
 	}
+	
 	/**
-	 * Key for the event property that holds the subsystem id.
+	 * Manifest header identifying packages offered for export.
+	 * 
+	 * @see Constants#EXPORT_PACKAGE
 	 */
-	public static final String SUBSYSTEM_ID = "subsystem.id";
+	public static final String EXPORT_PACKAGE = Constants.EXPORT_PACKAGE;
+	
 	/**
-	 * Key for the event property that holds the subsystem location.
+	 * Manifest header attribute identifying the resource type. The default 
+	 * value is {@link #IDENTITY_TYPE_BUNDLE}.
+	 * 
+	 * @see ResourceConstants#IDENTITY_TYPE_ATTRIBUTE
 	 */
-	public static final String SUBSYSTEM_LOCATION = "subsystem.location";
+	public static final String IDENTITY_TYPE_ATTRIBUTE = ResourceConstants.IDENTITY_TYPE_ATTRIBUTE;
+
 	/**
-	 * Key for the event property that holds the subsystem state.
+	 * Manifest header attribute value identifying a bundle resource type.
+	 * 
+	 * @see ResourceConstants#IDENTITY_TYPE_BUNDLE
 	 */
-	public static final String SUBYSTEM_STATE = "subsystem.state";
+	public static final String IDENTITY_TYPE_BUNDLE = ResourceConstants.IDENTITY_TYPE_BUNDLE;
+
 	/**
-	 * Key for the event property that holds the subsystem symbolic name.
+	 * Manifest header attribute value identifying a subsystem resource type.
 	 */
-	public static final String SUBSYSTEM_SYMBOLICNAME = "subsystem.symbolicname";
+	public static final String IDENTITY_TYPE_SUBSYSTEM = "osgi.subsystem";
+
 	/**
-	 * Key for the event property that holds the subsystem version.
+	 * Manifest header identifying packages required for import.
+	 * 
+	 * @see Constants#IMPORT_PACKAGE
 	 */
-	public static final String SUBSYSTEM_VERSION = "subsystem.version";
+	public static final String IMPORT_PACKAGE = Constants.IMPORT_PACKAGE;
+	
 	/**
-	 * The topic for subsystem event admin events.
+	 * Manifest header used to express a preference for particular resources to
+	 * satisfy implicit package dependencies.
 	 */
-	public static final String TOPIC = "org/osgi/service/Subsystem/";
+	public static final String PREFERRED_PROVIDER = "Preferred-Provider";
+
 	/**
-	 * The topic for subsystem internal event admin events.
+	 * Manifest header identifying the resources to be deployed to satisfy the 
+	 * transitive dependencies of a subsystem.
+	 */
+	public static final String PROVISION_RESOURCE = "Provision-Resource";
+
+	/**
+	 * Manifest header identifying symbolic names of required bundles. 
+	 */
+	public static final String REQUIRE_BUNDLE = Constants.REQUIRE_BUNDLE;
+
+	/**
+	 * Manifest header directive identifying the resolution type. The default 
+	 * value is {@link #RESOLUTION_MANDATORY}.
+	 * 
+	 * @see Constants#RESOLUTION_DIRECTIVE
+	 */
+	public static final String RESOLUTION_DIRECTIVE = Constants.RESOLUTION_DIRECTIVE;
+	
+	/**
+	 * Manifest header directive value identifying a mandatory resolution type.
+	 * 
+	 * @see Constants#RESOLUTION_MANDATORY
+	 */
+	public static final String RESOLUTION_MANDATORY = Constants.RESOLUTION_MANDATORY;
+	
+	/**
+	 * Manifest header directive value identifying an optional resolution type.
+	 * 
+	 * @see Constants#RESOLUTION_OPTIONAL
+	 */
+	public static final String RESOLUTION_OPTIONAL = Constants.RESOLUTION_OPTIONAL;
+	
+	/**
+	 * Manifest header directive identifying the start level.
+	 */
+	public static final String START_LEVEL_DIRECTIVE = "start-level";
+	
+	/**
+	 * The list of subsystem contents identified by a symbolic name and version.
+	 */
+	public static final String SUBSYSTEM_CONTENT = "Subsystem-Content";
+	
+	/**
+	 * Human readable description.
+	 */
+	public static final String SUBSYSTEM_DESCRIPTION = "Subsystem-Description";
+	
+	/**
+	 * Manifest header identifying services offered for export.
+	 */
+	public static final String SUBSYSTEM_EXPORTSERVICE = "Subsystem-ExportService";
+	
+	/**
+	 * Manifest header identifying services required for import.
+	 */
+	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. 
+	 */
+	public static final String SUBSYSTEM_MANIFESTVERSION = "Subsystem-ManifestVersion";
+	
+	/**
+	 * Human readable application name.
+	 */
+	public static final String SUBSYSTEM_NAME = "Subsystem-Name";
+	
+	/**
+	 * Symbolic name for the application. Must be present.
+	 */
+	public static final String SUBSYSTEM_SYMBOLICNAME = "Subsystem-SymbolicName";
+	
+	/**
+	 * Manifest header identifying the subsystem type.
+	 */
+	public static final String SUBSYSTEM_TYPE = "Subsystem-Type";
+	
+	/**
+	 * Manifest header value identifying an application subsystem.
+	 */
+	public static final String SUBSYSTEM_TYPE_APPLICATION = "osgi.application";
+	
+	/**
+	 * Manifest header value identifying a composite subsystem.
+	 */
+	public static final String SUBSYSTEM_TYPE_COMPOSITE = "osgi.composite";
+	
+	/**
+	 * Manifest header value identifying a feature subsystem.
+	 */
+	public static final String SUBSYSTEM_TYPE_FEATURE = "osgi.feature";
+	
+	/**
+	 * Version of the application. If not present, the default value is 0.0.0.
+	 */
+	public static final String SUBSYSTEM_VERSION = "Subsystem-Version";
+	
+	/**
+	 * Manifest header attribute indicating a version or version range. The 
+	 * default value is {@link Version#emptyVersion}.
 	 */
-	public static final String TOPIC_INTERNALS = "org/osgi/service/SubsystemInternals/";
+	public static final String VERSION_ATTRIBUTE = Constants.VERSION_ATTRIBUTE;
 }

Added: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/package-info.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/package-info.java?rev=1163349&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/package-info.java (added)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/package-info.java Tue Aug 30 19:36:35 2011
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) OSGi Alliance (2010). 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Subsystem Package Version 1.0.
+ * 
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ * 
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.subsystem; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.subsystem; version="[1.0,1.1)"}
+ * 
+ * @version $Id: b1e29b95829d6cdd9eb0d4246cda38442fb3cf37 $
+ */
+
+package org.osgi.service.subsystem;
\ No newline at end of file

Added: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/packageinfo
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/packageinfo?rev=1163349&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/packageinfo (added)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/packageinfo Tue Aug 30 19:36:35 2011
@@ -0,0 +1 @@
+version 1.0

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -17,10 +17,10 @@ import java.util.Collection;
 import java.util.List;
 
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.ResourceConstants;
+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;
 
 public class ResourceHelper {

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -21,8 +21,8 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.ResourceConstants;
+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)";

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Archive.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Archive.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Archive.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Archive.java Tue Aug 30 19:36:35 2011
@@ -29,9 +29,9 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
 import org.apache.aries.subsystem.core.resource.ResourceFactory;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Requirement;
+import org.osgi.framework.resource.Resource;
 import org.osgi.service.repository.Repository;
 import org.osgi.service.subsystem.SubsystemException;
 

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeployedContentHeader.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeployedContentHeader.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeployedContentHeader.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/DeployedContentHeader.java Tue Aug 30 19:36:35 2011
@@ -19,7 +19,7 @@ import java.util.Collections;
 import java.util.List;
 
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Resource;
+import org.osgi.framework.resource.Resource;
 
 public class DeployedContentHeader extends AbstractHeader {
 	public static class DeployedContent {

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -18,27 +18,28 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.aries.subsystem.core.internal.Activator;
 import org.apache.aries.subsystem.core.internal.OsgiIdentityRequirement;
 import org.apache.aries.subsystem.core.obr.SubsystemEnvironment;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.Wire;
+import org.osgi.framework.resource.Resource;
+import org.osgi.framework.resource.Wire;
 
 public class DeploymentManifest extends Manifest {
-	public static DeploymentManifest newInstance(SubsystemManifest manifest, SubsystemEnvironment environment) {
+	public static DeploymentManifest newInstance(Archive archive, SubsystemEnvironment environment) {
+		SubsystemManifest manifest = archive.getSubsystemManifest();
 		DeploymentManifest result = new DeploymentManifest();
 		result.headers.put(ManifestVersionHeader.NAME, manifest.getManifestVersion());
-		Collection<Requirement> requirements = new ArrayList<Requirement>();
+		Collection<Resource> resources = new ArrayList<Resource>();
 		for (SubsystemContentHeader.Content content : manifest.getSubsystemContent().getContents()) {
-			Requirement requirement = new OsgiIdentityRequirement(content.getName(), content.getVersionRange(), content.getType(), false);
-			requirements.add(requirement);
+			OsgiIdentityRequirement requirement = new OsgiIdentityRequirement(content.getName(), content.getVersionRange(), content.getType(), false);
+			resources.add(environment.findResource(requirement));
 		}
 		// TODO This does not validate that all content bundles were found.
-		Map<Resource, List<Wire>> resolution = Activator.getResolver().resolve(environment, requirements.toArray(new Requirement[requirements.size()]));
+		Map<Resource, List<Wire>> resolution = Activator.getResolver().resolve(environment, 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 ArrayList<Resource>();
 		Collection<Resource> provisionResource = new ArrayList<Resource>();

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -21,9 +21,9 @@ import java.util.Map;
 
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.ResourceConstants;
+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;

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/HeaderFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/HeaderFactory.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/HeaderFactory.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/HeaderFactory.java Tue Aug 30 19:36:35 2011
@@ -13,7 +13,6 @@
  */
 package org.apache.aries.subsystem.core.archive;
 
-import org.osgi.service.subsystem.SubsystemConstants;
 
 public class HeaderFactory {
 //	public static final String APPLICATIONCONTENT_HEADER = ApplicationContentHeader.NAME;

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ImportPackageHeader.java Tue Aug 30 19:36:35 2011
@@ -28,10 +28,10 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Requirement;
+import org.osgi.framework.resource.Resource;
 import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
 
 public class ImportPackageHeader implements Header<ImportPackageHeader.Clause> {
 	public static class Clause implements org.apache.aries.subsystem.core.archive.Clause {

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvisionResourceHeader.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvisionResourceHeader.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvisionResourceHeader.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/ProvisionResourceHeader.java Tue Aug 30 19:36:35 2011
@@ -19,7 +19,7 @@ import java.util.Collections;
 import java.util.List;
 
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Resource;
+import org.osgi.framework.resource.Resource;
 
 public class ProvisionResourceHeader extends AbstractHeader {
 	public static class ProvisionedResource {

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -19,9 +19,9 @@ import java.io.InputStream;
 import java.util.Collection;
 
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.ResourceConstants;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Resource;
+import org.osgi.framework.resource.ResourceConstants;
 import org.osgi.service.subsystem.SubsystemException;
 
 public class SubsystemManifest extends Manifest {

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/Activator.java Tue Aug 30 19:36:35 2011
@@ -117,55 +117,6 @@ public class Activator implements Bundle
 	 */
 	public static Resolver getResolver() {
 		return new SubsystemResolver();
-//		return new Resolver() {
-//			@Override
-//			public Map<Resource, List<Wire>> resolve(Environment environment, Requirement... requirements) throws ResolutionException {
-//				Collection<Capability> capabilities = new ArrayList<Capability>();
-//				for (Requirement requirement : requirements)
-//					capabilities.addAll(environment.findProviders(requirement));
-//				List<Resource> resources = new ArrayList<Resource>(capabilities.size());
-//				for (Capability capability : capabilities)
-//					resources.add(capability.getResource());
-//				org.apache.felix.bundlerepository.Resolver resolver = getRepositoryAdmin().resolver();
-//		        for (Resource resource : resources)
-//		            resolver.add(new OsgiResourceAdapter(resource));
-//		        if (resolver.resolve()) {
-//		        	/* 
-//		        	 * TODO For now, these need to go back through the environment in order to be sure the URL is available.
-//		        	 * This is because RepositoryAdmin is not going through the environment as part of pulling in transitive
-//		        	 * dependencies. Once a "real" Resolver is available, this will no longer be necessary.
-//		        	 */
-//		        	for (org.apache.felix.bundlerepository.Resource resource : resolver.getRequiredResources()) {
-//		        		Resource r = new FelixResourceAdapter(resource);
-//		        		// Make the environment aware of the resource and its URL.
-//		        		environment.findProviders(new OsgiIdentityRequirement(r, true));
-//		            	resources.add(r);
-//		        	}
-//		        	for (org.apache.felix.bundlerepository.Resource resource : resolver.getOptionalResources()) {
-//		        		Resource r = new FelixResourceAdapter(resource);
-//		        		// Make the environment aware of the resource and its URL.
-//		        		environment.findProviders(new OsgiIdentityRequirement(r, true));
-//		            	resources.add(r);
-//		        	}
-//		        }
-//		        else {
-//		            Reason[] reasons = resolver.getUnsatisfiedRequirements();
-//		            StringBuilder builder = new StringBuilder("Failed to resolve subsystem").append(System.getProperty("line.separator"));
-//		            for (Reason reason : reasons)
-//		                builder
-//		                	.append("resource = ")
-//		                	.append(reason.getResource().getSymbolicName())
-//		                	.append(", requirement = ")
-//		                	.append(reason.getRequirement().getName())
-//		                	.append(System.getProperty("line.separator"));
-//		            throw new SubsystemException(builder.toString());
-//		        }
-//		        Map<Resource, List<Wire>> result = new HashMap<Resource, List<Wire>>(resources.size());
-//				for (Resource resource : resources)
-//					result.put(resource, Collections.EMPTY_LIST);
-//				return result;
-//			}
-//		};
 	}
 	
 	private final BundleListener bundleListener = new SubsystemSynchronousBundleListener();

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -50,11 +50,11 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Version;
+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.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.ResourceConstants;
 import org.osgi.service.coordinator.Coordination;
 import org.osgi.service.coordinator.CoordinationException;
 import org.osgi.service.coordinator.Participant;
@@ -108,16 +108,16 @@ public class AriesSubsystem implements S
 		return ++lastId;
 	}
 	
-	private static void postEvent(Subsystem subsystem, SubsystemConstants.EventType type) {
+	private static void postEvent(Subsystem subsystem, SubsystemConstants.EVENT_TYPE type) {
 		postEvent(subsystem, type, null);
 	}
 	
-	private static void postEvent(Subsystem subsystem, SubsystemConstants.EventType type, Throwable t) {
+	private static void postEvent(Subsystem subsystem, SubsystemConstants.EVENT_TYPE type, Throwable t) {
 		EventAdmin eventAdmin = Activator.getEventAdmin();
 		if (eventAdmin != null) {
 			Map<String, Object> map = new HashMap<String, Object>();
-			map.put(SubsystemConstants.SUBSYSTEM_ID, subsystem.getSubsystemId());
-			map.put(SubsystemConstants.SUBSYSTEM_LOCATION, subsystem.getLocation());
+			map.put(SubsystemConstants.EVENT_SUBSYSTEM_ID, subsystem.getSubsystemId());
+			map.put(SubsystemConstants.EVENT_SUBSYSTEM_LOCATION, subsystem.getLocation());
 			try {
 				map.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, subsystem.getSymbolicName());
 			}
@@ -214,7 +214,7 @@ public class AriesSubsystem implements S
 	
 	public DeploymentManifest getDeploymentManifest() throws IOException {
 		if (archive.getDeploymentManifest() == null) {
-			archive.setDeploymentManifest(DeploymentManifest.newInstance(archive.getSubsystemManifest(), environment));
+			archive.setDeploymentManifest(DeploymentManifest.newInstance(archive, environment));
 		}
 		return archive.getDeploymentManifest();
 	}
@@ -323,7 +323,7 @@ public class AriesSubsystem implements S
 		subsystem = new AriesSubsystem(location, this);
 		locationToSubsystem.put(location, subsystem);
 		subsystem.setState(Subsystem.State.INSTALLING);
-		postEvent(subsystem, SubsystemConstants.EventType.INSTALLING);
+		postEvent(subsystem, SubsystemConstants.EVENT_TYPE.INSTALLING);
 		children.add(subsystem);
 		constituents.add(subsystem);
 		Activator.getExecutor().execute(new Runnable() {
@@ -332,12 +332,13 @@ public class AriesSubsystem implements S
 					subsystem.initialize(content);
 					subsystem.install();
 					subsystem.setState(Subsystem.State.INSTALLED);
-					postEvent(subsystem, SubsystemConstants.EventType.INSTALLED);
+					postEvent(subsystem, SubsystemConstants.EVENT_TYPE.INSTALLED);
 				}
 				catch (Exception e) {
-					postEvent(subsystem, SubsystemConstants.EventType.FAILED, e);
+					LOGGER.error("Failed to install subsystem: " + subsystem, e);
+					postEvent(subsystem, SubsystemConstants.EVENT_TYPE.FAILED, e);
 					subsystem.setState(Subsystem.State.UNINSTALLED);
-					postEvent(subsystem, SubsystemConstants.EventType.UNINSTALLED);
+					postEvent(subsystem, SubsystemConstants.EVENT_TYPE.UNINSTALLED);
 				}
 			}
 		});
@@ -391,11 +392,11 @@ public class AriesSubsystem implements S
 		}
 		if (state == State.INSTALLED) {
 			setState(State.RESOLVING);
-			postEvent(this, SubsystemConstants.EventType.RESOLVING);
+			postEvent(this, SubsystemConstants.EVENT_TYPE.RESOLVING);
 		}
 		else {
 			setState(State.STARTING);
-			postEvent(this, SubsystemConstants.EventType.STARTING);
+			postEvent(this, SubsystemConstants.EVENT_TYPE.STARTING);
 		}
 		Activator.getExecutor().execute(new Runnable() {
 			public void run() {
@@ -411,13 +412,13 @@ public class AriesSubsystem implements S
 						setExportIsolationPolicy();
 						// TODO Could avoid calling setState (and notifyAll) here and avoid the need for a lock.
 						setState(State.RESOLVED);
-						postEvent(AriesSubsystem.this, SubsystemConstants.EventType.RESOLVED);
+						postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.RESOLVED);
 						setState(State.STARTING);
-						postEvent(AriesSubsystem.this, SubsystemConstants.EventType.STARTING);
+						postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.STARTING);
 					}
 					catch (Exception e) {
 						setState(State.INSTALLED);
-						postEvent(AriesSubsystem.this, SubsystemConstants.EventType.FAILED, e);
+						postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.FAILED, e);
 						return;
 					}
 				}
@@ -429,7 +430,7 @@ public class AriesSubsystem implements S
 						startResource(resource, coordination);
 					}
 					setState(State.ACTIVE);
-					postEvent(AriesSubsystem.this, SubsystemConstants.EventType.STARTED);
+					postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.STARTED);
 				}
 				catch (Exception e) {
 					coordination.fail(e);
@@ -442,7 +443,7 @@ public class AriesSubsystem implements S
 					catch (CoordinationException e) {
 						LOGGER.error("An error occurred while starting in a resource in subsystem " + this, e);
 						setState(State.RESOLVED);
-						postEvent(AriesSubsystem.this, SubsystemConstants.EventType.FAILED, e);
+						postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.FAILED, e);
 					}
 				}
 			}
@@ -474,7 +475,7 @@ public class AriesSubsystem implements S
 			return;
 		}
 		setState(State.STOPPING);
-		postEvent(this, SubsystemConstants.EventType.STOPPING);
+		postEvent(this, SubsystemConstants.EVENT_TYPE.STOPPING);
 		// TODO Need to store the task for cancellation.
 		Activator.getExecutor().execute(new Runnable() {
 			public void run() {
@@ -486,12 +487,12 @@ public class AriesSubsystem implements S
 					catch (Exception e) {
 						LOGGER.error("An error occurred while stopping resource " + resource + " of subsystem " + this, e);
 						// TODO Should FAILED go out for each failure?
-						postEvent(AriesSubsystem.this, SubsystemConstants.EventType.FAILED, e);
+						postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.FAILED, e);
 					}
 				}
 				// TODO Can we automatically assume it actually is resolved?
 				setState(State.RESOLVED);
-				postEvent(AriesSubsystem.this, SubsystemConstants.EventType.STOPPED);
+				postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.STOPPED);
 			}
 		});
 	}
@@ -523,7 +524,7 @@ public class AriesSubsystem implements S
 			uninstall();
 		}
 		setState(State.UNINSTALLING);
-		postEvent(this, SubsystemConstants.EventType.UNINSTALLING);
+		postEvent(this, SubsystemConstants.EVENT_TYPE.UNINSTALLING);
 		Activator.getExecutor().execute(new Runnable() {
 			public void run() {
 				for (Iterator<Resource> iterator = constituents.iterator(); iterator.hasNext();) {
@@ -534,7 +535,7 @@ public class AriesSubsystem implements S
 					catch (Exception e) {
 						LOGGER.error("An error occurred while uninstalling resource " + resource + " of subsystem " + this, e);
 						// TODO Should FAILED go out for each failure?
-						postEvent(AriesSubsystem.this, SubsystemConstants.EventType.FAILED, e);
+						postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.FAILED, e);
 					}
 					iterator.remove();
 				}
@@ -542,7 +543,7 @@ public class AriesSubsystem implements S
 				locationToSubsystem.remove(location);
 				deleteFile(Activator.getBundleContext().getDataFile("subsystem" + id + System.getProperty("file.separator")));
 				setState(State.UNINSTALLED);
-				postEvent(AriesSubsystem.this, SubsystemConstants.EventType.UNINSTALLED);
+				postEvent(AriesSubsystem.this, SubsystemConstants.EVENT_TYPE.UNINSTALLED);
 			}
 		});
 	}

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleEventHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleEventHandler.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleEventHandler.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleEventHandler.java Tue Aug 30 19:36:35 2011
@@ -18,8 +18,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.osgi.framework.Bundle;
+import org.osgi.framework.resource.Resource;
 import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.Resource;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.service.event.EventConstants;
@@ -40,12 +40,12 @@ public class BundleEventHandler implemen
 			for (String propertyName : event.getPropertyNames()) {
 				map.put(propertyName, event.getProperty(propertyName));
 			}
-			map.put(SubsystemConstants.SUBSYSTEM_ID, subsystem.getSubsystemId());
-			map.put(SubsystemConstants.SUBSYSTEM_LOCATION, subsystem.getLocation());
-			map.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, subsystem.getSymbolicName());
-			map.put(SubsystemConstants.SUBSYSTEM_VERSION, String.valueOf(subsystem.getVersion()));
-			map.put(SubsystemConstants.SUBYSTEM_STATE, String.valueOf(subsystem.getState()));
-			Event newEvent = new Event(SubsystemConstants.TOPIC_INTERNALS + event.getTopic(), map);
+			map.put(SubsystemConstants.EVENT_SUBSYSTEM_ID, subsystem.getSubsystemId());
+			map.put(SubsystemConstants.EVENT_SUBSYSTEM_LOCATION, subsystem.getLocation());
+			map.put(SubsystemConstants.EVENT_SUBSYSTEM_SYMBOLICNAME, subsystem.getSymbolicName());
+			map.put(SubsystemConstants.EVENT_SUBSYSTEM_VERSION, String.valueOf(subsystem.getVersion()));
+			map.put(SubsystemConstants.EVENT_SUBYSTEM_STATE, String.valueOf(subsystem.getState()));
+			Event newEvent = new Event(SubsystemConstants.EVENT_TOPIC_INTERNALS + event.getTopic(), map);
 			eventAdmin.postEvent(newEvent);
 		}
 	}

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiContentCapability.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiContentCapability.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiContentCapability.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/OsgiContentCapability.java Tue Aug 30 19:36:35 2011
@@ -18,8 +18,8 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Resource;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Resource;
 
 public class OsgiContentCapability implements Capability {
 	private final Map<String, Object> attributes = new HashMap<String, Object>();

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -21,9 +21,9 @@ import org.apache.aries.subsystem.core.a
 import org.apache.aries.subsystem.core.archive.SubsystemManifest;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.ResourceConstants;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Resource;
+import org.osgi.framework.resource.ResourceConstants;
 
 public class OsgiIdentityCapability implements Capability {
 	private final Map<String, Object> attributes = new HashMap<String, Object>();

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -23,10 +23,10 @@ import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.Version;
 import org.osgi.framework.VersionRange;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.ResourceConstants;
+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.subsystem.SubsystemException;
 
 public class OsgiIdentityRequirement implements Requirement {

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemSynchronousBundleListener.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemSynchronousBundleListener.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemSynchronousBundleListener.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemSynchronousBundleListener.java Tue Aug 30 19:36:35 2011
@@ -18,8 +18,8 @@ import java.util.Collection;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.SynchronousBundleListener;
+import org.osgi.framework.resource.Resource;
 import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.Resource;
 
 public class SubsystemSynchronousBundleListener implements SynchronousBundleListener {
 	public void bundleChanged(BundleEvent event) {

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemEnvironment.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemEnvironment.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemEnvironment.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemEnvironment.java Tue Aug 30 19:36:35 2011
@@ -29,10 +29,10 @@ import org.apache.aries.subsystem.core.a
 import org.apache.aries.subsystem.core.internal.Activator;
 import org.apache.aries.subsystem.core.internal.AriesSubsystem;
 import org.apache.aries.subsystem.core.internal.OsgiIdentityRequirement;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.Wire;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Requirement;
+import org.osgi.framework.resource.Resource;
+import org.osgi.framework.resource.Wire;
 import org.osgi.service.repository.Repository;
 import org.osgi.service.resolver.Environment;
 import org.osgi.service.subsystem.Subsystem;
@@ -72,6 +72,14 @@ public class SubsystemEnvironment implem
 		return capabilities;
 	}
 	
+	public Resource findResource(OsgiIdentityRequirement requirement) {
+		Collection<Capability> capabilities = findProviders(requirement);
+		if (capabilities.isEmpty()) {
+			return null;
+		}
+		return capabilities.iterator().next().getResource();
+	}
+	
 	public URL getContent(Resource resource) {
 		Repository repository = resourceToRepository.get(resource);
 		if (repository == null)
@@ -150,37 +158,6 @@ public class SubsystemEnvironment implem
 		}
 	}
 	
-//	private void findContentProviders(Collection<Capability> capabilities, OsgiIdentityRequirement requirement) {
-//		findArchiveProviders(capabilities, requirement);
-//		findRepositoryServiceProviders(capabilities, requirement, !requirement.isTransitiveDependency());
-//	}
-	
-//	private void findFeatureContentProviders(Collection<Capability> capabilities, OsgiIdentityRequirement requirement) {
-//		Subsystem subsystem = this.subsystem;
-//		while (subsystem.getParent() != null && "osgi.feature".equals(subsystem.getParent().getHeaders().get("Subsystem-Type"))) // TODO Add to constants.
-//			subsystem = subsystem.getParent();
-//		findFeatureContentProviders(capabilities, requirement, subsystem);
-//	}
-//	
-//	private void findFeatureContentProviders(Collection<Capability> capabilities, OsgiIdentityRequirement requirement, Subsystem subsystem) {
-//		for (Resource resource : subsystem.getConstituents()) {
-//			for (Capability capability : resource.getCapabilities(requirement.getNamespace())) {
-//				if (requirement.matches(capability)) {
-//					capabilities.add(capability);
-//					resourceToRepository.put(capability.getResource(), repository);
-//					resources.add(capability.getResource());
-//				}
-//			}
-//		}
-//		findFeatureContentProviders(capabilities, requirement, subsystem.getChildren());
-//	}
-//	
-//	private void findFeatureContentProviders(Collection<Capability> capabilities, OsgiIdentityRequirement requirement, Collection<Subsystem> subsystems) {
-//		for (Subsystem subsystem : subsystems)
-//			if ("osgi.feature".equals(subsystem.getParent().getHeaders().get("Subsystem-Type"))) // TODO Add to constants.
-//				findFeatureContentProviders(capabilities, requirement, subsystem);
-//	}
-	
 	private void findRepositoryServiceProviders(Collection<Capability> capabilities, Requirement requirement, boolean content) {
 		Collection<Repository> repositories = Activator.getRepositories();
 		for (Repository repository : repositories) {

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemResolver.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemResolver.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemResolver.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/SubsystemResolver.java Tue Aug 30 19:36:35 2011
@@ -25,10 +25,10 @@ import org.apache.aries.subsystem.core.i
 import org.apache.aries.subsystem.core.obr.felix.FelixResourceAdapter;
 import org.apache.aries.subsystem.core.obr.felix.OsgiResourceAdapter;
 import org.apache.felix.bundlerepository.Reason;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
-import org.osgi.framework.wiring.Wire;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Requirement;
+import org.osgi.framework.resource.Resource;
+import org.osgi.framework.resource.Wire;
 import org.osgi.service.resolver.Environment;
 import org.osgi.service.resolver.ResolutionException;
 import org.osgi.service.resolver.Resolver;
@@ -49,23 +49,32 @@ public class SubsystemResolver implement
 			addCapabilities(capabilities, environment, requirement);
 		}
 	}
+
 	@Override
-	public Map<Resource, List<Wire>> resolve(Environment environment, Requirement... requirements) throws ResolutionException {
+	public Map<Resource, List<Wire>> resolve(Environment environment, Collection<Resource> mandatory, Collection<Resource> optional) throws ResolutionException {
 		Collection<Capability> capabilities = new ArrayList<Capability>();
 		/*
 		 * TODO Until an implementation of Resolver comes along, need to find as many resources with capabilities satisfying as
 		 * many requirements as possible. This is because the Felix OBR resolver does not make use of this environment. In particular,
 		 * we need to add resources that come from subsystem archives or constituents as these will not be available otherwise.
 		 */
-		for (Requirement requirement : requirements)
-//			capabilities.addAll(environment.findProviders(requirement));
-			addCapabilities(capabilities, environment, requirement);
-		List<Resource> resources = new ArrayList<Resource>(capabilities.size());
-		for (Capability capability : capabilities)
+		List<Resource> resources = new ArrayList<Resource>();
+		for (Resource resource : mandatory) {
+			resources.add(resource);
+			addCapabilities(capabilities, environment, resource.getRequirements(null));
+		}
+		// TODO Treating optional resources as mandatory for now....
+		for (Resource resource : optional) {
+			resources.add(resource);
+			addCapabilities(capabilities, environment, resource.getRequirements(null));
+		}
+		for (Capability capability : capabilities) {
 			resources.add(capability.getResource());
+		}
 		org.apache.felix.bundlerepository.Resolver resolver = Activator.getRepositoryAdmin().resolver();
-        for (Resource resource : resources)
+        for (Resource resource : resources) {
             resolver.add(new OsgiResourceAdapter(resource));
+        }
         if (resolver.resolve()) {
         	/* 
         	 * TODO For now, these need to go back through the environment in order to be sure the URL is available.
@@ -95,11 +104,13 @@ public class SubsystemResolver implement
                 	.append(", requirement = ")
                 	.append(reason.getRequirement().getName())
                 	.append(System.getProperty("line.separator"));
+            // TODO Throw ResolutionException instead.
             throw new SubsystemException(builder.toString());
         }
         Map<Resource, List<Wire>> result = new HashMap<Resource, List<Wire>>(resources.size());
-		for (Resource resource : resources)
+		for (Resource resource : resources) {
 			result.put(resource, Collections.EMPTY_LIST);
+		}
 		return result;
 	}
 }

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixCapabilityAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixCapabilityAdapter.java?rev=1163349&r1=1163348&r2=1163349&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixCapabilityAdapter.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/obr/felix/FelixCapabilityAdapter.java Tue Aug 30 19:36:35 2011
@@ -16,9 +16,9 @@ package org.apache.aries.subsystem.core.
 import java.util.Collections;
 import java.util.Map;
 
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Resource;
 import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Resource;
 
 public class FelixCapabilityAdapter implements Capability {
 	private final org.apache.felix.bundlerepository.Capability capability;

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=1163349&r1=1163348&r2=1163349&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 Tue Aug 30 19:36:35 2011
@@ -19,9 +19,9 @@ import java.util.ArrayList;
 import java.util.Collection;
 
 import org.apache.aries.subsystem.core.ResourceHelper;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.Requirement;
-import org.osgi.framework.wiring.Resource;
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Requirement;
+import org.osgi.framework.resource.Resource;
 import org.osgi.service.repository.Repository;
 import org.osgi.service.subsystem.SubsystemException;
 



Mime
View raw message