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/08 14:54:44 UTC

svn commit: r1241900 [1/8] - in /aries/trunk/subsystem: ./ subsystem-api/ 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-...

Author: jwross
Date: Wed Feb  8 13:54:41 2012
New Revision: 1241900

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

(1) Brings in the latest Subsystem, Resolver, Repository, and Resource APIs.
(2) Fixes compile errors.
(3) Fixes existing tests.
(4) Fixes existing test failures.
(5) Includes source of prototype org.apache.felix.resolver from http://svn.apache.org/repos/asf/felix/sandbox/rickhall/obr-resolver/.

Added:
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/RepositoryContent.java
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Synthesized.java
    aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/subsystem/SubsystemPermission.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/BundleManifestVersionHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/BundleSymbolicNameHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/BundleVersionHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemArchive.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SymbolicNameHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/DataFile.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/RootSubsystem.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ServiceProvider.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ServiceProviderImpl.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StaticDataFile.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/resource/AbstractCapability.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/AbstractRequirement.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/BasicCapability.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/
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/FelixCapability.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/FelixEnvironment.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/FelixResolver.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/Logger.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/impl/
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/felix/resolver/impl/Activator.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/EnvironmentAdaptor.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-core/src/main/java/org/apache/felix/resolver/impl/WireImpl.java
    aries/trunk/subsystem/subsystem-core/src/test/java/org/apache/aries/subsystem/core/Temp.java
    aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/
    aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/
    aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/OSGI-INF/SUBSYSTEM.MF
    aries/trunk/subsystem/subsystem-itests/src/test/resources/feature3/tb3.jar   (with props)
Removed:
    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/internal/BundleEventHandler.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemServiceFactory.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/SimpleExecutorTest.java
Modified:
    aries/trunk/subsystem/pom.xml
    aries/trunk/subsystem/readme.txt
    aries/trunk/subsystem/subsystem-api/pom.xml
    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/package-info.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/ResolutionException.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/resolver/package-info.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-api/src/main/java/org/osgi/service/subsystem/package-info.java
    aries/trunk/subsystem/subsystem-core/pom.xml
    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/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/GenericClause.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/Grammar.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/Manifest.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemContentHeader.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/archive/SubsystemManifestVersionHeader.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/archive/SubsystemSymbolicNameHeader.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/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/internal/SubsystemUri.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/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/RepositoryAdminRepository.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/resource/BundleResource.java
    aries/trunk/subsystem/subsystem-itests/pom.xml
    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/IntegrationTest.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
    aries/trunk/subsystem/subsystem-itests/src/test/resources/META-INF/platform-equinox/definition-3.8.0-SNAPSHOT.xml

Modified: aries/trunk/subsystem/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/pom.xml?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/pom.xml (original)
+++ aries/trunk/subsystem/pom.xml Wed Feb  8 13:54:41 2012
@@ -135,7 +135,6 @@
             <modules>
                 <module>subsystem-api</module>
                 <module>subsystem-core</module>
-                <module>subsystem-executor</module>
                 <module>subsystem-itests</module>
             </modules>
 
@@ -170,24 +169,38 @@
                             <artifactItems>
                                 <artifactItem>
                                     <groupId>org.eclipse</groupId>
-                                    <artifactId>osgi</artifactId>
+                                    <artifactId>org.eclipse.osgi</artifactId>
                                     <version>3.8.0-SNAPSHOT</version>
                                     <packaging>jar</packaging>
-                                    <downloadUrl>http://www.eclipse.org/downloads/download.php?file=/equinox/drops/I20111018-0850/org.eclipse.osgi_3.8.0.v20111017-1643.jar&amp;url=http://download.eclipse.org/equinox/drops/I20111018-0850/org.eclipse.osgi_3.8.0.v20111017-1643.jar&amp;mirror_id=1</downloadUrl>
+                                    <downloadUrl>http://www.eclipse.org/downloads/download.php?file=/equinox/drops/S-3.8M5-201201251800/org.eclipse.osgi_3.8.0.v20120123-1419.jar&amp;url=http://download.eclipse.org/equinox/drops/S-3.8M5-201201251800/org.eclipse.osgi_3.8.0.v20120123-1419.jar&amp;mirror_id=1</downloadUrl>
                                 </artifactItem>
                                 <artifactItem>
                                     <groupId>org.eclipse.equinox</groupId>
-                                    <artifactId>coordinator</artifactId>
-                                    <version>1.0.0.v20110314</version>
+                                    <artifactId>org.eclipse.equinox.coordinator</artifactId>
+                                    <version>3.8.0-SNAPSHOT</version>
                                     <packaging>jar</packaging>
