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

svn commit: r910661 - in /incubator/aries/trunk/application: ./ application-itests/ application-itests/src/test/java/org/apache/aries/application/runtime/itests/ application-itests/src/test/resources/ application-itests/src/test/resources/basic/ applic...

Author: djencks
Date: Tue Feb 16 19:38:51 2010
New Revision: 910661

URL: http://svn.apache.org/viewvc?rev=910661&view=rev
Log:
ARIES-174 basic OBR backed AriesApplicationResolver, with some associated bugfixes.

Added:
    incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java
      - copied, changed from r908771, incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java
    incubator/aries/trunk/application/application-itests/src/test/resources/basic/
    incubator/aries/trunk/application/application-itests/src/test/resources/basic/APPLICATION.MF
      - copied unchanged from r908771, incubator/aries/trunk/application/application-itests/src/test/resources/APPLICATION.MF
    incubator/aries/trunk/application/application-itests/src/test/resources/basic/sample-blueprint.xml
      - copied unchanged from r908771, incubator/aries/trunk/application/application-itests/src/test/resources/sample-blueprint.xml
    incubator/aries/trunk/application/application-itests/src/test/resources/obr/
    incubator/aries/trunk/application/application-itests/src/test/resources/obr/repository.xml   (with props)
    incubator/aries/trunk/application/application-obr-resolver/
    incubator/aries/trunk/application/application-obr-resolver/pom.xml   (with props)
    incubator/aries/trunk/application/application-obr-resolver/src/
    incubator/aries/trunk/application/application-obr-resolver/src/main/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java   (with props)
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/CapabilityImpl.java   (with props)
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/MapToDictionary.java   (with props)
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/OBRBundleInfo.java   (with props)
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RequirementImpl.java   (with props)
    incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/ResourceImpl.java   (with props)
    incubator/aries/trunk/application/application-obr-resolver/src/main/resources/
    incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/
    incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/
    incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml   (with props)
    incubator/aries/trunk/application/application-obr-resolver/src/test/
    incubator/aries/trunk/application/application-obr-resolver/src/test/java/
    incubator/aries/trunk/application/application-obr-resolver/src/test/java/org/
    incubator/aries/trunk/application/application-obr-resolver/src/test/java/org/apache/
    incubator/aries/trunk/application/application-obr-resolver/src/test/java/org/apache/aries/
    incubator/aries/trunk/application/application-obr-resolver/src/test/java/org/apache/aries/application/
    incubator/aries/trunk/application/application-obr-resolver/src/test/java/org/apache/aries/application/resolver/
    incubator/aries/trunk/application/application-obr-resolver/src/test/java/org/apache/aries/application/resolver/obr/
    incubator/aries/trunk/application/application-obr-resolver/src/test/java/org/apache/aries/application/resolver/obr/impl/
Removed:
    incubator/aries/trunk/application/application-itests/src/test/resources/APPLICATION.MF
    incubator/aries/trunk/application/application-itests/src/test/resources/sample-blueprint.xml
Modified:
    incubator/aries/trunk/application/application-itests/pom.xml
    incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java
    incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java
    incubator/aries/trunk/application/application-management/pom.xml
    incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/BundleInfoImpl.java
    incubator/aries/trunk/application/application-runtime/pom.xml
    incubator/aries/trunk/application/application-utils/pom.xml
    incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java
    incubator/aries/trunk/application/pom.xml

Modified: incubator/aries/trunk/application/application-itests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/pom.xml?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/pom.xml (original)
+++ incubator/aries/trunk/application/application-itests/pom.xml Tue Feb 16 19:38:51 2010
@@ -34,11 +34,6 @@
     </description>
     
     <dependencies>
-        <dependency>
-            <groupId>org.apache.aries.application</groupId>
-            <artifactId>org.apache.aries.application.api</artifactId>
-        </dependency>
-
         <!-- Dependencies needed at test compile time -->
         <dependency>
             <groupId>org.osgi</groupId>
