camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r552469 [1/3] - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/util/ components/camel-spring/src/main/java/org/apache/camel/component/ components/camel-spring/src/main/java/org/apache/camel/component/bean/ components/ca...
Date Mon, 02 Jul 2007 11:23:16 GMT
Author: jstrachan
Date: Mon Jul  2 04:23:12 2007
New Revision: 552469

URL: http://svn.apache.org/viewvc?view=rev&rev=552469
Log:
added support for CAMEL-60; allowing an "event:default" endpoint to be used to send and consume Spring ApplicationEvents

Added:
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/BeanComponent.java   (contents, props changed)
      - copied, changed from r551858, activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/component/BeanComponent.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/package.html
      - copied, changed from r552418, activemq/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/package.html
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/CamelEvent.java   (with props)
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java   (with props)
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventConsumer.java   (with props)
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java   (with props)
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/package.html   (with props)
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java   (with props)
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/EventRouteTest.java   (with props)
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/
Removed:
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/component/
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/EndpointFactoryBean.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BeanInjector.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringComponentResolver.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/BeanInfo.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/DefaultMethodInvocationStrategy.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParser.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderStatement.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/IllegalActionException.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/MethodInfo.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/ScriptDefinitionParser.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/ContentBasedRouteTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyProcessor.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MySender.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/ISay.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SayService.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java
    activemq/camel/trunk/components/camel-spring/src/test/resources/META-INF/spring/camel-context.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoConsumer.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoSender.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildRouteWithInterceptor.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithChoice.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithHeaderPredicate.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Mon Jul  2 04:23:12 2007
@@ -153,8 +153,12 @@
         return false;
     }
 
-    public static boolean isNotNullOrBlank(String text) {
+    public static boolean isNotNullAndNonEmpty(String text) {
         return text != null && text.trim().length() > 0;
+    }
+
+    public static boolean isNullOrBlank(String text) {
+        return text == null || text.trim().length() <= 0;
     }
 
     /**

Copied: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/BeanComponent.java (from r551858, activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/component/BeanComponent.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/BeanComponent.java?view=diff&rev=552469&p1=activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/component/BeanComponent.java&r1=551858&p2=activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/BeanComponent.java&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/component/BeanComponent.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/BeanComponent.java Mon Jul  2 04:23:12 2007
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spring.component;
+package org.apache.camel.component.bean;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.component.pojo.PojoEndpoint;
@@ -31,7 +31,7 @@
  * An alternative to the <a href="http://activemq.apache.org/pojo.html">POJO Component</a>
  * which implements the <a href="http://activemq.apache.org/bean.html">Bean Component</a>
  * which will look up the URI in the Spring ApplicationContext and use that to handle message dispatching.
- * 
+ *
  * @version $Revision: 1.1 $
  */
 public class BeanComponent extends DefaultComponent implements ApplicationContextAware {
@@ -60,5 +60,4 @@
         }
         return null;
     }
-
 }