-                                    <downloadUrl>http://ftp.osuosl.org/pub/eclipse/equinox/drops/R-3.7.1-201109091335/org.eclipse.equinox.coordinator_1.0.0.v20110502.jar</downloadUrl>
+                                    <downloadUrl>http://www.eclipse.org/downloads/download.php?file=/equinox/drops/S-3.8M5-201201251800/org.eclipse.equinox.coordinator_1.1.0.v20111117-1150.jar&amp;url=http://download.eclipse.org/equinox/drops/S-3.8M5-201201251800/org.eclipse.equinox.coordinator_1.1.0.v20111117-1150.jar&amp;mirror_id=1</downloadUrl>
                                 </artifactItem>
                                 <artifactItem>
                                     <groupId>org.eclipse.equinox</groupId>
-                                    <artifactId>region</artifactId>
-                                    <version>1.0.0.v20110506</version>
+                                    <artifactId>org.eclipse.equinox.region</artifactId>
+                                    <version>3.8.0-SNAPSHOT</version>
+                                    <packaging>jar</packaging>
+                                    <downloadUrl>http://www.eclipse.org/downloads/download.php?file=/equinox/drops/S-3.8M5-201201251800/org.eclipse.equinox.region_1.0.0.v20111107-1631.jar&amp;url=http://download.eclipse.org/equinox/drops/S-3.8M5-201201251800/org.eclipse.equinox.region_1.0.0.v20111107-1631.jar&amp;mirror_id=1</downloadUrl>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.eclipse.osgi</groupId>
+                                    <artifactId>org.eclipse.osgi.services</artifactId>
+                                    <version>3.8.0-SNAPSHOT</version>
+                                    <packaging>jar</packaging>
+                                    <downloadUrl>http://www.eclipse.org/downloads/download.php?file=/equinox/drops/S-3.8M5-201201251800/org.eclipse.osgi.services_3.3.0.v20111117-1210.jar&amp;url=http://download.eclipse.org/equinox/drops/S-3.8M5-201201251800/org.eclipse.osgi.services_3.3.0.v20111117-1210.jar&amp;mirror_id=1</downloadUrl>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.eclipse.equinox</groupId>
+                                    <artifactId>org.eclipse.equinox.event</artifactId>
+                                    <version>3.8.0-SNAPSHOT</version>
                                     <packaging>jar</packaging>
-                                    <downloadUrl>http://ftp.osuosl.org/pub/eclipse/equinox/drops/R-3.7.1-201109091335/org.eclipse.equinox.region_1.0.0.v20110524.jar</downloadUrl>
+                                    <downloadUrl>http://www.eclipse.org/downloads/download.php?file=/equinox/drops/S-3.8M5-201201251800/org.eclipse.equinox.event_1.2.100.v20111010-1614.jar&amp;url=http://download.eclipse.org/equinox/drops/S-3.8M5-201201251800/org.eclipse.equinox.event_1.2.100.v20111010-1614.jar&amp;mirror_id=1</downloadUrl>
                                 </artifactItem>
                             </artifactItems>
                         </configuration>

Modified: aries/trunk/subsystem/readme.txt
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/readme.txt?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/readme.txt (original)
+++ aries/trunk/subsystem/readme.txt Wed Feb  8 13:54:41 2012
@@ -1,15 +1,37 @@
-The Subsystems subproject uses some unreleased and difficult to find equinox artifacts.
-
-There's a profile to download them automatically like this:
-
-mvn clean install -Pfetch-external
-
-The normal build is now in the default profile so if you are running any other profiles you will need
-
-mvn clean install -Pdefault,<your other profiles>
-
-PLEASE if you change the version of these jars used in subsystems UPDATE THE DOWNLOAD INFO in the subsystem root pom.
-
-The downloader is from here:
-
-http://code.google.com/p/maven-external-dependency-plugin/
+The Subsystems subproject uses some unreleased and difficult to find equinox 
+artifacts.
+
+There's a profile to download them automatically like this:
+
+mvn clean install -Pfetch-external
+
+The normal build is now in the default profile so if you are running any other 
+profiles you will need
+
+mvn clean install -Pdefault,<your other profiles>
+
+PLEASE if you change the version of these jars used in subsystems UPDATE THE 
+DOWNLOAD INFO in the subsystem root pom.
+
+The downloader is from here:
+
+http://code.google.com/p/maven-external-dependency-plugin/
+
+ADDENDUM
+
+In order to use the downloader, you must do
+
+svn co http://maven-external-dependency-plugin.googlecode.com/svn/trunk/maven-external-dependency-plugin/ maven-external-dependency-plugin
+
+then run "mvn install" from the maven-external-dependency-plugin directory so 
+that it is accessible from your local m2 repository before running 
+
+mvn clean install -Pfetch-external 
+
+from the subsystem project. If successful, you must the also run 
+
+mvn clean install -Pdefault 
+
+from the aries/subsystem directory. Additionally, you will need dependencies in 
+your local m2 repository obtained from executing "mvn clean install" from the 
+aries/util/util and aries/application directories.
\ No newline at end of file

