You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by da...@apache.org on 2010/06/25 13:33:00 UTC

svn commit: r957894 - in /cxf/dosgi/trunk/samples/ds: client/ client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/ client/src/main/resources/OSGI-INF/remote-service/ impl/src/main/resources/OSGI-INF/

Author: davidb
Date: Fri Jun 25 11:33:00 2010
New Revision: 957894

URL: http://svn.apache.org/viewvc?rev=957894&view=rev
Log:
Fixes to the DS demo.

Added:
    cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/Activator.java
Modified:
    cxf/dosgi/trunk/samples/ds/client/pom.xml
    cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/AdderConsumer.java
    cxf/dosgi/trunk/samples/ds/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
    cxf/dosgi/trunk/samples/ds/impl/src/main/resources/OSGI-INF/component.xml

Modified: cxf/dosgi/trunk/samples/ds/client/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/ds/client/pom.xml?rev=957894&r1=957893&r2=957894&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/ds/client/pom.xml (original)
+++ cxf/dosgi/trunk/samples/ds/client/pom.xml Fri Jun 25 11:33:00 2010
@@ -54,8 +54,8 @@
             <Bundle-Name>${pom.name}</Bundle-Name>
             <Bundle-Description>This bundle contains the client-side implementation of the Distributed OSGi with Declarative Services sample.</Bundle-Description>
             <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-            <Import-Package>org.apache.cxf.dosgi.samples.ds,
-                            org.osgi.service.component</Import-Package> 
+            <Bundle-Activator>org.apache.cxf.dosgi.samples.ds.consumer.Activator</Bundle-Activator>
+            <Import-Package>*</Import-Package> 
             <Private-Package>org.apache.cxf.dosgi.samples.ds.consumer</Private-Package> 
             <Service-Component>OSGI-INF/component.xml</Service-Component>
           </instructions>

Added: cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/Activator.java?rev=957894&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/Activator.java (added)
+++ cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/Activator.java Fri Jun 25 11:33:00 2010
@@ -0,0 +1,44 @@
+/** 
+  * 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.cxf.dosgi.samples.ds.consumer;
+
+import org.apache.cxf.dosgi.samples.ds.AdderService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * This Activator simply registers a service tracker to indicate its interest in the
+ * AdderService which causes the service to get registered by the Listener Hook.
+ * It is a workaround for the problem that the current ListenerHook is incompatible
+ * with the Equinox DS implementation which doesn't specify a filter when looking up 
+ * a service. See also DOSGI-73.
+ */
+public class Activator implements BundleActivator {    
+    private ServiceTracker tracker;
+
+    public void start(BundleContext context) throws Exception {
+        tracker = new ServiceTracker(context, AdderService.class.getName(), null);
+        tracker.open();
+    }
+
+    public void stop(BundleContext context) throws Exception {
+        tracker.close();
+    }
+}

Modified: cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/AdderConsumer.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/AdderConsumer.java?rev=957894&r1=957893&r2=957894&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/AdderConsumer.java (original)
+++ cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/AdderConsumer.java Fri Jun 25 11:33:00 2010
@@ -19,7 +19,6 @@
 package org.apache.cxf.dosgi.samples.ds.consumer;
 
 import org.apache.cxf.dosgi.samples.ds.AdderService;
-import org.osgi.service.component.ComponentContext;
 
 public class AdderConsumer {
     private AdderService adder;
@@ -32,7 +31,7 @@ public class AdderConsumer {
         adder = null;
     }
     
-    public void start(ComponentContext cc) {
+    public void start() {
         System.out.println("Declarative Service consumer component.");
         System.out.println("Using adder service: 1 + 1 = " + adder.add(1, 1));
     }

Modified: cxf/dosgi/trunk/samples/ds/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/ds/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml?rev=957894&r1=957893&r2=957894&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/ds/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml (original)
+++ cxf/dosgi/trunk/samples/ds/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml Fri Jun 25 11:33:00 2010
@@ -13,11 +13,14 @@
     License for the specific language governing permissions and
     limitations under the License.
   -->
-<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
-  <service-description>
-    <provide interface="org.apache.cxf.dosgi.samples.ds.AdderService" />
-    <property name="service.exported.interfaces">*</property>
-    <property name="service.exported.configs">org.apache.cxf.ws</property>
-    <property name="org.apache.cxf.ws.address">http://localhost:9090/adder</property>
-  </service-description>
-</service-descriptions>
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
+  <endpoint-description>
+    <property name="objectClass">
+      <array>
+        <value>org.apache.cxf.dosgi.samples.ds.AdderService</value>
+      </array>
+    </property>
+    <property name="endpoint.id">http://localhost:9090/adder</property>
+    <property name="service.imported.configs">org.apache.cxf.ws</property>
+  </endpoint-description>
+</endpoint-descriptions>

Modified: cxf/dosgi/trunk/samples/ds/impl/src/main/resources/OSGI-INF/component.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/ds/impl/src/main/resources/OSGI-INF/component.xml?rev=957894&r1=957893&r2=957894&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/ds/impl/src/main/resources/OSGI-INF/component.xml (original)
+++ cxf/dosgi/trunk/samples/ds/impl/src/main/resources/OSGI-INF/component.xml Fri Jun 25 11:33:00 2010
@@ -16,7 +16,7 @@
 <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="DS Service Sample">
   <implementation class="org.apache.cxf.dosgi.samples.ds.impl.AdderServiceImpl"/>
   
-  <property name="service.exported.interfaces">*</property>
+  <property name="service.exported.interfaces" value="*" />
   <property name="service.exported.configs" value="org.apache.cxf.ws" />
   <property name="org.apache.cxf.ws.address" value="http://localhost:9090/adder" />