aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1102675 - in /aries/trunk/spi-fly/spi-fly-examples: spi-fly-example-client1-bundle/src/main/java/org/apache/aries/spifly/client/bundle/ spi-fly-example-client2-bundle/ spi-fly-example-client2-bundle/src/main/java/org/ spi-fly-example-clien...
Date Fri, 13 May 2011 11:17:26 GMT
Author: davidb
Date: Fri May 13 11:17:26 2011
New Revision: 1102675

URL: http://svn.apache.org/viewvc?rev=1102675&view=rev
Log:
Second example client.

This client uses java.util.ServiceLoader directly rather than going through an embedded library.

Added:
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/examples/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/examples/client2/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/examples/client2/impl/
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/examples/client2/impl/Activator.java
Modified:
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client1-bundle/src/main/java/org/apache/aries/spifly/client/bundle/Activator.java
    aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/pom.xml

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client1-bundle/src/main/java/org/apache/aries/spifly/client/bundle/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client1-bundle/src/main/java/org/apache/aries/spifly/client/bundle/Activator.java?rev=1102675&r1=1102674&r2=1102675&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client1-bundle/src/main/java/org/apache/aries/spifly/client/bundle/Activator.java
(original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client1-bundle/src/main/java/org/apache/aries/spifly/client/bundle/Activator.java
Fri May 13 11:17:26 2011
@@ -25,7 +25,7 @@ import org.osgi.framework.BundleContext;
 public class Activator implements BundleActivator {
 	public void start(BundleContext context) throws Exception {
 	    Consumer consumer = new Consumer();
-	    System.out.println("*** Result from invoking the SPI consumer: " + consumer.callSPI());
+	    System.out.println("*** Result from invoking the SPI consume via library: " + consumer.callSPI());
 	}
 
 	public void stop(BundleContext context) throws Exception {

Modified: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/pom.xml?rev=1102675&r1=1102674&r2=1102675&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/pom.xml Fri May 13
11:17:26 2011
@@ -32,7 +32,7 @@
     <packaging>bundle</packaging>
     <name>Apache Aries Example SPI Client Bundle 2</name>
     <description>
-        A Bundle that uses the java.util.ServiceLoader() API through an embedded library.

+        A Bundle that uses the java.util.ServiceLoader() API 
     </description>
 
     <dependencies>
@@ -43,23 +43,11 @@
         </dependency>        
 
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>        
-        
-        <dependency>
             <groupId>org.apache.aries.spifly.examples</groupId>
             <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.client1.jar</artifactId>
-            <version>${project.version}</version>
-        </dependency>        
     </dependencies>
 
     <build>
@@ -73,12 +61,10 @@
                             *
                         </Import-Package>
                         <Export-Package/>
-                        <_exportcontents/>
                         <Private-Package>
-                            org.apache.aries.spifly.client.bundle
+                            org.apache.aries.spifly.examples.client2.impl
                         </Private-Package>
-                        <Embed-Dependency>*;scope=compile;inline=false</Embed-Dependency>
-                        <Bundle-Activator>org.apache.aries.spifly.client.bundle.Activator</Bundle-Activator>
+                        <Bundle-Activator>org.apache.aries.spifly.examples.client2.impl.Activator</Bundle-Activator>
                         <SPI-Consumer>*</SPI-Consumer>
                     </instructions>
                 </configuration>

Added: aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/examples/client2/impl/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/examples/client2/impl/Activator.java?rev=1102675&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/examples/client2/impl/Activator.java
(added)
+++ aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-client2-bundle/src/main/java/org/apache/aries/spifly/examples/client2/impl/Activator.java
Fri May 13 11:17:26 2011
@@ -0,0 +1,22 @@
+package org.apache.aries.spifly.examples.client2.impl;
+
+import java.util.ServiceLoader;
+
+import org.apache.aries.spifly.mysvc.SPIProvider;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+    @Override
+    public void start(BundleContext context) throws Exception {
+        System.out.println("*** Result from invoking the SPI directly: ");
+        ServiceLoader<SPIProvider> ldr = ServiceLoader.load(SPIProvider.class);
+        for (SPIProvider spiObject : ldr) {
+            System.out.println(spiObject.doit()); // invoke the SPI object
+        }
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+    }
+}



Mime
View raw message