Modified: aries/trunk/subsystem/subsystem-api/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/pom.xml?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/pom.xml (original)
+++ aries/trunk/subsystem/subsystem-api/pom.xml Wed Feb  8 13:54:41 2012
@@ -42,22 +42,17 @@
     <properties>
          <!-- Export package versions are maintained in packageinfo files -->
         <aries.osgi.export.pkg>
-            org.apache.aries.subsystem*, org.osgi.service*
+            org.osgi.service.repository,org.osgi.service.resolver,org.osgi.service.subsystem
         </aries.osgi.export.pkg>
     </properties>
 
     <dependencies>
         <dependency>
             <groupId>org.eclipse</groupId>
-            <artifactId>osgi</artifactId>
+            <artifactId>org.eclipse.osgi</artifactId>
             <version>3.8.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
-        <dependency>
-    		<groupId>org.eclipse.equinox</groupId>
-    		<artifactId>coordinator</artifactId>
-    		<version>1.0.0.v20110314</version>
-    	</dependency>
     </dependencies>
 
 </project>

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=1241900&r1=1241899&r2=1241900&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 Wed Feb  8 13:54:41 2012
@@ -21,65 +21,70 @@ import org.osgi.framework.resource.Requi
  * Constants for use in the "osgi.content" namespace. This namespace is used to
  * locate content via the {@link Repository#findProviders(Requirement)} method.
  */
-public interface ContentNamespace {
-  /**
-   * Namespace of the content capability
-   */
-  final String CAPABILITY = "osgi.content";
-
-  /**
-   * Checksum attribute of a resource
-   */
-  final String CHECKSUM_ATTRIBUTE = "checksum";
-
-  /**
-   * The checksum algorithm used to calculate the {@link #CHECKSUM_ATTRIBUTE} if
-   * not specified this is assumed to be SHA-256 - TODO need default?
-   */
-  final String CHECKSUM_ALGO_ATTRIBUTE = "checksumAlgo";
-
-  /**
-   * A copyright statement for the resource
-   */
-  final String COPYRIGHT_ATTRIBUTE = "copyright";
-
-  /**
-   * A human readable description of this resource
-   */
-  final String DESCRIPTION_ATTRIBUTE = "description";
-
-  /**
-   * A URL where documentation for this resource can be accessed
-   */
-  final String DOCUMENTATION_URL_ATTRIBUTE = "documentation";
-
-  /**
-   * Provides an optional machine readable form of license information. See
-   * section 3.2.1.10 of the OSGi Core Specification for information on it's
-   * usage.
-   */
-  final String LICENSE_ATTRIBUTE = "license";
-
-  /**
-   * A URL where source control management for this resource is located
-   */
-  final String SCM_URL_ATTRIBUTE = "scm";
-
-  /**
-   * The size of this resource in bytes.
-   */
-  final String SIZE_ATTRIBUTE = "size";
-
-  /**
-   * A URL where source code for this resource is located
-   */
-  final String SOURCE_URL_ATTRIBUTE = "source";
-
-  /**
-   * All attributes defined in this interface
-   */
-  final String[] ATTRIBUTES = { CHECKSUM_ATTRIBUTE, CHECKSUM_ALGO_ATTRIBUTE,
-      COPYRIGHT_ATTRIBUTE, DESCRIPTION_ATTRIBUTE, DOCUMENTATION_URL_ATTRIBUTE,
-      LICENSE_ATTRIBUTE, SCM_URL_ATTRIBUTE, SIZE_ATTRIBUTE,
-      SOURCE_URL_ATTRIBUTE };
+public final class ContentNamespace {
+	private ContentNamespace() {
+		// non-instantiable
+	}
+
+	/**
+	 * Namespace of the content capability
+	 */
+	public final String		CAPABILITY					= "osgi.content";
+
+	/**
+	 * Checksum attribute of a resource
+	 */
+	public final String		CHECKSUM_ATTRIBUTE			= "checksum";
+
+	/**
+	 * The checksum algorithm used to calculate the {@link #CHECKSUM_ATTRIBUTE}
+	 * if not specified this is assumed to be SHA-256 - TODO need default?
+	 */
+	public final String		CHECKSUM_ALGO_ATTRIBUTE		= "checksumAlgo";
+
+	/**
+	 * A copyright statement for the resource
+	 */
+	public final String		COPYRIGHT_ATTRIBUTE			= "copyright";
+
+	/**
+	 * A human readable description of this resource
+	 */
+	public final String		DESCRIPTION_ATTRIBUTE		= "description";
+
+	/**
+	 * A URL where documentation for this resource can be accessed
+	 */
+	public final String		DOCUMENTATION_URL_ATTRIBUTE	= "documentation";
+
+	/**
+	 * Provides an optional machine readable form of license information. See
+	 * section 3.2.1.10 of the OSGi Core Specification for information on it's
+	 * usage.
+	 */
+	public final String		LICENSE_ATTRIBUTE			= "license";
+
+	/**
+	 * A URL where source control management for this resource is located
+	 */
+	public final String		SCM_URL_ATTRIBUTE			= "scm";
+
+	/**
+	 * The size of this resource in bytes.
+	 */
+	public final String		SIZE_ATTRIBUTE				= "size";
+
+	/**
+	 * A URL where source code for this resource is located
+	 */
+	public final String		SOURCE_URL_ATTRIBUTE		= "source";
+
+	/**
+	 * All attributes defined in this interface
+	 */
+	public final String[]	ATTRIBUTES					= {CHECKSUM_ATTRIBUTE,
+			CHECKSUM_ALGO_ATTRIBUTE, COPYRIGHT_ATTRIBUTE,
+			DESCRIPTION_ATTRIBUTE, DOCUMENTATION_URL_ATTRIBUTE,
+			LICENSE_ATTRIBUTE, SCM_URL_ATTRIBUTE, SIZE_ATTRIBUTE,
+			SOURCE_URL_ATTRIBUTE						};
 }

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=1241900&r1=1241899&r2=1241900&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 Wed Feb  8 13:54:41 2012
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2006, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2006, 2011). 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.
@@ -20,8 +20,8 @@
 
 package org.osgi.service.repository;
 
-import java.net.URL;
 import java.util.Collection;
+import java.util.Map;
 
 import org.osgi.framework.resource.Capability;
 import org.osgi.framework.resource.Requirement;
@@ -40,12 +40,29 @@ import org.osgi.service.resolver.Environ
  * properties.
  * 
  * @ThreadSafe
- * @version $Id: bd0cfbdace9a99e3a9d2b16208d7169d3cc6d993 $
+ * @version $Id: 95cb10e57c1262d6aae8e3bb5e9d3fa4f8d1cd64 $
  */
 public interface Repository {
   /**
-   * Find any capabilities that {@link Requirement#matches(Capability) match} 
-   * the supplied requirement.
+   * Service attribute to uniquely identify this repository
+   */
+  final String ID = "repository.id";
+
+  /**
+   * Service attribute to define the name of this repository
+   */
+  final String NAME = "repository.name";
+
+  /**
+   * Service attribute to provide a human readable name for this repository
+   */
+  final String DISPLAY_NAME = "repository.displayName";
+
+  /**
+   * Find any capabilities that match the supplied requirement.
+   * 
+   * <p>
+   * See {@link Environment#findProviders} for a discussion on matching.
    * 
    * @param requirement The requirement that should be matched
    * 
@@ -56,18 +73,16 @@ public interface Repository {
   Collection<Capability> findProviders(Requirement requirement);
 
   /**
-   * Lookup the URL where the supplied resource may be accessed, if any.
+   * Find any capabilities that match the supplied requirements.
    * 
    * <p>
-   * Successive calls to this method do not have to return the same value this
-   * allows for mirroring behaviors to be built into a repository.
+   * 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
    * 
-   * @param resource
-   *          - The resource whose content is desired.
-   * @return The URL for the supplied resource or null if this resource has no
-   *         binary content or is not accessible for any reason
-   *         
-   * @throws NullPointerException if the resource is null 
+   * @throws NullPointerException if requirements is null
    */
-  URL getContent(Resource resource);
+  Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements);
 }

