You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2007/06/28 17:58:24 UTC

svn commit: r551605 - in /activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi: CamelJbiComponent.java CamelSpringDeployer.java

Author: jstrachan
Date: Thu Jun 28 08:58:23 2007
New Revision: 551605

URL: http://svn.apache.org/viewvc?view=rev&rev=551605
Log:
disabled the auto-publishing of camel endpoints which are already JBI endpoints (since they will be auto-activated)

Modified:
    activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
    activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelSpringDeployer.java

Modified: activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java?view=diff&rev=551605&r1=551604&r2=551605
==============================================================================
--- activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java (original)
+++ activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java Thu Jun 28 08:58:23 2007
@@ -199,4 +199,17 @@
         }
         return processor;
     }
+
+    /**
+     * Should we expose the Camel JBI onto the NMR.
+     *
+     * We may wish to add some policy stuff etc.
+     *
+     * @param endpoint the camel endpoint
+     * @return true if the endpoint should be exposed in the NMR
+     */
+    public boolean isEndpointExposedOnNmr(Endpoint endpoint) {
+        // by default lets not expose JBI endpoints since we already auto-expose them
+        return !(endpoint instanceof JbiEndpoint);
+    }
 }

Modified: activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelSpringDeployer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelSpringDeployer.java?view=diff&rev=551605&r1=551604&r2=551605
==============================================================================
--- activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelSpringDeployer.java (original)
+++ activemq/camel/trunk/components/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelSpringDeployer.java Thu Jun 28 08:58:23 2007
@@ -17,17 +17,17 @@
  */
 package org.apache.camel.component.jbi;
 
+import org.apache.camel.Endpoint;
+import org.apache.camel.spring.SpringCamelContext;
 import org.apache.servicemix.common.xbean.AbstractXBeanDeployer;
 import org.apache.xbean.kernel.Kernel;
 import org.apache.xbean.server.spring.loader.PureSpringLoader;
 import org.apache.xbean.server.spring.loader.SpringLoader;
-import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.Endpoint;
 import org.springframework.context.ApplicationContext;
 
-import java.util.List;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 /**
  * A deployer of the spring XML file
@@ -57,10 +57,13 @@
             // now lets iterate through all the endpoints
             Collection<Endpoint> endpoints = camelContext.getSingletonEndpoints();
             for (Endpoint endpoint : endpoints) {
-                services.add(component.createJbiEndpointFromCamel(endpoint));
+                if (component.isEndpointExposedOnNmr(endpoint)) {
+                    services.add(component.createJbiEndpointFromCamel(endpoint));
+                }
             }
             return services;
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             throw new RuntimeException(e);
         }
     }