camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] git commit: CAMEL-7545: Fixed camel osgi to regsiter all CamelContext from the same bundle in OSGi service registry. This also fixes the camel karaf commands to show em all.
Date Thu, 26 Jun 2014 15:05:03 GMT
CAMEL-7545: Fixed camel osgi to regsiter all CamelContext from the same bundle in OSGi service
registry. This also fixes the camel karaf commands to show em all.


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

Branch: refs/heads/camel-2.12.x
Commit: 741b0cab2f285de01d3979b77882d93ca2df5dfe
Parents: c251465
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Jun 26 17:04:05 2014 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Jun 26 17:04:44 2014 +0200

----------------------------------------------------------------------
 .../org/apache/camel/core/osgi/OsgiCamelContextPublisher.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/741b0cab/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
----------------------------------------------------------------------
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
index 4b0f42d..69c74f9 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
@@ -94,7 +94,10 @@ public class OsgiCamelContextPublisher extends EventNotifierSupport {
 
     public ServiceRegistration registerCamelContext(CamelContext camelContext) throws InvalidSyntaxException
{
         // avoid registering the same service again
-        String symbolicName = bundleContext.getBundle().getSymbolicName();
+        // we must include unique camel management name so the symbolic name becomes unique,
+        // in case the bundle has more than one CamelContext
+        String name = camelContext.getName();
+        String symbolicName = bundleContext.getBundle().getSymbolicName() + "-" + name;
         Version bundleVersion = getBundleVersion(bundleContext.getBundle());
         ServiceReference[] refs = bundleContext.getServiceReferences(CamelContext.class.getName(),
                 "(&(" + CONTEXT_SYMBOLIC_NAME_PROPERTY + "=" + symbolicName + ")(" +
CONTEXT_VERSION_PROPERTY + "=" + bundleVersion + "))");
@@ -103,7 +106,7 @@ public class OsgiCamelContextPublisher extends EventNotifierSupport {
             Dictionary<String, Object > props = new Hashtable<String, Object>();
             props.put(CONTEXT_SYMBOLIC_NAME_PROPERTY, symbolicName);
             props.put(CONTEXT_VERSION_PROPERTY, bundleVersion);
-            props.put(CONTEXT_NAME_PROPERTY, camelContext.getName());
+            props.put(CONTEXT_NAME_PROPERTY, name);
 
             if (log.isDebugEnabled()) {
                 log.debug("Registering CamelContext [{}] of in OSGi registry", camelContext.getName());


Mime
View raw message