Added: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/RepositoryContent.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/RepositoryContent.java?rev=1241900&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/RepositoryContent.java (added)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/RepositoryContent.java Wed Feb  8 13:54:41 2012
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.
+ */
+
+package org.osgi.service.repository;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.osgi.framework.resource.Resource;
+
+/**
+ * An accessor for the content of a resource.
+ * 
+ * All {@link Resource} objects which represent resources in a
+ * {@link Repository} must implement this interface. A user of the resource can
+ * then cast the {@link Resource} object to this type and then obtain an
+ * {@code InputStream} to the content of the resource.
+ * 
+ * @ThreadSafe
+ * @version $Id: 6a91b25ad4eff5054b1436ba9f5c9c4a58e89cf7 $
+ */
+public interface RepositoryContent {
+
+	/**
+	 * Returns a new input stream to the underlying artifact for the associated
+	 * resource.
+	 * 
+	 * @return A new input stream for associated resource.
+	 * @throws IOException If an I/O error occurs while creating the input
+	 *         stream.
+	 */
+	InputStream getContent() throws IOException;
+}

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/package-info.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/package-info.java?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/package-info.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/repository/package-info.java Wed Feb  8 13:54:41 2012
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2011). 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.
@@ -32,7 +32,7 @@
  * <p>
  * {@code  Import-Package: org.osgi.service.repository; version="[1.0,1.1)"}
  * 