Propchange: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/BeanComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/package.html (from r552418, activemq/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/package.html)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/package.html?view=diff&rev=552469&p1=activemq/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/package.html&r1=552418&p2=activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/package.html&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/package.html (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/bean/package.html Mon Jul  2 04:23:12 2007
@@ -19,7 +19,8 @@
 </head>
 <body>
 
-Defines the <a href="http://activemq.apache.org/camel/quartz.html">Quartz Component</a>
+The <a href="http://activemq.apache.org/bean.html">Bean Component</a> which will look up the
+bean name in the Spring ApplicationContext and use that to dispatch messages to a POJO
 
 </body>
 </html>

Added: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/CamelEvent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/CamelEvent.java?view=auto&rev=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/CamelEvent.java (added)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/CamelEvent.java Mon Jul  2 04:23:12 2007
@@ -0,0 +1,49 @@
+/**
+ *
+ * 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.component.event;
+
+import org.apache.camel.Exchange;
+import org.springframework.context.ApplicationEvent;
+
+/**
+ * Represents a Spring {@link ApplicationEvent} which contains a Camel {@link Exchange}
+ *
+ * @version $Revision: 1.1 $
+ */
+public class CamelEvent extends ApplicationEvent {
+    private final Exchange exchange;
+
+    public CamelEvent(EventEndpoint source, Exchange exchange) {
+        super(source);
+        this.exchange = exchange;
+    }
+
+    @Override
+    public EventEndpoint getSource() {
+        return (EventEndpoint) super.getSource();
+    }
+
+    /**
+     * Returns the message exchange
+     *
+     * @return the camel message exchange
+     */
+    public Exchange getExchange() {
+        return exchange;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/CamelEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java?view=auto&rev=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java (added)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java Mon Jul  2 04:23:12 2007
@@ -0,0 +1,68 @@
+/**
+ *
+ * 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.component.event;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultComponent;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ConfigurableApplicationContext;
+
+import java.util.Map;
+
+/**
+ * An <a href="http://activemq.apache.org/camel/event.html">Event Component</a>
+ * for working with Spring ApplicationEvents
+ *
+ * @version $Revision: 1.1 $
+ */
+public class EventComponent extends DefaultComponent<Exchange> implements ApplicationContextAware {
+    private ApplicationContext applicationContext;
+
+    public EventComponent() {
+    }
+
+    public EventComponent(ApplicationContext applicationContext) {
+        setApplicationContext(applicationContext);
+    }
+
+    public ApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        this.applicationContext = applicationContext;
+    }
+
+    public ConfigurableApplicationContext getConfigurableApplicationContext() {
+        ApplicationContext applicationContext = getApplicationContext();
+        if (applicationContext instanceof ConfigurableApplicationContext) {
+            return (ConfigurableApplicationContext) applicationContext;
+        }
+        else {
+            throw new IllegalArgumentException("Not created with a ConfigurableApplicationContext! Was: " + applicationContext);
+        }
+    }
+
+    protected EventEndpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
+        EventEndpoint answer = new EventEndpoint(uri, this);
+        getConfigurableApplicationContext().addApplicationListener(answer);
+        return answer;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventConsumer.java?view=auto&rev=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventConsumer.java (added)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventConsumer.java Mon Jul  2 04:23:12 2007
@@ -0,0 +1,46 @@
+/**
+ *
+ * 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.component.event;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.DefaultConsumer;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class EventConsumer extends DefaultConsumer<Exchange> {
+    private EventEndpoint endpoint;
+
+    public EventConsumer(EventEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        endpoint.consumerStarted(this);
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        endpoint.consumerStopped(this);
+        super.doStop();
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java?view=auto&rev=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java (added)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java Mon Jul  2 04:23:12 2007
@@ -0,0 +1,121 @@
+/**
+ *
+ * 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.component.event;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.DefaultExchange;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.processor.loadbalancer.LoadBalancer;
+import org.apache.camel.processor.loadbalancer.TopicLoadBalancer;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
+
+/**
+ * An <a href="http://activemq.apache.org/camel/event.html">Event Endpoint</a>
+ * for working with Spring ApplicationEvents
+ *
+ * @version $Revision: 1.1 $
+ */
+public class EventEndpoint extends DefaultEndpoint<Exchange> implements ApplicationListener {
+    private final EventComponent component;
+    private LoadBalancer loadBalancer;
+
+    public EventEndpoint(String endpointUri, EventComponent component) {
+        super(endpointUri, component);
+        this.component = component;
+    }
+
+    @Override
+    public EventComponent getComponent() {
+        return component;
+    }
+
+    public ApplicationContext getApplicationContext() {
+        return getComponent().getApplicationContext();
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public Exchange createExchange() {
+        return new DefaultExchange(getContext());
+    }
+
+    public Producer<Exchange> createProducer() throws Exception {
+        return new DefaultProducer<Exchange>(this) {
+            public void process(Exchange exchange) throws Exception {
+                ApplicationEvent event = toApplicationEvent(exchange);
+                getApplicationContext().publishEvent(event);
+            }
+        };
+    }
+
+    public EventConsumer createConsumer(Processor processor) throws Exception {
+        return new EventConsumer(this, processor);
+    }
+
+    public void onApplicationEvent(ApplicationEvent event) {
+        Exchange exchange = createExchange();
+        exchange.getIn().setBody(event);
+        try {
+            getLoadBalancer().process(exchange);
+        }
+        catch (Exception e) {
+            throw new RuntimeCamelException(e);
+        }
+    }
+
+    public LoadBalancer getLoadBalancer() {
+        if (loadBalancer == null) {
+            loadBalancer = createLoadBalancer();
+        }
+        return loadBalancer;
+    }
+
+    public void setLoadBalancer(LoadBalancer loadBalancer) {
+        this.loadBalancer = loadBalancer;
+    }
+
+    // Implementation methods
+    //-------------------------------------------------------------------------
+    public synchronized void consumerStarted(EventConsumer consumer) {
+        getLoadBalancer().addProcessor(consumer.getProcessor());
+    }
+
+    public synchronized void consumerStopped(EventConsumer consumer) {
+        getLoadBalancer().removeProcessor(consumer.getProcessor());
+    }
+
+    protected LoadBalancer createLoadBalancer() {
+        return new TopicLoadBalancer();
+    }
+
+    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
+        ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
+        if (event == null) {
+            event = new CamelEvent(this, exchange);
+        }
+        return event;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/package.html
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/package.html?view=auto&rev=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/package.html (added)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/package.html Mon Jul  2 04:23:12 2007
@@ -0,0 +1,25 @@
+<!--
+    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.
+-->
+<html>
+<head>
+</head>
+<body>
+
+An <a href="http://activemq.apache.org/camel/event.html">Event Endpoint</a> for working with Spring ApplicationEvents
+
+</body>
+</html>

Propchange: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java Mon Jul  2 04:23:12 2007
@@ -18,22 +18,13 @@
 package org.apache.camel.spring;
 
 import org.aopalliance.intercept.MethodInvocation;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Consumer;
-import org.apache.camel.Endpoint;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Exchange;
-import org.apache.camel.MessageDriven;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.CamelTemplate;
+import org.apache.camel.*;
 import org.apache.camel.spring.util.BeanInfo;
 import org.apache.camel.spring.util.DefaultMethodInvocationStrategy;
 import org.apache.camel.spring.util.MethodInvocationStrategy;
 import org.apache.camel.spring.util.ReflectionUtils;
 import org.apache.camel.util.ObjectHelper;
-import static org.apache.camel.util.ObjectHelper.isNotNullOrBlank;
+import static org.apache.camel.util.ObjectHelper.isNotNullAndNonEmpty;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.BeansException;
@@ -44,8 +35,6 @@
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * A post processor to perform injection of {@link Endpoint} and {@link Producer} instances together with binding
@@ -55,11 +44,10 @@
  */
 public class CamelBeanPostProcessor implements BeanPostProcessor, ApplicationContextAware {
     private static final transient Log log = LogFactory.getLog(CamelBeanPostProcessor.class);
-
     private CamelContext camelContext;
     private ApplicationContext applicationContext;
     private MethodInvocationStrategy invocationStrategy = new DefaultMethodInvocationStrategy();
-	//private List<Consumer> consumers = new ArrayList<Consumer>();
+    //private List<Consumer> consumers = new ArrayList<Consumer>();
 
     public CamelBeanPostProcessor() {
     }
@@ -180,7 +168,7 @@
         MessageDriven annotation = method.getAnnotation(MessageDriven.class);
         if (annotation != null) {
             log.info("Creating a consumer for: " + annotation);
-            
+
             // lets bind this method to a listener
             Endpoint endpoint = getEndpointInjection(annotation.uri(), annotation.name());
             if (endpoint != null) {
@@ -207,20 +195,20 @@
 
         return new Processor() {
             @Override
-			public String toString() {
-				return "Processor on " + endpoint;
-			}
-
-			public void process(Exchange exchange) throws Exception {
-				if (log.isDebugEnabled()) {
-					log.debug(">>>> invoking method for: " + exchange);
-				}
+            public String toString() {
+                return "Processor on " + endpoint;
+            }
+
+            public void process(Exchange exchange) throws Exception {
+                if (log.isDebugEnabled()) {
+                    log.debug(">>>> invoking method for: " + exchange);
+                }
                 MethodInvocation invocation = beanInfo.createInvocation(method, pojo, exchange);
-            	if (invocation == null) {
-            		throw new IllegalStateException("No method invocation could be created");
-            	}
+                if (invocation == null) {
+                    throw new IllegalStateException("No method invocation could be created");
+                }
                 try {
-                	invocation.proceed();
+                    invocation.proceed();
                 }
                 catch (Exception e) {
                     throw e;
@@ -263,11 +251,11 @@
 
     protected Endpoint getEndpointInjection(String uri, String name) {
         Endpoint endpoint = null;
-        if (isNotNullOrBlank(uri)) {
+        if (isNotNullAndNonEmpty(uri)) {
             endpoint = camelContext.getEndpoint(uri);
         }
         else {
-            if (isNotNullOrBlank(name)) {
+            if (isNotNullAndNonEmpty(name)) {
                 endpoint = (Endpoint) applicationContext.getBean(name);
                 if (endpoint == null) {
                     throw new NoSuchBeanDefinitionException(name);

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Mon Jul  2 04:23:12 2007
@@ -17,13 +17,14 @@
  */
 package org.apache.camel.spring;
 
-import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -35,8 +36,8 @@
  *
  * @version $Revision$
  */
-public class CamelContextFactoryBean implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware {
-    private CamelContext context;
+public class CamelContextFactoryBean implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener {
+    private SpringCamelContext context;
     private RouteBuilder routeBuilder;
     private List<RouteBuilder> additionalBuilders = new ArrayList<RouteBuilder>();
     private String[] packages = {};
@@ -70,16 +71,23 @@
         getContext().stop();
     }
 
+    public void onApplicationEvent(ApplicationEvent event) {
+        if (context != null) {
+            context.onApplicationEvent(event);
+        }
+    }
+
     // Properties
     //-------------------------------------------------------------------------
-    public CamelContext getContext() throws Exception {
+    public SpringCamelContext getContext() throws Exception {
         if (context == null) {
             context = new SpringCamelContext(getApplicationContext());
+            context.afterPropertiesSet();
         }
         return context;
     }
 
-    public void setContext(CamelContext context) {
+    public void setContext(SpringCamelContext context) {
         this.context = context;
     }
 

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/EndpointFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/EndpointFactoryBean.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/EndpointFactoryBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/EndpointFactoryBean.java Mon Jul  2 04:23:12 2007
@@ -91,5 +91,4 @@
         notNull(uri, "uri");
         return context.getEndpoint(uri);
     }
-
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java Mon Jul  2 04:23:12 2007
@@ -38,7 +38,6 @@
 public class Main extends ServiceSupport {
     private static final Log log = LogFactory.getLog(Main.class);
     private String applicationContextUri = "META-INF/spring/*.xml";
-
     private AbstractApplicationContext applicationContext;
     private List<Option> options = new ArrayList<Option>();
     private CountDownLatch latch = new CountDownLatch(1);
@@ -258,5 +257,4 @@
         }
         return "";
     }
-
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java Mon Jul  2 04:23:12 2007
@@ -17,20 +17,27 @@
  */
 package org.apache.camel.spring;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.bean.BeanComponent;
+import org.apache.camel.component.event.EventComponent;
+import org.apache.camel.component.event.EventEndpoint;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.spi.Injector;
 import org.apache.camel.spi.ComponentResolver;
-import org.apache.camel.CamelContext;
+import org.apache.camel.spi.Injector;
 import org.apache.camel.spring.spi.SpringComponentResolver;
 import org.apache.camel.spring.spi.SpringInjector;
-import org.apache.camel.spring.component.BeanComponent;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.DisposableBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContextAware;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.InitializingBean;
 import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.support.AbstractRefreshableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**
  * A Spring aware implementation of {@link CamelContext} which will automatically register itself with Springs lifecycle
@@ -40,8 +47,10 @@
  *
  * @version $Revision$
  */
-public class SpringCamelContext extends DefaultCamelContext implements InitializingBean, DisposableBean, ApplicationContextAware {
+public class SpringCamelContext extends DefaultCamelContext implements InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener {
+    private static final transient Log log = LogFactory.getLog(SpringCamelContext.class);
     private ApplicationContext applicationContext;
+    private EventEndpoint eventEndpoint;
 
     public SpringCamelContext() {
     }
@@ -67,6 +76,9 @@
     }
 
     public void afterPropertiesSet() throws Exception {
+        if (eventEndpoint == null) {
+            eventEndpoint = createEventEndpoint();
+        }
         // lets force lazy initialisation
         getInjector();
 
@@ -77,6 +89,15 @@
         stop();
     }
 
+    public void onApplicationEvent(ApplicationEvent event) {
+        if (eventEndpoint != null) {
+            eventEndpoint.onApplicationEvent(event);
+        }
+        else {
+            log.warn("No eventEndpoint enabled for event: " + event);
+        }
+    }
+
     public ApplicationContext getApplicationContext() {
         return applicationContext;
     }
@@ -84,6 +105,18 @@
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         this.applicationContext = applicationContext;
         addComponent("bean", new BeanComponent(applicationContext));
+
+        if (applicationContext instanceof ConfigurableApplicationContext) {
+            addComponent("event", new EventComponent(applicationContext));
+        }
+    }
+
+    public EventEndpoint getEventEndpoint() {
+        return eventEndpoint;
+    }
+
+    public void setEventEndpoint(EventEndpoint eventEndpoint) {
+        this.eventEndpoint = eventEndpoint;
     }
 
     @Override
@@ -95,5 +128,10 @@
     protected ComponentResolver createComponentResolver() {
         ComponentResolver defaultResolver = super.createComponentResolver();
         return new SpringComponentResolver(getApplicationContext(), defaultResolver);
+    }
+
+    protected EventEndpoint createEventEndpoint() {
+        EventEndpoint endpoint = getEndpoint("event:default", EventEndpoint.class);
+        return endpoint;
     }
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java Mon Jul  2 04:23:12 2007
@@ -18,7 +18,6 @@
 package org.apache.camel.spring;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.springframework.context.ApplicationContext;
 
@@ -69,7 +68,7 @@
     /**
      * Returns the application context which has been configured via the {@link #setApplicationContext(ApplicationContext)}
      * method  or from the underlying {@link SpringCamelContext}
-     * 
+     *
      * @return
      */
     public ApplicationContext getApplicationContext() {

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java Mon Jul  2 04:23:12 2007
@@ -25,62 +25,61 @@
 
 /**
  * Creates a Proxy to Camel Pojo Endpoint.
- *  
+ *
  * @author chirino
  */
 public class CamelProxyFactoryBean extends UrlBasedRemoteAccessor implements FactoryBean {
-
-	private CamelContext camelContext;
-	private Endpoint endpoint;
-	private Object serviceProxy;
-	
-	@Override
-	public void afterPropertiesSet() {
-		super.afterPropertiesSet();
-		try {
-			if( endpoint == null ) {
-				if( getServiceUrl() == null || camelContext==null ) {
-					throw new IllegalArgumentException("If endpoint is not specified, the serviceUrl and camelContext must be specified.");
-				}
-				
-				endpoint = camelContext.getEndpoint(getServiceUrl());
-				if( endpoint == null ) {
-					throw new IllegalArgumentException("Could not resolve endpoint: "+getServiceUrl());
-				}
-			}
-			
-			this.serviceProxy = PojoComponent.createProxy(endpoint, getServiceInterface());
-		} catch (Exception e) {
-			throw new IllegalArgumentException(e);
-		}
-	}
-	
-	public Object getObject() throws Exception {
-		return serviceProxy;
-	}
-
-	public Class getObjectType() {
-		return getServiceInterface();
-	}
-
-	public boolean isSingleton() {
-		return true;
-	}
-
-	public Endpoint getEndpoint() {
-		return endpoint;
-	}
-
-	public void setEndpoint(Endpoint endpoint) {
-		this.endpoint = endpoint;
-	}
-
-	public CamelContext getCamelContext() {
-		return camelContext;
-	}
-
-	public void setCamelContext(CamelContext camelContext) {
-		this.camelContext = camelContext;
-	}
-	
+    private CamelContext camelContext;
+    private Endpoint endpoint;
+    private Object serviceProxy;
+
+    @Override
+    public void afterPropertiesSet() {
+        super.afterPropertiesSet();
+        try {
+            if (endpoint == null) {
+                if (getServiceUrl() == null || camelContext == null) {
+                    throw new IllegalArgumentException("If endpoint is not specified, the serviceUrl and camelContext must be specified.");
+                }
+
+                endpoint = camelContext.getEndpoint(getServiceUrl());
+                if (endpoint == null) {
+                    throw new IllegalArgumentException("Could not resolve endpoint: " + getServiceUrl());
+                }
+            }
+
+            this.serviceProxy = PojoComponent.createProxy(endpoint, getServiceInterface());
+        }
+        catch (Exception e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    public Object getObject() throws Exception {
+        return serviceProxy;
+    }
+
+    public Class getObjectType() {
+        return getServiceInterface();
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public Endpoint getEndpoint() {
+        return endpoint;
+    }
+
+    public void setEndpoint(Endpoint endpoint) {
+        this.endpoint = endpoint;
+    }
+
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java Mon Jul  2 04:23:12 2007
@@ -25,57 +25,57 @@
 
 /**
  * Exports a Spring defined service to Camel as a Pojo endpoint.
- *  
+ *
  * @author chirino
  */
 public class CamelServiceExporter extends RemoteExporter implements InitializingBean, DisposableBean {
-
-	CamelContext camelContext;
-	PojoComponent pojoComponent;
-	String serviceName;
-	
-	public void afterPropertiesSet() throws Exception {
-		if( serviceName == null ) {
-			throw new IllegalArgumentException("The serviceName must be configured.");
-		}
-		if( pojoComponent == null ) {
-			if( camelContext == null ) {
-				throw new IllegalArgumentException("A pojoComponent or camelContext must be configured.");
-			}
-			pojoComponent = (PojoComponent) camelContext.getComponent("pojo");
-			if( pojoComponent == null ) {
-				throw new IllegalArgumentException("The pojoComponent could not be found.");
-			}
-		}
-		pojoComponent.addService(serviceName, getProxyForService());
-	}
-
-	public void destroy() throws Exception {
-		if( serviceName!=null ) {
-			pojoComponent.removeService(serviceName);
-		}
-	}
-
-	
-	public PojoComponent getPojoComponent() {
-		return pojoComponent;
-	}
-	public void setPojoComponent(PojoComponent pojoComponent) {
-		this.pojoComponent = pojoComponent;
-	}
-
-	public CamelContext getCamelContext() {
-		return camelContext;
-	}
-	public void setCamelContext(CamelContext camelContext) {
-		this.camelContext = camelContext;
-	}
-
-	public String getServiceName() {
-		return serviceName;
-	}
-	public void setServiceName(String serviceName) {
-		this.serviceName = serviceName;
-	}
-
+    CamelContext camelContext;
+    PojoComponent pojoComponent;
+    String serviceName;
+
+    public void afterPropertiesSet() throws Exception {
+        if (serviceName == null) {
+            throw new IllegalArgumentException("The serviceName must be configured.");
+        }
+        if (pojoComponent == null) {
+            if (camelContext == null) {
+                throw new IllegalArgumentException("A pojoComponent or camelContext must be configured.");
+            }
+            pojoComponent = (PojoComponent) camelContext.getComponent("pojo");
+            if (pojoComponent == null) {
+                throw new IllegalArgumentException("The pojoComponent could not be found.");
+            }
+        }
+        pojoComponent.addService(serviceName, getProxyForService());
+    }
+
+    public void destroy() throws Exception {
+        if (serviceName != null) {
+            pojoComponent.removeService(serviceName);
+        }
+    }
+
+    public PojoComponent getPojoComponent() {
+        return pojoComponent;
+    }
+
+    public void setPojoComponent(PojoComponent pojoComponent) {
+        this.pojoComponent = pojoComponent;
+    }
+
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BeanInjector.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BeanInjector.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BeanInjector.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BeanInjector.java Mon Jul  2 04:23:12 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.spring.spi;
 
-import org.springframework.context.ApplicationContext;
 import org.springframework.beans.factory.wiring.BeanConfigurerSupport;
+import org.springframework.context.ApplicationContext;
 
 /**
  * @version $Revision: 1.1 $

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringComponentResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringComponentResolver.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringComponentResolver.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringComponentResolver.java Mon Jul  2 04:23:12 2007
@@ -17,11 +17,10 @@
  */
 package org.apache.camel.spring.spi;
 
-import static org.apache.camel.util.ObjectHelper.notNull;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.spi.ComponentResolver;
+import static org.apache.camel.util.ObjectHelper.notNull;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 import org.springframework.context.ApplicationContext;
 

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java Mon Jul  2 04:23:12 2007
@@ -17,12 +17,12 @@
  */
 package org.apache.camel.spring.spi;
 
-import org.apache.camel.spi.Injector;
 import org.apache.camel.impl.ReflectionInjector;
+import org.apache.camel.spi.Injector;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.springframework.context.support.AbstractRefreshableApplicationContext;
 import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+import org.springframework.context.support.AbstractRefreshableApplicationContext;
 
 /**
  * A Spring implementation of {@link Injector} allowing Spring to be used to dependency inject newly created POJOs
@@ -31,7 +31,6 @@
  */
 public class SpringInjector extends ReflectionInjector {
     private static final transient Log log = LogFactory.getLog(SpringInjector.class);
-
     private final AbstractRefreshableApplicationContext applicationContext;
     private int autowireMode = AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR;
     private boolean dependencyCheck = false;

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java Mon Jul  2 04:23:12 2007
@@ -17,9 +17,9 @@
  */
 package org.apache.camel.spring.spi;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.Exchange;
 import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.spi.Policy;
 import org.apache.commons.logging.Log;
@@ -36,7 +36,6 @@
  */
 public class SpringTransactionPolicy<E> implements Policy<E> {
     private static final transient Log log = LogFactory.getLog(SpringTransactionPolicy.class);
-
     private TransactionTemplate template;
 
     public SpringTransactionPolicy() {
@@ -54,43 +53,43 @@
         }
 
         return new DelegateProcessor(processor) {
-
             public void process(final Exchange exchange) {
                 transactionTemplate.execute(new TransactionCallbackWithoutResult() {
                     protected void doInTransactionWithoutResult(TransactionStatus status) {
                         try {
-							processNext(exchange);
-						} catch (Exception e) {
-							throw new RuntimeCamelException(e);
-						}
+                            processNext(exchange);
+                        }
+                        catch (Exception e) {
+                            throw new RuntimeCamelException(e);
+                        }
                     }
                 });
             }
 
             @Override
             public String toString() {
-                return "SpringTransactionPolicy:"+propagationBehaviorToString(transactionTemplate.getPropagationBehavior())+"[" + getNext() + "]";
+                return "SpringTransactionPolicy:" + propagationBehaviorToString(transactionTemplate.getPropagationBehavior()) + "[" + getNext() + "]";
             }
 
-			private String propagationBehaviorToString(int propagationBehavior) {
-				switch( propagationBehavior ) {
-				case TransactionDefinition.PROPAGATION_MANDATORY:
-					return "PROPAGATION_MANDATORY";
-				case TransactionDefinition.PROPAGATION_NESTED:
-					return "PROPAGATION_NESTED";
-				case TransactionDefinition.PROPAGATION_NEVER:
-					return "PROPAGATION_NEVER";
-				case TransactionDefinition.PROPAGATION_NOT_SUPPORTED:
-					return "PROPAGATION_NOT_SUPPORTED";
-				case TransactionDefinition.PROPAGATION_REQUIRED:
-					return "PROPAGATION_REQUIRED";
-				case TransactionDefinition.PROPAGATION_REQUIRES_NEW:
-					return "PROPAGATION_REQUIRES_NEW";
-				case TransactionDefinition.PROPAGATION_SUPPORTS:
-					return "PROPAGATION_SUPPORTS";
-				}
-				return "UNKOWN";
-			}
+            private String propagationBehaviorToString(int propagationBehavior) {
+                switch (propagationBehavior) {
+                    case TransactionDefinition.PROPAGATION_MANDATORY:
+                        return "PROPAGATION_MANDATORY";
+                    case TransactionDefinition.PROPAGATION_NESTED:
+                        return "PROPAGATION_NESTED";
+                    case TransactionDefinition.PROPAGATION_NEVER:
+                        return "PROPAGATION_NEVER";
+                    case TransactionDefinition.PROPAGATION_NOT_SUPPORTED:
+                        return "PROPAGATION_NOT_SUPPORTED";
+                    case TransactionDefinition.PROPAGATION_REQUIRED:
+                        return "PROPAGATION_REQUIRED";
+                    case TransactionDefinition.PROPAGATION_REQUIRES_NEW:
+                        return "PROPAGATION_REQUIRES_NEW";
+                    case TransactionDefinition.PROPAGATION_SUPPORTS:
+                        return "PROPAGATION_SUPPORTS";
+                }
+                return "UNKOWN";
+            }
         };
     }
 

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/BeanInfo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/BeanInfo.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/BeanInfo.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/BeanInfo.java Mon Jul  2 04:23:12 2007
@@ -42,7 +42,6 @@
  */
 public class BeanInfo {
     private static final transient Log log = LogFactory.getLog(BeanInfo.class);
-
     private Class type;
     private MethodInvocationStrategy strategy;
     private Map<String, MethodInfo> operations = new ConcurrentHashMap<String, MethodInfo>();
@@ -114,11 +113,11 @@
                             + method.toString() + " parameter: " + i + " so ignoring method");
                 }
                 if (parameterTypes.length == 1) {
-                	// lets assume its the body
-                	expression = ExpressionBuilder.bodyExpression(parameterType);
+                    // lets assume its the body
+                    expression = ExpressionBuilder.bodyExpression(parameterType);
                 }
                 else {
-                	return null;
+                    return null;
                 }
             }
             parameterExpressions[i] = expression;

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/DefaultMethodInvocationStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/DefaultMethodInvocationStrategy.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/DefaultMethodInvocationStrategy.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/util/DefaultMethodInvocationStrategy.java Mon Jul  2 04:23:12 2007
@@ -16,24 +16,20 @@
  */
 package org.apache.camel.spring.util;
 
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.aopalliance.intercept.MethodInvocation;
-import org.apache.camel.Expression;
 import org.apache.camel.Exchange;
-import org.apache.camel.Endpoint;
-import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.Expression;
 import org.apache.camel.Message;
 import org.apache.camel.builder.ExpressionBuilder;
 
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
 /**
  * Represents the strategy used to figure out how to map a message exchange to a POJO method invocation
  *
  * @version $Revision:$
  */
 public class DefaultMethodInvocationStrategy implements MethodInvocationStrategy {
-
     private Map<Class, Expression> parameterTypeToExpressionMap = new ConcurrentHashMap<Class, Expression>();
 
     public DefaultMethodInvocationStrategy() {
@@ -50,7 +46,6 @@
         parameterTypeToExpressionMap.put(parameterType, expression);
     }
 
-
     /**
      * Creates an invocation on the given POJO using annotations to decide which method to invoke
      * and to figure out which parameters to use
@@ -63,12 +58,8 @@
         return beanInfo.createInvocation(pojo, messageExchange);
     }
 */
-
-
     public void loadDefaultRegistry() {
         addParameterMapping(Exchange.class, ExpressionBuilder.exchangeExpression());
         addParameterMapping(Message.class, ExpressionBuilder.inMessageExpression());
     }
-
-
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParser.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParser.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BeanDefinitionParser.java Mon Jul  2 04:23:12 2007
@@ -50,6 +50,4 @@
     protected boolean isEligibleAttribute(String attributeName) {
         return attributeName != null && super.isEligibleAttribute(attributeName) && !attributeName.equals("xmlns");
     }
-
-    
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderStatement.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderStatement.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderStatement.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderStatement.java Mon Jul  2 04:23:12 2007
@@ -17,41 +17,41 @@
  */
 package org.apache.camel.spring.xml;
 
-import java.util.ArrayList;
-
 import org.springframework.beans.factory.BeanFactory;
 
-public class BuilderStatement {
-	private ArrayList<BuilderAction> actions;
-	private Class returnType;
+import java.util.ArrayList;
 
-	public Object create(BeanFactory beanFactory, Object rootBuilder) {
-		Object currentBuilder = rootBuilder;
-		BuilderAction lastAction=null;
-		for (BuilderAction action : actions) {
-			// The last action may have left us without a builder to invoke next!
-			if( currentBuilder == null ) {
-				throw new IllegalArgumentException("Invalid configuration.  The '"+lastAction.getName()+"' action cannot be followed by the '"+action.getName()+"' action.");
-			}
-			currentBuilder = action.invoke(beanFactory, rootBuilder, currentBuilder);
-			lastAction = action;
-		}
-		return currentBuilder;
-	}
-
-	public ArrayList<BuilderAction> getActions() {
-		return actions;
-	}
-	public void setActions(ArrayList<BuilderAction> actions) {
-		this.actions = actions;
-	}
-
-	public Class getReturnType() {
-		return returnType;
-	}
-	public void setReturnType(Class returnType) {
-		this.returnType = returnType;
-		
-	}
+public class BuilderStatement {
+    private ArrayList<BuilderAction> actions;
+    private Class returnType;
 
+    public Object create(BeanFactory beanFactory, Object rootBuilder) {
+        Object currentBuilder = rootBuilder;
+        BuilderAction lastAction = null;
+        for (BuilderAction action : actions) {
+            // The last action may have left us without a builder to invoke next!
+            if (currentBuilder == null) {
+                throw new IllegalArgumentException("Invalid configuration.  The '" + lastAction.getName() + "' action cannot be followed by the '" + action.getName() + "' action.");
+            }
+            currentBuilder = action.invoke(beanFactory, rootBuilder, currentBuilder);
+            lastAction = action;
+        }
+        return currentBuilder;
+    }
+
+    public ArrayList<BuilderAction> getActions() {
+        return actions;
+    }
+
+    public void setActions(ArrayList<BuilderAction> actions) {
+        this.actions = actions;
+    }
+
+    public Class getReturnType() {
+        return returnType;
+    }
+
+    public void setReturnType(Class returnType) {
+        this.returnType = returnType;
+    }
 }



Mime
View raw message