cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r895280 - /cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java
Date Sat, 02 Jan 2010 20:08:32 GMT
Author: davidb
Date: Sat Jan  2 20:08:31 2010
New Revision: 895280

URL: http://svn.apache.org/viewvc?rev=895280&view=rev
Log:
Handle pre-existing bundles.

Modified:
    cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java

Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java?rev=895280&r1=895279&r2=895280&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java
(original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java
Sat Jan  2 20:08:31 2010
@@ -61,7 +61,14 @@
 
             @Override
             public Object addingService(ServiceReference reference) {
-                System.out.println("@@@@ " + reference + "-" + Arrays.asList(reference.getPropertyKeys()));
+                System.out.println("@@@@ " + reference);
+                for (String key : reference.getPropertyKeys()) {
+                    Object val = reference.getProperty(key);
+                    if (val.getClass().isArray()) {
+                        val = Arrays.asList((Object []) val);
+                    }
+                    System.out.println("-----" + key + ":" + val);
+                }
                 Object svc = super.addingService(reference);
                 cacheTracker(reference, svc);
                 return svc;
@@ -70,7 +77,14 @@
             @Override
             public void modifiedService(ServiceReference reference,
                     Object service) {
-                System.out.println("#### " + reference + "-" + Arrays.asList(reference.getPropertyKeys()));
+                System.out.println("#### " + reference);
+                for (String key : reference.getPropertyKeys()) {
+                    Object val = reference.getProperty(key);
+                    if (val.getClass().isArray()) {
+                        val = Arrays.asList((Object []) val);
+                    }
+                    System.out.println("-----" + key + ":" + val);
+                }
 
                 cacheTracker(reference, service);
             }
@@ -86,6 +100,20 @@
         listenerTracker.open();
         
         bundleContext.addBundleListener(this);
+        processExistingBundles();
+    }
+
+    private void processExistingBundles() {
+        Bundle [] bundles = bundleContext.getBundles();
+        if (bundles == null) {
+            return;
+        }
+        
+        for (Bundle b : bundles) {
+            if (b.getState() == Bundle.ACTIVE) {
+                findDeclaredRemoteServices(b);
+            }
+        }
     }
 
     protected void cacheTracker(ServiceReference reference, Object svc) {



Mime
View raw message