- * @version $Id: 7c9f0a2ea9b3e04ef80ea2efc1b2bbc4551f3e49 $
+ * @version $Id: 124471567e9a3f769ead5e9a593cf8581f307a02 $
  */
 
 package org.osgi.service.repository;

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=1241900&r1=1241899&r2=1241900&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 Wed Feb  8 13:54:41 2012
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) OSGi Alliance (2011). 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
@@ -17,90 +17,135 @@
 package org.osgi.service.resolver;
 
 import java.util.Collection;
-import java.util.List;
 import java.util.Map;
+import java.util.SortedSet;
 
+import org.osgi.framework.Constants;
 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.resource.Wire;
+import org.osgi.framework.resource.Wiring;
 
 /**
  * An environment provides options and constraints to the potential solution of
- * a {@link Resolver#resolve(Environment, Requirement...)} operation.
- * 
+ * a {@link Resolver#resolve(Environment, Collection, Collection)} operation.
+ *
  * <p>
  * Environments:
  * <ul>
- * <li>Provide {@link Capability capabilities} that the Resolver can use
- * to satisfy {@link Requirement requirements} via the
+ * <li>Provide {@link Capability capabilities} that the Resolver can use to
+ * satisfy {@link Requirement requirements} via the
  * {@link #findProviders(Requirement)} method</li>
- * 
- * <li>Constrain solutions via the {@link #getWiring()} method. A wiring
+ *
+ * <li>Constrain solutions via the {@link #getWirings()} method. A wiring
  * consists of a map of existing {@link Resource resources} to {@link Wire
  * wires}.
- * 
+ *
  * <li>Filter transitive requirements that are brought in as part of a resolve
  * operation via the {@link #isEffective(Requirement)}.
  * </ul>
- * 
+ *
  * <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 {@link org.osgi.service.repository.Repository
+ * repositories}.
  * 
  * <p>
  * A resolver may call the {@link #findProviders(Requirement)},
- * {@link #isEffective(Requirement)} and {@link #getWiring()} method any number of
- * times during a resolve using any thread. Environments may also be shared
+ * {@link #isEffective(Requirement)} and {@link #getWirings()} method any number
+ * of times during a resolve using any thread. Environments may also be shared
  * between several resolvers. As such implementors should ensure that this class
  * is properly synchronized.
  * 
  * @ThreadSafe
  */
 public interface Environment {
-  /**
-   * Find any capabilities that {@link Requirement#matches(Capability) match} 
-   * the supplied requirement.
-   * 
-   * <p>
-   * A resolver should use the iteration order or the returned capability
-   * collection to infer preference in the case where multiple capabilities
-   * match a requirement. Capabilities at the start of the iteration are implied
-   * to be preferred over capabilities at the end.
-   * 
-   * @param requirement
-   *          the requirement that a resolver is attempting to satisfy
-   * 
-   * @return an collection of capabilities that match the supplied
-   *         requirement
-   *         
-   * @throws NullPointerException if the requirement is null 
-   */
-  Collection<Capability> findProviders(Requirement requirement);
-
-  /**
-   * Test if a given requirement should be wired in a given resolve
-   * operation. If this method returns false then the resolver should ignore
-   * this requirement during this resolve operation.
-   * 
-   * <p>
-   * The primary use case for this is to test the <code>effective</code> directive
-   * on the requirement, though implementations are free to use this for any other
-   * purposes. 
-   * 
-   * @param requirement the Requirement to test 
-   * 
-   * @return true if the requirement should be considered as part of this resolve operation
-   * 
-   * @throws NullPointerException if requirement is null
-   */
-  boolean isEffective(Requirement requirement);
-
-  /**
-   * An immutable map of wires between revisions. Multiple calls to this method
-   * for the same environment object must result in the same set of wires.
-   * 
-   * @return the wires already defined in this environment
-   */
-  Map<Resource, List<Wire>> getWiring();
+	/**
+	 * Find any capabilities that match the supplied requirement.
+	 *
+	 * <p>
+	 * A resolver should use the iteration order or the returned capability
+	 * collection to infer preference in the case where multiple capabilities
+	 * match a requirement. Capabilities at the start of the iteration are
+	 * implied to be preferred over capabilities at the end.
+	 * 
+	 * <p>
+	 * The set returned by this call should be mutable to support ordering
+	 * of {@link Synthesized} resources created by the resolution process.
+	 *
+	 * <h3>Matching</h3>
+	 * <p>
+	 * A capability matches a requirement when all of the following are true:
+	 * <ul>
+	 * <li>The specified capability has the same {@link Capability#getNamespace() name
+	 * space} as the requirement.
+	 * <li>The filter specified by the {@link Constants#FILTER_DIRECTIVE filter}
+	 * directive of the requirement matches the
+	 * {@link Capability#getAttributes() attributes of the specified capability}.
+	 * <li>The standard capability {@link Capability#getDirectives() directives}
+	 * that influence matching and that apply to the name space are satisfied.
+	 * See the capability
+	 * {@link ResourceConstants#CAPABILITY_MANDATORY_DIRECTIVE mandatory}
+	 * directive.
+	 * </ul>
+	 *
+	 * @param requirement the requirement that a resolver is attempting to
+	 *        satisfy
+	 *
+	 * @return an collection of capabilities that match the supplied requirement
+	 *
+	 * @throws NullPointerException if the requirement is null
+	 */
+	SortedSet<Capability> findProviders(Requirement requirement);
+
+	/**
+	 * Find any capabilities that match the supplied requirement.
+	 * 
+	 * <p>
+	 * The set returned by this call should be mutable to support ordering of
+	 * {@link Synthesized} resources created by the resolution process.
+	 * 
+	 * <p>
+	 * See {@link #findProviders} 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
+	 * 
+	 * 
+	 * @see #findProviders
+	 */
+	Map<Requirement, SortedSet<Capability>> findProviders(Collection<? extends Requirement> requirements);
+
+	/**
+	 * Test if a given requirement should be wired in a given resolve operation.
+	 * If this method returns false then the resolver should ignore this
+	 * requirement during this resolve operation.
+	 *
+	 * <p>
+	 * The primary use case for this is to test the <code>effective</code>
+	 * directive on the requirement, though implementations are free to use this
+	 * for any other purposes.
+	 *
+	 * @param requirement the Requirement to test
+	 *
+	 * @return true if the requirement should be considered as part of this
+	 *         resolve operation
+	 *
+	 * @throws NullPointerException if requirement is null
+	 */
+	boolean isEffective(Requirement requirement);
+
+	/**
+	 * An immutable map of wirings for resources. Multiple calls to this method
+	 * for the same environment object must result in the same set of wirings.
+	 *
+	 * @return the wirings already defined in this environment
+	 */
+	Map<Resource, Wiring> getWirings();
 }

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/ResolutionException.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/ResolutionException.java?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/ResolutionException.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/ResolutionException.java Wed Feb  8 13:54:41 2012
@@ -16,9 +16,22 @@
 
 package org.osgi.service.resolver;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.osgi.framework.resource.Requirement;
