Hi Claus,

Thanks for committing the fix, I didn't take the consideration for the JMX restriction.
But I don't think you fix resolved all the issue.

What if there are more than two camel contexts in the bundle?
I think we still need to static counter of this situation.

Willem

Claus Ibsen wrote:
Hi Willem

I have commited a little fix to this.
To let it compile :)

Also the osgi name strategy should just use the bundle id (at least
here for starters) and prefix with camel.
So it will be like: camel-147

Naming in JMX has some restrictions, so if we use bundle name etc. we
may have a conflict. So lets start with the bundle id.
Which makes good sense for end users as well.


On Mon, Aug 9, 2010 at 1:59 PM,  <[email protected]> wrote:
Author: ningjiang
Date: Mon Aug  9 11:59:23 2010
New Revision: 983600

URL: http://svn.apache.org/viewvc?rev=983600&view=rev
Log:
CAMEL-3034 Added OsgiCamelContextNameStratgy

Added:
   
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java
   (with props)
Modified:
   
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java

Modified: 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java?rev=983600&r1=983599&r2=983600&view=diff
==============================================================================
--- 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java
 (original)
+++ 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java
 Mon Aug  9 11:59:23 2010
@@ -38,6 +38,8 @@ public final class OsgiCamelContextHelpe
    }

    public static void osgiUpdate(DefaultCamelContext camelContext, 
BundleContext bundleContext) {
+        LOG.debug("Using the OsgiCamelContextNameStrategy");
+        camelContext.setNameStrategy(new 
OsgiCamelContextNameStrategy(bundleContext));
        LOG.debug("Using the OsgiClassResolver");
        camelContext.setClassResolver(new OsgiClassResolver(bundleContext));
        LOG.debug("Using OsgiFactoryFinderResolver");

Added: 
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=983600&view=auto
==============================================================================
--- 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java
 (added)
+++ 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java
 Mon Aug  9 11:59:23 2010
@@ -0,0 +1,29 @@
+/**
+ * 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.camel.core.osgi;
+
+import org.apache.camel.impl.DefaultCamelContextNameStrategy;
+import org.osgi.framework.BundleContext;
+
+public class OsgiCamelContextNameStrategy extends 
DefaultCamelContextNameStrategy {
+
+    public OsgiCamelContextNameStrategy(BundleContext context) {
+        name = "Bundle:" + context.getBundle().getBundleId() + ":" + 
getNextName();
+    }
+
+}

Propchange: 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java
------------------------------------------------------------------------------
   svn:eol-style = native

Propchange: 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextNameStrategy.java
------------------------------------------------------------------------------
   svn:keywords = Rev Date







Reply via email to