You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by da...@apache.org on 2011/04/29 13:08:42 UTC

svn commit: r1097768 - in /aries/trunk/spi-fly/spi-fly-examples: ./ spi-fly-example-client-bundle/ spi-fly-example-client-bundle/src/main/java/org/apache/aries/spifly/client/ spi-fly-example-client-jar/ spi-fly-example-client-jar/src/ spi-fly-example-c...

Author: davidb
Date: Fri Apr 29 11:08:41 2011
New Revision: 1097768

URL: http://svn.apache.org/viewvc?rev=1097768&view=rev
Log:
Work in progress on the SPI-Fly examples.

Added:
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/pom.xml
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/spifly/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/spifly/client/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/spifly/client/jar/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/spifly/client/jar/Consumer.java
Modified:
    aries/trunk/spi-fly/spi-fly-examples/pom.xml
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/pom.xml
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/src/main/java/org/apache/aries/spifly/client/Activator.java
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/pom.xml
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl/SPIProviderImpl.java
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/pom.xml
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl2/SPIProviderImpl.java
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/pom.xml
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/src/main/java/org/apache/aries/spifly/mysvc/SPIProvider.java

Modified: aries/trunk/spi-fly/spi-fly-examples/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/pom.xml?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-examples/pom.xml Fri Apr 29 11:08:41 2011
@@ -40,6 +40,7 @@
     
     <modules>
         <module>spi-fly-example-spi-bundle</module>
+        <module>spi-fly-example-client-jar</module>
         <module>spi-fly-example-client-bundle</module>
         <module>spi-fly-example-provider1-bundle</module>
         <module>spi-fly-example-provider2-bundle</module>

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/pom.xml?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/pom.xml Fri Apr 29 11:08:41 2011
@@ -28,7 +28,7 @@
         <version>0.4-SNAPSHOT</version>
     </parent>
 
-    <artifactId>org.apache.aries.spifly.examples.client</artifactId>
+    <artifactId>org.apache.aries.spifly.examples.client.bundle</artifactId>
     <packaging>bundle</packaging>
     <name>Apache Aries Example SPI Client Bundle</name>
     <description>
@@ -50,10 +50,16 @@
         
         <dependency>
             <groupId>org.apache.aries.spifly.examples</groupId>
-            <artifactId>org.apache.aries.spifly.examples.spi</artifactId>
+            <artifactId>org.apache.aries.spifly.examples.spi.bundle</artifactId>
             <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>        