+
 /**
  * Indicates failure to resolve a set of requirements.
  * 
+ * <p>
+ * If a resolution failure is caused by a missing mandatory dependency a
+ * resolver may include any requirements it has considered in the resolution
+ * exception. Clients may access this set of dependencies via the
+ * {@link #getUnresolvedRequirements()} method.
+ * 
+ * <p>
  * Resolver implementations may subclass this class to provide extra state
  * information about the reason for the resolution failure.
  * 
@@ -29,20 +42,34 @@ public class ResolutionException extends
 
   private static final long serialVersionUID = 1L;
 
+  // NOTE used requirement[] not collection to avoid accidental serialization
+  // issues
+  private Requirement[] unresolvedRequirements;
+
   /**
    * Creates an exception of type {@code ResolutionException}.
    * 
    * <p>
    * This method creates an {@code ResolutionException} object with the
-   * specified message and cause.
+   * specified message, cause and unresolvedRequirements.
    * 
    * @param message
    *          The message.
    * @param cause
    *          The cause of this exception.
+   * @param unresolvedRequirements
+   *          the requirements that are unresolved or null if no unresolved requirements
+   *          information is provided.
    */
-  public ResolutionException(String message, Throwable cause) {
+  public ResolutionException(String message, Throwable cause,
+      Collection<Requirement> unresolvedRequirements) {
     super(message, cause);
+    if (unresolvedRequirements != null) {
+      // copy array both fixes serialization issues and
+      // ensures exception is immutable
+      this.unresolvedRequirements = unresolvedRequirements
+          .toArray(new Requirement[unresolvedRequirements.size()]);
+    }
   }
 
   /**
@@ -72,4 +99,30 @@ public class ResolutionException extends
   public ResolutionException(Throwable cause) {
     super(cause);
   }
+
+  /**
+   * May contain one or more unresolved mandatory requirements from mandatory
+   * resources.
+   * 
+   * <p>
+   * This exception is provided for informational purposes and the specific set
+   * of requirements that are returned after a resolve failure is not defined.
+   * 
+   * @return a collection of requirements that are unsatisfied
+   */
+  public Collection<Requirement> getUnresolvedRequirements() {
+    // creating at each call ensures internal data is immutable
+    // TODO could use a transient field to reduce CPU cost at expense of RAM -
+    // both trivial compared to code complexity
+    if (unresolvedRequirements == null) {
+      return Collections.EMPTY_LIST;
+    } else {
+      ArrayList<Requirement> requirements = new ArrayList<Requirement>(
+          unresolvedRequirements.length);
+      for (Requirement r : unresolvedRequirements) {
+        requirements.add(r);
+      }
+      return requirements;
+    }
+  }
 }

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=1241900&r1=1241899&r2=1241900&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 Wed Feb  8 13:54:41 2012
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2006, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2006, 2011). 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,8 +15,8 @@
  */
 
 // This document is an experimental draft to enable interoperability