@@ -47,12 +42,68 @@
             <scope>test</scope>
         </dependency>
 
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.configadmin</artifactId>
+			<version>1.2.4</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.aries</groupId>
+			<artifactId>org.apache.aries.util</artifactId>
+			<version>${version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.aries.blueprint</groupId>
+			<artifactId>org.apache.aries.blueprint</artifactId>
+			<version>${version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.logging</groupId>
+			<artifactId>pax-logging-api</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.logging</groupId>
+			<artifactId>pax-logging-service</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.exam</groupId>
+			<artifactId>pax-exam</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.exam</groupId>
+			<artifactId>pax-exam-junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.exam</groupId>
+			<artifactId>pax-exam-container-default</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.url</groupId>
+			<artifactId>pax-url-mvn</artifactId>
+		</dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.bundlerepository</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.service.obr</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam-junit</artifactId>
             <scope>test</scope>
         </dependency>
-
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam-container-default</artifactId>
@@ -135,6 +186,41 @@
             <version>${version}</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.utils</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.resolver.obr</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.runtime.itest.interfaces</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.aries.testsupport</groupId>
+          <artifactId>org.apache.aries.testsupport.unit</artifactId>
+          <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
 
 
     </dependencies>

Modified: incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java (original)
+++ incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java Tue Feb 16 19:38:51 2010
@@ -25,7 +25,6 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
-import java.util.Arrays;
 
 import org.apache.aries.application.management.ApplicationContext;
 import org.apache.aries.application.management.AriesApplication;
@@ -61,7 +60,7 @@
         .binary("org/apache/aries/sample/impl/HelloWorldImpl.class", 
             BasicAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/sample/impl/HelloWorldImpl.class"))
         .binary("OSGI-INF/blueprint/sample-blueprint.xml", 
-            BasicAppManagerTest.class.getClassLoader().getResourceAsStream("sample-blueprint.xml"))
+            BasicAppManagerTest.class.getClassLoader().getResourceAsStream("basic/sample-blueprint.xml"))
         .end();
       
     FileOutputStream fout = new FileOutputStream("test.eba");
@@ -69,7 +68,7 @@
     fout.close();
     
     ZipFixture testEba2 = testEba.binary("META-INF/APPLICATION.MF", 
-        BasicAppManagerTest.class.getClassLoader().getResourceAsStream("APPLICATION.MF"))
+        BasicAppManagerTest.class.getClassLoader().getResourceAsStream("basic/APPLICATION.MF"))
         .end();
     fout = new FileOutputStream("test2.eba");
     testEba2.writeOut(fout);

Modified: incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java (original)
+++ incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java Tue Feb 16 19:38:51 2010
@@ -111,7 +111,7 @@
       sleepfor-=100;
     }
     assertNotNull("Timed out - didn't receive Blueprint CREATED or FAILURE event", acbl.success);
-    assertTrue("Recevied Blueprint FAILURE event", acbl.success);
+    assertTrue("Received Blueprint FAILURE event", acbl.success);
     
     ctx.stop();
     manager.uninstall(ctx);

Copied: incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java (from r908771, incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java)
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java?p2=incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java&p1=incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java&r1=908771&r2=910661&rev=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java (original)
+++ incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java Tue Feb 16 19:38:51 2010
@@ -18,14 +18,8 @@
  */
 package org.apache.aries.application.runtime.itests;
 
-import static org.junit.Assert.assertEquals;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
 import java.io.File;
 import java.io.FileOutputStream;
-import java.util.Arrays;
 
 import org.apache.aries.application.management.ApplicationContext;
 import org.apache.aries.application.management.AriesApplication;
@@ -39,76 +33,79 @@
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.service.obr.RepositoryAdmin;
+
+import static org.junit.Assert.assertEquals;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
 
 @RunWith(JUnit4TestRunner.class)
