You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/11/10 15:51:00 UTC
svn commit: r1033501 - in /camel/trunk/components:
camel-core-osgi/src/main/java/org/apache/camel/core/osgi/
camel-spring/src/main/java/org/apache/camel/osgi/
Author: davsclaus
Date: Wed Nov 10 14:51:00 2010
New Revision: 1033501
URL: http://svn.apache.org/viewvc?rev=1033501&view=rev
Log:
CAMEL-3324: OSGi will prepend the bundle id in the JMX name so they are nicely sorted by bundle id in the JMX consoles.
Modified:
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/OsgiSpringCamelContext.java
Modified: camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java?rev=1033501&r1=1033500&r2=1033501&view=diff
==============================================================================
--- camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java (original)
+++ camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java Wed Nov 10 14:51:00 2010
@@ -22,8 +22,9 @@ import org.osgi.framework.BundleContext;
public class OsgiCamelContextNameStrategy extends DefaultCamelContextNameStrategy {
public OsgiCamelContextNameStrategy(BundleContext context) {
- // use bundle id in auto assigned names to make it unique
- super("camel-" + context.getBundle().getBundleId() + "-");
+ // use bundle id in auto assigned names to make it unique and have the bundle id as prefix
+ // which makes the ordering of the camel apps in JMX nicely sorted
+ super(context.getBundle().getBundleId()+ "-camel");
}
}
Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java?rev=1033501&r1=1033500&r2=1033501&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java Wed Nov 10 14:51:00 2010
@@ -48,7 +48,7 @@ public class CamelContextFactoryBean ext
protected SpringCamelContext createContext() {
SpringCamelContext ctx = newCamelContext();
- // we don't the the ImplicitId as it will override the OsgiCamelContextNameStrategy
+ // only set the name if its explicit (Camel will auto assign name if none explicit set)
if (!isImplicitId()) {
ctx.setName(getId());
}
Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/OsgiSpringCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/OsgiSpringCamelContext.java?rev=1033501&r1=1033500&r2=1033501&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/OsgiSpringCamelContext.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/OsgiSpringCamelContext.java Wed Nov 10 14:51:00 2010
@@ -47,8 +47,9 @@ public class OsgiSpringCamelContext exte
@Override
public void setName(String name) {
super.setName(name);
- // in OSGi append the bundle id to the management name so it will be unique in the JVM
- super.setManagementName(name + "-" + bundleContext.getBundle().getBundleId());
+ // in OSGi prefix the bundle id to the management name so it will be unique in the JVM
+ // and also nicely sorted based on bundle id
+ super.setManagementName(bundleContext.getBundle().getBundleId() + "-" + name);
}
}