-// between bundle repositories. There is currently no commitment to 
-// turn this draft into an official specification.  
+// between bundle repositories. There is currently no commitment to
+// turn this draft into an official specification.
 
 package org.osgi.service.resolver;
 
@@ -30,80 +30,78 @@ import org.osgi.framework.resource.Wire;
 /**
  * A resolver is a service interface that can be used to find resolutions for
  * specified {@link Resource resources} based on a supplied {@link Environment}.
- * 
+ *
  * @ThreadSafe
- * @version $Id: 93375420122cbe48e6fba5af207af43826a508fa $
+ * @version $Id: 5491eb77894ab6827ad9e922a25fc475e79265ec $
  */
 public interface Resolver {
-  /**
-   * 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, 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 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>
-   * 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.
-   * 
-   * @return the new resources and wires required to satisfy the requirements
-   * 
-   * @throws ResolutionException
-   *           if the resolution cannot be satisfied for any reason
-   * @throws NullPointerException
-   *           if environment is null
-   */
-  Map<Resource, List<Wire>> resolve(Environment environment,
-      Collection<Resource> mandatoryResources,
-      Collection<Resource> optionalResources) throws ResolutionException;
+	/**
+	 * 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#getWirings()} 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, 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 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>
+	 * 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.
+	 *
+	 * @return the new resources and wires required to satisfy the requirements
+	 *
+	 * @throws ResolutionException if the resolution cannot be satisfied for any
+	 *         reason
+	 * @throws NullPointerException if environment is null
+	 */
+	Map<Resource, List<Wire>> resolve(Environment environment,
+			Collection< ? extends Resource> mandatoryResources,
+			Collection< ? extends Resource> optionalResources)
+			throws ResolutionException;
 }