-public class BasicAppManagerTest extends AbstractIntegrationTest {
-  
+public class OBRAppManagerTest extends AbstractIntegrationTest {
+
   /* Use @Before not @BeforeClass so as to ensure that these resources
-   * are created in the paxweb temp directory, and not in the svn tree 
+   * are created in the paxweb temp directory, and not in the svn tree
    */
   static boolean createdApplications = false;
   @Before
   public static void createApplications() throws Exception {
-    if (createdApplications) { 
+    if (createdApplications) {
       return;
     }
+    ZipFixture testBundle = ArchiveFixture.newZip()
+        .manifest().symbolicName("org.apache.aries.sample")
+          .attribute("Bundle-Version", "1.0.0")
+          .attribute("Export-Package", "org.apache.aries.sample.impl")
+          .end()
+        .binary("org/apache/aries/sample/impl/HelloWorldImpl.class",
+            OBRAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/sample/impl/HelloWorldImpl.class"))
+        .end();
+
+    FileOutputStream fout = new FileOutputStream("bundle.jar");
+    testBundle.writeOut(fout);
+    fout.close();
+
     ZipFixture testEba = ArchiveFixture.newZip()
       .jar("sample.jar")
         .manifest().symbolicName("org.apache.aries.sample")
           .attribute("Bundle-Version", "1.0.0")
-          .attribute("Import-Package", "org.apache.aries.sample")
+          .attribute("Import-Package", "org.apache.aries.sample.impl")
           .end()
-        .binary("org/apache/aries/sample/impl/HelloWorldImpl.class", 
-            BasicAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/sample/impl/HelloWorldImpl.class"))
-        .binary("OSGI-INF/blueprint/sample-blueprint.xml", 
-            BasicAppManagerTest.class.getClassLoader().getResourceAsStream("sample-blueprint.xml"))
+        .binary("OSGI-INF/blueprint/sample-blueprint.xml",
+            OBRAppManagerTest.class.getClassLoader().getResourceAsStream("basic/sample-blueprint.xml"))
+        .end()
+         .binary("META-INF/APPLICATION.MF",
+        OBRAppManagerTest.class.getClassLoader().getResourceAsStream("basic/APPLICATION.MF"))
         .end();
-      
-    FileOutputStream fout = new FileOutputStream("test.eba");
+    fout = new FileOutputStream("test.eba");
     testEba.writeOut(fout);
     fout.close();
-    
-    ZipFixture testEba2 = testEba.binary("META-INF/APPLICATION.MF", 
-        BasicAppManagerTest.class.getClassLoader().getResourceAsStream("APPLICATION.MF"))
-        .end();
-    fout = new FileOutputStream("test2.eba");
-    testEba2.writeOut(fout);
-    fout.close();
+
     createdApplications = true;
   }
-  
-  @Test
-  public void testAppWithoutApplicationManifest() throws Exception {
-    
-    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
-    ApplicationContext ctx = manager.install(app);
-    ctx.start();
-    
-    HelloWorld hw = getOsgiService(HelloWorld.class);
-    String result = hw.getMessage();
-    assertEquals (result, "hello world");
-    
-    ctx.stop();
-    manager.uninstall(ctx);
-  }
 
   @Test
   public void testAppWithApplicationManifest() throws Exception {
+    RepositoryAdmin repositoryAdmin = getOsgiService(RepositoryAdmin.class);
+    repositoryAdmin.addRepository(OBRAppManagerTest.class.getClassLoader().getResource("obr/repository.xml"));
+
     AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
-    ApplicationContext ctx = manager.install(app);
-    ctx.start();
-    
-    HelloWorld hw = getOsgiService(HelloWorld.class);
-    String result = hw.getMessage();
-    assertEquals (result, "hello world");
-    
-    ctx.stop();
-    manager.uninstall(ctx);
+    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
+    //installing requires a valid url for the bundle in repository.xml.
+//    ApplicationContext ctx = manager.install(app);
+//    ctx.start();
+
+//    HelloWorld hw = getOsgiService(HelloWorld.class);
+//    String result = hw.getMessage();
+//    assertEquals (result, "hello world");
+//
+//    ctx.stop();
+//    manager.uninstall(ctx);
   }
 
-  
+
   @org.ops4j.pax.exam.junit.Configuration
   public static Option[] configuration() {
     Option[] options = options(
@@ -129,16 +126,19 @@
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.management"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime"),
+        mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"),
+        mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces"),
         mavenBundle("org.apache.aries", "org.apache.aries.util"),
-        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"), 
+        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
         mavenBundle("org.osgi", "org.osgi.compendium"),
         mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
-        
+
+//        /* For debugging, uncomment the next two lines
+//        vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+//        waitForFrameworkStartup(),
+
         /* For debugging, uncomment the next two lines
-        vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"),
-        waitForFrameworkStartup(),
-        
         and add these imports:
         import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
         import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
@@ -148,4 +148,4 @@
     options = updateOptions(options);
     return options;
   }
-}
+}
\ No newline at end of file

Added: incubator/aries/trunk/application/application-itests/src/test/resources/obr/repository.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/resources/obr/repository.xml?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/resources/obr/repository.xml (added)
+++ incubator/aries/trunk/application/application-itests/src/test/resources/obr/repository.xml Tue Feb 16 19:38:51 2010
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<repository name="Geronimo Framework, Configs :: J2EE System">
+    <resource version="1.3.0.3" uri="mvn:org.apache.aries.sample/org.apache.aries.sample/1.0"
+              symbolicname="org.apache.aries.sample"
+              presentationname="org.apache.aries.sample" id="1266103855623">
+        <description>sample</description>
+        <license>http://www.apache.org/licenses/LICENSE-2.0.txt</license>
+        <capability name="bundle">
+            <p v="org.apache.aries.sample" n="symbolicname"/>
+            <p v="1.0" t="version" n="version"/>
+            <p v="2" t="version" n="manifestversion"/>
+        </capability>
+        <capability name="package">
+            <p v="org.apache.aries.sample.impl" n="package"/>
+            <p v="1.0" t="version" n="version"/>
+        </capability>
+    </resource>
+
+</repository>
\ No newline at end of file

Propchange: incubator/aries/trunk/application/application-itests/src/test/resources/obr/repository.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-itests/src/test/resources/obr/repository.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-itests/src/test/resources/obr/repository.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/aries/trunk/application/application-management/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/pom.xml?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-management/pom.xml (original)
+++ incubator/aries/trunk/application/application-management/pom.xml Tue Feb 16 19:38:51 2010
@@ -46,6 +46,7 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

Modified: incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/BundleInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/BundleInfoImpl.java?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/BundleInfoImpl.java (original)
+++ incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/BundleInfoImpl.java Tue Feb 16 19:38:51 2010
@@ -69,10 +69,11 @@
   }
 
   public Map<String, String> getHeaders() {
-    Set<Entry<Object, Object>> headers = _attributes.entrySet();
     Map<String, String> result = new HashMap<String, String>();
-    for (Entry<Object, Object> h: headers) { 
-      result.put((String)h.getKey(), (String)h.getValue());
+    for (Entry<Object, Object> h: _attributes.entrySet()) {
+      Attributes.Name name = (Attributes.Name) h.getKey();
+      String value = (String) h.getValue();
+      result.put(name.toString(), value);
     }
     return result;
   }
@@ -103,7 +104,7 @@
     return _version;
   }
 
-  private Set<Content> getContentSetFromHeader (Attributes attributes, String key) { 
+  private Set<Content> getContentSetFromHeader (Attributes attributes, String key) {
     String header = _attributes.getValue(key);
     List<String> splitHeader = ManifestHeaderProcessor.split(header, ",");
     HashSet<Content> result = new HashSet<Content>();

Added: incubator/aries/trunk/application/application-obr-resolver/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/pom.xml?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/pom.xml (added)
+++ incubator/aries/trunk/application/application-obr-resolver/pom.xml Tue Feb 16 19:38:51 2010
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>application</artifactId>
+        <groupId>org.apache.aries.application</groupId>
+        <version>1.0.0-incubating-SNAPSHOT</version>
+    </parent>
+    <artifactId>org.apache.aries.application.resolver.obr</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries application OBR integration</name>
+    <description>
+      Implementation of the AriesApplicationResolver using OBR
+    </description>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.utils</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.management</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.service.obr</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
+                        <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Bundle-DocURL</_removeheaders>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+</project>

Propchange: incubator/aries/trunk/application/application-obr-resolver/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-obr-resolver/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-obr-resolver/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java (added)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java Tue Feb 16 19:38:51 2010
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.aries.application.resolver.obr;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.application.Content;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.AriesApplicationResolver;
+import org.apache.aries.application.management.BundleInfo;
+import org.apache.aries.application.management.ResolverException;
+import org.apache.aries.application.resolver.obr.impl.CapabilityImpl;
+import org.apache.aries.application.resolver.obr.impl.OBRBundleInfo;
+import org.apache.aries.application.resolver.obr.impl.RequirementImpl;
+import org.apache.aries.application.resolver.obr.impl.ResourceImpl;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.Version;
+import org.osgi.service.obr.Capability;
+import org.osgi.service.obr.RepositoryAdmin;
+import org.osgi.service.obr.Requirement;
+import org.osgi.service.obr.Resolver;
+import org.osgi.service.obr.Resource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OBRAriesResolver implements AriesApplicationResolver
+{
+
+  private final RepositoryAdmin repositoryAdmin;
+
+  public OBRAriesResolver(RepositoryAdmin repositoryAdmin)
+  {
+    this.repositoryAdmin = repositoryAdmin;
+  }
+
+  public Set<BundleInfo> resolve(AriesApplication app) throws ResolverException
+  {
+    Resolver obrResolver = repositoryAdmin.resolver();
+    for (BundleInfo bundleInfo: app.getBundleInfo()) {
+      Resource resource = toResource(bundleInfo);
+      obrResolver.add(resource);
+    }
+    if (obrResolver.resolve()) {
+      Set<BundleInfo> result = new HashSet<BundleInfo>(app.getBundleInfo());
+      for (Resource resource: obrResolver.getRequiredResources()) {
+        BundleInfo bundleInfo = toBundleInfo(resource);
+        result.add(bundleInfo);
+      }
+      for (Resource resource: obrResolver.getOptionalResources()) {
+        BundleInfo bundleInfo = toBundleInfo(resource);
+        result.add(bundleInfo);
+      }
+      return result;
+    } else {
+      throw new ResolverException("Could not resolve requirements: " + toString(obrResolver.getUnsatisfiedRequirements()));
+    }
+  }
+
+  public BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion)
+  {
+    Map<String, String> attribs = new HashMap<String, String>();
+    attribs.put("BundleSymbolic-Name", bundleSymbolicName);
+    attribs.put("Bundle-Version", bundleVersion.toString());
+    String filterString = ManifestHeaderProcessor.generateFilter("bundle", bundleSymbolicName, attribs);
+    Resource[] resources = repositoryAdmin.discoverResources(filterString);
+    if (resources != null && resources.length > 0) {
+      return toBundleInfo(resources[0]);
+    } else {
+      return null;
+    }
+  }
+
+  private String toString(Requirement[] unsatisfiedRequirements)
+  {
+    return null;
+  }
+
+  private BundleInfo toBundleInfo(Resource resource)
+  {
+    String location = resource.getURL().toExternalForm();
+    return new OBRBundleInfo(resource.getSymbolicName(),
+            resource.getVersion(),
+            location,
+            null,
+            null,
+            null);
+  }
+
+  private Resource toResource(BundleInfo bundleInfo) throws ResolverException
+  {
+    String id = bundleInfo.getSymbolicName() + "_" + bundleInfo.getVersion();
+    Requirement[] requirements = toRequirements(bundleInfo.getImportPackage());
+    Capability[] capabilities = toCapabilities(bundleInfo.getExportPackage());
+    URL url;
+    try {
+      url = new URL(bundleInfo.getLocation());
+    } catch (MalformedURLException e) {
+      throw new ResolverException(e);
+    }
+    return new ResourceImpl(bundleInfo.getHeaders(),
+            bundleInfo.getSymbolicName(),
+            bundleInfo.getSymbolicName(),
+            bundleInfo.getVersion(),
+            id,
+            url,
+            requirements,
+            capabilities,
+            null,
+            null);
+  }
+
+  private Requirement[] toRequirements(Set<Content> importPackage) throws ResolverException
+  {
+    Requirement[] requirements = new Requirement[importPackage.size()];
+    int i = 0;
+    for (Content content: importPackage) {
+      requirements[i++] = toRequirement(content);
+    }
+    return requirements;
+  }
+
+  private Requirement toRequirement(Content content) throws ResolverException
+  {
+    Map<String, String> attributes = new HashMap<String, String>();
+    for (Map.Entry<String, String> entry: content.getNameValueMap().entrySet()) {
+      //leave out resolution:=optional, etc
+      if (!entry.getKey().endsWith(":")) {
+        attributes.put(entry.getKey(), entry.getValue());
+      }
+    }
+    String filterString = ManifestHeaderProcessor.generateFilter("package", content.getContentName(), attributes);
+    Filter filter = null;
+    try {
+      filter = FrameworkUtil.createFilter(filterString);
+    } catch (InvalidSyntaxException e) {
+      throw new ResolverException(e);
+    }
+    boolean multiple = false;
+    boolean optional = "optional".equals(content.getNameValueMap().get("resolution:"));
+    boolean extend = false;
+    return new RequirementImpl("package",
+            filter,
+            multiple,
+            optional,
+            extend,
+            null);
+  }
+
+  private Capability[] toCapabilities(Set<Content> exportPackage)
+  {
+    Capability[] capabilities = new Capability[exportPackage.size()];
+    int i = 0;
+    for (Content content: exportPackage) {
+      capabilities[i++] = toCapability(content);
+    }
+    return capabilities;
+  }
+
+  private Capability toCapability(Content content)
+  {
+    return new CapabilityImpl(content.getContentName(), content.getNameValueMap());
+  }
+}

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/CapabilityImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/CapabilityImpl.java?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/CapabilityImpl.java (added)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/CapabilityImpl.java Tue Feb 16 19:38:51 2010
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.aries.application.resolver.obr.impl;
+
+import org.osgi.service.obr.Capability;
+
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CapabilityImpl implements Capability
+{
+
+  private final String name;
+  private final Map properties;
+
+  public CapabilityImpl(String name, Map properties)
+  {
+    this.name = name;
+    this.properties = properties;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public Map getProperties()
+  {
+    return properties;
+  }
+  
+}

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/CapabilityImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/CapabilityImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/CapabilityImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/MapToDictionary.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/MapToDictionary.java?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/MapToDictionary.java (added)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/MapToDictionary.java Tue Feb 16 19:38:51 2010
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.aries.application.resolver.obr.impl;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MapToDictionary extends Dictionary
+{
+  /**
+   * Map source.
+   */
+  private final Map m_map;
+
+  public MapToDictionary(Map map)
+  {
+    m_map = map;
+  }
+
+  public Enumeration elements()
+  {
+    if (m_map == null) {
+      return null;
+    }
+    return new IteratorToEnumeration(m_map.values().iterator());
+  }
+
+  public Object get(Object key)
+  {
+    if (m_map == null) {
+      return null;
+    }
+    return m_map.get(key);
+  }
+
+  public boolean isEmpty()
+  {
+    if (m_map == null) {
+      return true;
+    }
+    return m_map.isEmpty();
+  }
+
+  public Enumeration keys()
+  {
+    if (m_map == null) {
+      return null;
+    }
+    return new IteratorToEnumeration(m_map.keySet().iterator());
+  }
+
+  public Object put(Object key, Object value)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public Object remove(Object key)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public int size()
+  {
+    if (m_map == null) {
+      return 0;
+    }
+    return m_map.size();
+  }
+
+  private static class IteratorToEnumeration implements Enumeration
+  {
+    private final Iterator m_iter;
+
+    public IteratorToEnumeration(Iterator iter)
+    {
+      m_iter = iter;
+    }
+
+    public boolean hasMoreElements()
+    {
+      if (m_iter == null)
+        return false;
+      return m_iter.hasNext();
+    }
+
+    public Object nextElement()
+    {
+      if (m_iter == null)
+        return null;
+      return m_iter.next();
+    }
+  }
+
+}

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/MapToDictionary.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/MapToDictionary.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/MapToDictionary.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/OBRBundleInfo.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/OBRBundleInfo.java?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/OBRBundleInfo.java (added)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/OBRBundleInfo.java Tue Feb 16 19:38:51 2010
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.aries.application.resolver.obr.impl;
+
+import org.apache.aries.application.Content;
+import org.apache.aries.application.management.BundleInfo;
+import org.osgi.framework.Version;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OBRBundleInfo implements BundleInfo
+{
+
+  private final String symbolicName;
+  private final Version version;
+  private final String location;
+  private final Set<Content> importPackage;
+  private final Set<Content> exportPackage;
+  private final Map<String, String> headers;
+
+  public OBRBundleInfo(String symbolicName, Version version, String location, Set<Content> importPackage, Set<Content> exportPackage, Map<String, String> headers)
+  {
+    this.symbolicName = symbolicName;
+    this.version = version;
+    this.location = location;
+    this.importPackage = importPackage;
+    this.exportPackage = exportPackage;
+    this.headers = headers;
+  }
+
+  public String getSymbolicName()
+  {
+    return symbolicName;
+  }
+
+  public Version getVersion()
+  {
+    return version;
+  }
+
+  public String getLocation()
+  {
+    return location;
+  }
+
+  public Set<Content> getImportPackage()
+  {
+    return importPackage;
+  }
+
+  public Set<Content> getExportPackage()
+  {
+    return exportPackage;
+  }
+
+  public Set<Content> getImportService()
+  {
+    //TODO NYI
+    return null;
+  }
+
+  public Set<Content> getExportService()
+  {
+    //TODO NYI
+    return null;
+  }
+
+  public Map<String, String> getHeaders()
+  {
+    return headers;
+  }
+}

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/OBRBundleInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/OBRBundleInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/OBRBundleInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RequirementImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RequirementImpl.java?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RequirementImpl.java (added)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RequirementImpl.java Tue Feb 16 19:38:51 2010
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.aries.application.resolver.obr.impl;
+
+import org.osgi.framework.Filter;
+import org.osgi.service.obr.Capability;
+import org.osgi.service.obr.Requirement;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequirementImpl implements Requirement
+{
+
+  private final String name;
+  private final Filter filter;
+  private final boolean multiple;
+  private final boolean optional;
+  private final boolean extend;
+  private final String comment;
+
+  public RequirementImpl(String name, Filter filter, boolean multiple, boolean optional, boolean extend, String comment)
+  {
+    this.name = name;
+    this.filter = filter;
+    this.multiple = multiple;
+    this.optional = optional;
+    this.extend = extend;
+    this.comment = comment;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public String getFilter()
+  {
+    return filter.toString();
+  }
+
+  public boolean isMultiple()
+  {
+    return multiple;
+  }
+
+  public boolean isOptional()
+  {
+    return optional;
+  }
+
+  public boolean isExtend()
+  {
+    return extend;
+  }
+
+  public String getComment()
+  {
+    return comment;
+  }
+
+  public boolean isSatisfied(Capability capability)
+  {
+    return filter.match(new MapToDictionary(capability.getProperties()));
+  }
+}

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RequirementImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RequirementImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RequirementImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/ResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/ResourceImpl.java?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/ResourceImpl.java (added)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/ResourceImpl.java Tue Feb 16 19:38:51 2010
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.aries.application.resolver.obr.impl;
+
+import org.osgi.framework.Version;
+import org.osgi.service.obr.Capability;
+import org.osgi.service.obr.Repository;
+import org.osgi.service.obr.Requirement;
+import org.osgi.service.obr.Resource;
+
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceImpl implements Resource
+{
+
+  private final Map properties;
+  private final String symbolicName;
+  private final String presentationName;
+  private final Version version;
+  private final String id;
+  private final URL url;
+  private final Requirement[] requirements;
+  private final Capability[] capabilities;
+  private final String[] categories;
+  private final Repository repository;
+
+
+  public ResourceImpl(Map properties, String symbolicName, String presentationName, Version version, String id, URL url, Requirement[] requirements, Capability[] capabilities, String[] categories, Repository repository)
+  {
+    this.properties = properties;
+    this.symbolicName = symbolicName;
+    this.presentationName = presentationName;
+    this.version = version;
+    this.id = id;
+    this.url = url;
+    this.requirements = requirements;
+    this.capabilities = capabilities;
+    this.categories = categories;
+    this.repository = repository;
+  }
+
+  public Map getProperties()
+  {
+    return properties;
+  }
+
+  public String getSymbolicName()
+  {
+    return symbolicName;
+  }
+
+  public String getPresentationName()
+  {
+    return presentationName;
+  }
+
+  public Version getVersion()
+  {
+    return version;
+  }
+
+  public String getId()
+  {
+    return id;
+  }
+
+  public URL getURL()
+  {
+    return url;
+  }
+
+  public Requirement[] getRequirements()
+  {
+    return requirements;
+  }
+
+  public Capability[] getCapabilities()
+  {
+    return capabilities;
+  }
+
+  public String[] getCategories()
+  {
+    return categories;
+  }
+
+  public Repository getRepository()
+  {
+    return repository;
+  }
+}

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/ResourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/ResourceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/ResourceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml?rev=910661&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml (added)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml Tue Feb 16 19:38:51 2010
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="obr-resolver" class="org.apache.aries.application.resolver.obr.OBRAriesResolver" scope="singleton"
+          activation="eager">
+        <argument>
+            <reference interface="org.osgi.service.obr.RepositoryAdmin"/>
+        </argument>
+    </bean>
+
+    <service interface="org.apache.aries.application.management.AriesApplicationResolver" ref="obr-resolver"/>
+
+</blueprint>

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/aries/trunk/application/application-runtime/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-runtime/pom.xml?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-runtime/pom.xml (original)
+++ incubator/aries/trunk/application/application-runtime/pom.xml Tue Feb 16 19:38:51 2010
@@ -46,6 +46,7 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

Modified: incubator/aries/trunk/application/application-utils/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/pom.xml?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/pom.xml (original)
+++ incubator/aries/trunk/application/application-utils/pom.xml Tue Feb 16 19:38:51 2010
@@ -55,6 +55,7 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

Modified: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java (original)
+++ incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java Tue Feb 16 19:38:51 2010
@@ -355,7 +355,7 @@
    * <p>
    * Result is returned as a list, as export does allow duplicate package exports.
    * 
-   * @param s The data to parse.
+   * @param list The data to parse.
    * @return List of NameValuePairs, where each Name in the list is an exported package, 
    *         with its associated Value being a NameValueMap of any attributes declared. 
    */

Modified: incubator/aries/trunk/application/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/pom.xml?rev=910661&r1=910660&r2=910661&view=diff
==============================================================================
--- incubator/aries/trunk/application/pom.xml (original)
+++ incubator/aries/trunk/application/pom.xml Tue Feb 16 19:38:51 2010
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-	<!--
+<!--
 		Licensed to the Apache Software Foundation (ASF) under one or more
 		contributor license agreements. See the NOTICE file distributed with
 		this work for additional information regarding copyright ownership.
@@ -13,9 +13,7 @@
 		CONDITIONS OF ANY KIND, either express or implied. See the License for
 		the specific language governing permissions and limitations under the
 		License.
-	-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
 	<parent>
 		<groupId>org.apache.aries</groupId>
@@ -89,6 +87,11 @@
 			</dependency>
 			<dependency>
 				<groupId>org.apache.aries.application</groupId>
+				<artifactId>org.apache.aries.application.resolver.obr</artifactId>
+				<version>${version}</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.aries.application</groupId>
 				<artifactId>org.apache.aries.application.runtime</artifactId>
 				<version>${version}</version>
 			</dependency>
@@ -156,6 +159,22 @@
 				<artifactId>pax-url-mvn</artifactId>
 				<version>1.0.0</version>
 			</dependency>
+            <dependency>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>org.osgi.service.obr</artifactId>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.apache.felix</groupId>
+                        <artifactId>org.osgi.core</artifactId>
+                    </exclusion>
+                </exclusions>
+                <version>1.1.0-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>org.apache.felix.bundlerepository</artifactId>
+                <version>1.5.0-SNAPSHOT</version>
+            </dependency>
 		</dependencies>
 	</dependencyManagement>
 
@@ -188,6 +207,7 @@
 		<module>application-runtime</module>
 		<module>application-itest-interface</module>
 		<module>application-itests</module>
+        <module>application-obr-resolver</module>
 		<module>application-install</module>
 	</modules>