+
+        <dependency>
+            <groupId>org.apache.aries.spifly.examples</groupId>
+            <artifactId>org.apache.aries.spifly.examples.client.jar</artifactId>
+            <version>${project.version}</version>
+        </dependency>        
     </dependencies>
 
     <build>

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/src/main/java/org/apache/aries/spifly/client/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/src/main/java/org/apache/aries/spifly/client/Activator.java?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/src/main/java/org/apache/aries/spifly/client/Activator.java (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-bundle/src/main/java/org/apache/aries/spifly/client/Activator.java Fri Apr 29 11:08:41 2011
@@ -18,20 +18,16 @@
  */
 package org.apache.aries.spifly.client;
 
-import java.util.ServiceLoader;
-
-import org.apache.aries.spifly.mysvc.SPIProvider;
+import org.apache.aries.spifly.client.jar.Consumer;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 
 public class Activator implements BundleActivator {
 	public void start(BundleContext context) throws Exception {
-		ServiceLoader<SPIProvider> ldr = ServiceLoader.load(SPIProvider.class);
-        for (SPIProvider spiObject : ldr) {
-            spiObject.doit(); // invoke the SPI object
-        }
+	    Consumer consumer = new Consumer();
+	    System.out.println("*** Result from invoking the SPI consumer: " + consumer.callSPI());
 	}
-	
+
 	public void stop(BundleContext context) throws Exception {
 	}
 }

Added: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/pom.xml?rev=1097768&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/pom.xml (added)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/pom.xml Fri Apr 29 11:08:41 2011
@@ -0,0 +1,45 @@
+<?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.
+    -->
+<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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries.spifly.examples</groupId>
+        <artifactId>examples</artifactId>
+        <version>0.4-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.aries.spifly.examples.client.jar</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache Aries Example SPI Client Jar</name>
+    <description>
+        A Jar file containing code that uses the java.util.ServiceLoader() API.
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.spifly.examples</groupId>
+            <artifactId>org.apache.aries.spifly.examples.spi.bundle</artifactId>
+            <version>${project.version}</version>
+        </dependency>        
+    </dependencies>
+</project>

Added: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/spifly/client/jar/Consumer.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/spifly/client/jar/Consumer.java?rev=1097768&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/spifly/client/jar/Consumer.java (added)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client-jar/src/main/java/org/apache/aries/spifly/client/jar/Consumer.java Fri Apr 29 11:08:41 2011
@@ -0,0 +1,36 @@
+/**
+ * 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.spifly.client.jar;
+
+import java.util.ServiceLoader;
+
+import org.apache.aries.spifly.mysvc.SPIProvider;
+
+public class Consumer {
+    public String callSPI() {
+        StringBuilder sb = new StringBuilder();
+
+        ServiceLoader<SPIProvider> ldr = ServiceLoader.load(SPIProvider.class);
+        for (SPIProvider spiObject : ldr) {
+            sb.append(spiObject.doit()); // invoke the SPI object
+        }
+
+        return sb.toString();
+    }
+}

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/pom.xml?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/pom.xml Fri Apr 29 11:08:41 2011
@@ -28,7 +28,7 @@
         <version>0.4-SNAPSHOT</version>
     </parent>
 
-    <artifactId>org.apache.aries.spifly.examples.provider1</artifactId>
+    <artifactId>org.apache.aries.spifly.examples.provider1.bundle</artifactId>
     <packaging>bundle</packaging>
     <name>Apache Aries Example SPI Provider Bundle 1</name>
     <description>
@@ -38,7 +38,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.aries.spifly.examples</groupId>
-            <artifactId>org.apache.aries.spifly.examples.spi</artifactId>
+            <artifactId>org.apache.aries.spifly.examples.spi.bundle</artifactId>
             <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>        

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl/SPIProviderImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl/SPIProviderImpl.java?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl/SPIProviderImpl.java (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider1-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl/SPIProviderImpl.java Fri Apr 29 11:08:41 2011
@@ -22,7 +22,7 @@ import org.apache.aries.spifly.mysvc.SPI
 
 public class SPIProviderImpl extends SPIProvider {
 	@Override
-	public void doit() {
-		System.out.println("Doing it!");
+	public String doit() {
+		return "Doing it!";
 	}
 }

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/pom.xml?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/pom.xml Fri Apr 29 11:08:41 2011
@@ -28,7 +28,7 @@
         <version>0.4-SNAPSHOT</version>
     </parent>
 
-    <artifactId>org.apache.aries.spifly.examples.provider2</artifactId>
+    <artifactId>org.apache.aries.spifly.examples.provider2.bundle</artifactId>
     <packaging>bundle</packaging>
     <name>Apache Aries Example SPI Provider Bundle 2</name>
     <description>
@@ -38,7 +38,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.aries.spifly.examples</groupId>
-            <artifactId>org.apache.aries.spifly.examples.spi</artifactId>
+            <artifactId>org.apache.aries.spifly.examples.spi.bundle</artifactId>
             <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>        

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl2/SPIProviderImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl2/SPIProviderImpl.java?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl2/SPIProviderImpl.java (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider2-bundle/src/main/java/org/apache/aries/spifly/mysvc/impl2/SPIProviderImpl.java Fri Apr 29 11:08:41 2011
@@ -22,7 +22,7 @@ import org.apache.aries.spifly.mysvc.SPI
 
 public class SPIProviderImpl extends SPIProvider {
 	@Override
-	public void doit() {
-		System.out.println("Doing it too!");
+	public String doit() {
+		return "Doing it too!";
 	}
 }

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/pom.xml?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/pom.xml Fri Apr 29 11:08:41 2011
@@ -28,7 +28,7 @@
         <version>0.4-SNAPSHOT</version>
     </parent>
 
-    <artifactId>org.apache.aries.spifly.examples.spi</artifactId>
+    <artifactId>org.apache.aries.spifly.examples.spi.bundle</artifactId>
     <packaging>bundle</packaging>
     <name>Apache Aries Example SPI Interface</name>
     <description>

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/src/main/java/org/apache/aries/spifly/mysvc/SPIProvider.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/src/main/java/org/apache/aries/spifly/mysvc/SPIProvider.java?rev=1097768&r1=1097767&r2=1097768&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/src/main/java/org/apache/aries/spifly/mysvc/SPIProvider.java (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-spi-bundle/src/main/java/org/apache/aries/spifly/mysvc/SPIProvider.java Fri Apr 29 11:08:41 2011
@@ -19,5 +19,5 @@
 package org.apache.aries.spifly.mysvc;
 
 public abstract class SPIProvider {
-	public abstract void doit();
+	public abstract String doit();
 }