Updated Branches:
  refs/heads/master 5e1a3a3ea -> 3553b95ad

search all bundles in the bundleContext for the OSGi version of findComponents()


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3553b95a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3553b95a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3553b95a

Branch: refs/heads/master
Commit: 3553b95ad66ff5240725de6479ff66292605ddcb
Parents: 5e1a3a3
Author: James Strachan <james.strac...@gmail.com>
Authored: Sat Jun 8 08:11:44 2013 +0200
Committer: James Strachan <james.strac...@gmail.com>
Committed: Sat Jun 8 08:11:44 2013 +0200

----------------------------------------------------------------------
 .../camel/core/osgi/OsgiDefaultCamelContext.java   |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3553b95a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
----------------------------------------------------------------------
diff --git 
a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
 
b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
index 9f7b0b2..1a7b472 100644
--- 
a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
+++ 
b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
@@ -21,6 +21,8 @@ import java.net.URL;
 import java.util.Enumeration;
 import java.util.Map;
 import java.util.Properties;
+import java.util.SortedMap;
+import java.util.TreeMap;
 
 import org.apache.camel.TypeConverter;
 import org.apache.camel.core.osgi.utils.BundleContextUtils;
@@ -48,9 +50,14 @@ public class OsgiDefaultCamelContext extends 
DefaultCamelContext {
     }
 
     public Map<String, Properties> findComponents() throws 
LoadPropertiesException, IOException {
-        Bundle bundle = bundleContext.getBundle();
-        Enumeration<URL> iter = 
bundle.getResources(CamelContextHelper.COMPONENT_DESCRIPTOR);
-        return CamelContextHelper.findComponents(this, iter);
+        SortedMap<String, Properties> answer = new TreeMap<String, 
Properties>();
+        Bundle[] bundles = bundleContext.getBundles();
+        for (Bundle bundle : bundles) {
+            Enumeration<URL> iter = 
bundle.getResources(CamelContextHelper.COMPONENT_DESCRIPTOR);
+            SortedMap<String,Properties> map = 
CamelContextHelper.findComponents(this, iter);
+            answer.putAll(map);
+        }
+        return answer;
     }
 
     @Override

Reply via email to