Added: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Synthesized.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Synthesized.java?rev=1241900&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Synthesized.java (added)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/Synthesized.java Wed Feb  8 13:54:41 2012
@@ -0,0 +1,127 @@
+package org.osgi.service.resolver;
+
+import org.osgi.framework.resource.Capability;
+import org.osgi.framework.resource.Requirement;
+import org.osgi.framework.resource.Resource;
+
+/**
+ * <p>
+ * During the resolution process it is necessary for the resolver to synthesize
+ * resources to represent the merge of bundles and fragments.
+ * 
+ * <p>
+ * For example if we have one bundle A and two fragments X and Y then resolver
+ * will create two synthesized resources AX and AY.
+ * 
+ * <p>
+ * In order for the Environment to provide a policy for which synthesized
+ * resources are preferred, both the host bundle and providing fragment need to
+ * be visible. This interface must therefore be used on all synthesized resource
+ * elements created by a resolver.
+ * 
+ * <p>
+ * The environment can then enforce the ordering policy when a capability that
+ * is provided by a synthesized resource is added to the SortedSet returned by
+ * {@link Environment#findProviders(org.osgi.framework.resource.Requirement)}.
+ * 
+ * <p>
+ * The following is a short example of how this may look in practice:
+ * 
+ * <pre>
+ * class PreferrSmallResourcesEnvironment implements Environment {
+ * 	static class SizeComparator extends Comparator {
+ * 		public int compare(Capability capA, Capability capB) {
+ * 			Resource hostA = capA.getResource();
+ * 			Resource hostB = capB.getResource();
+ * 
+ * 			Resource synthA = getSynthesizedResource(hostA);
+ * 			Resource synthB = getSynthesizedResource(hostA);
+ * 
+ * 			long sizeA = getSize(hostA) + getSize(synthA);
+ * 			long sizeB = getSize(hostB) + getSize(synthB);
+ * 
+ * 			if (sizeA &gt; sizeB) {
+ * 				return +1;
+ * 			}
+ * 			else
+ * 				if (sizeA &lt; sizeB) {
+ * 					return -1;
+ * 				}
+ * 				else {
+ * 					return 0;
+ * 				}
+ * 		}
+ * 
+ * 		private int getSize(Resource resource) {
+ * 			if (resource == null)
+ * 				return 0;
+ * 
+ * 			Capability contentCapability = getCapability(resource,
+ * 					ContentNamespace.CAPABILITY);
+ * 
+ * 			if (contentCapability == null)
+ * 				return 0;
+ * 
+ * 			Integer size = (Integer) contentCapability.getAttributes().get(
+ * 					ContentNamespace.SIZE_ATTRIBUTE);
+ * 
+ * 			return size == null ? Integer.MAX_VALUE : size;
+ * 		}
+ * 
+ * 		private Capability getCapability(Resource res, String namespace) {
+ * 			List&lt;Capability&gt; caps = res.getCapabilities(namespace);
+ * 			return caps.isEmpty() ? null : caps.get(0);
+ * 		}
+ * 
+ * 		private Resource getSynthesizedResource(Resource res) {
+ * 			if (res instanceof Synthesized) {
+ * 				return (Resource) ((Synthesized) res).getOriginal();
+ * 			}
+ * 			else {
+ * 				return null;
+ * 			}
+ * 		}
+ * 	};
+ * 
+ * 	private List	repositories;
+ * 
+ * 	public PreferrSmallResourcesEnvironment(List repositories) {
+ * 		this.repositories = repositories;
+ * 	}
+ * 
+ * 	public SortedSet findProviders(Requirement requirement) {
+ * 		SortedSet caps = new ConcurrentSkipListSet(new SizeComparator());
+ * 
+ * 		for (Repository r : repositories) {
+ * 			caps.addAll(r.findProviders(requirement));
+ * 		}
+ * 
+ * 		return caps;
+ * 	}
+ * 
+ * 	public boolean isEffective(Requirement requirement) {
+ * 		return true;
+ * 	}
+ * 
+ * 	public Map getWirings() {
+ * 		return Collections.EMPTY_MAP;
+ * 	}
+ * }
+ * </pre>
+ * 
+ * <p>
+ * A Synthesized capability must report the Host Bundle via the
+ * {@link Capability#getResource()} method. It must also report the original
+ * Capability from the Fragment Bundle via the {@link #getOriginal()} method.
+ * The Environment may then access the fragment resource that this capability
+ * originates from via {@link Capability#getResource()}.
+ */
+public interface Synthesized {
+	/**
+	 * The original {@link Capability}, {@link Requirement} or {@link Resource}
+	 * that backs this synthesized element.
+	 * 
+	 * @return the original capability, requirement or resource
+	 */
+	Object getOriginal();
+}

Modified: aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/package-info.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/package-info.java?rev=1241900&r1=1241899&r2=1241900&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/package-info.java (original)
+++ aries/trunk/subsystem/subsystem-api/src/main/java/org/osgi/service/resolver/package-info.java Wed Feb  8 13:54:41 2012
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2011). 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.
@@ -32,7 +32,7 @@
  * <p>
  * {@code  Import-Package: org.osgi.service.resolver; version="[1.0,1.1)"}
  * 
- * @version $Id: ffe26e5b960ebceb84699fd1cb8f211d9a386bf4 $
+ * @version $Id: d59eb041c07b894a395e45b82a24f058aadbec32 $
  */
 
-package org.osgi.service.resolver;
\ No newline at end of file
+package org.osgi.service.resolver;