You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/04/14 18:16:23 UTC
svn commit: r647877 - in /activemq/camel/trunk/components: ./
camel-spring-integration/ camel-spring-integration/src/
camel-spring-integration/src/main/ camel-spring-integration/src/main/java/
camel-spring-integration/src/main/java/org/ camel-spring-in...
Author: ningjiang
Date: Mon Apr 14 09:16:05 2008
New Revision: 647877
URL: http://svn.apache.org/viewvc?rev=647877&view=rev
Log:
CAMEL-465 added camel-spring-integration component
Added:
activemq/camel/trunk/components/camel-spring-integration/ (with props)
activemq/camel/trunk/components/camel-spring-integration/pom.xml (with props)
activemq/camel/trunk/components/camel-spring-integration/src/
activemq/camel/trunk/components/camel-spring-integration/src/main/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationHelper.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/component/
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/component/si
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/log4j.properties (with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/
activemq/camel/trunk/components/camel-spring-integration/src/test/java/
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/MyProcessor.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationOneWayConsumerTest.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationProducerTest.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationTwoWayConsumerTest.java (with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/oneWayConsumer.xml (with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/producer.xml (with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/twoWayConsumer.xml (with props)
Modified:
activemq/camel/trunk/components/pom.xml
Propchange: activemq/camel/trunk/components/camel-spring-integration/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Apr 14 09:16:05 2008
@@ -0,0 +1,7 @@
+.project
+.pmd
+.checkstyle
+.classpath
+target
+.settings
+eclipse-classes
Added: activemq/camel/trunk/components/camel-spring-integration/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/pom.xml?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/pom.xml (added)
+++ activemq/camel/trunk/components/camel-spring-integration/pom.xml Mon Apr 14 09:16:05 2008
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <parent>
+ <artifactId>components</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-integration</artifactId>
+ <name>The Camel Spring integration component</name>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <camel.osgi.export.pkg>org.apache.camel.component.spring.integration.*</camel.osgi.export.pkg>
+ <spring-integration-version>1.0.0.m2</spring-integration-version>
+ </properties>
+
+ <version>1.4-SNAPSHOT</version>
+
+ <repositories>
+ <repository>
+ <id>spring.maven.milestone</id>
+ <name>Spring Maven Repo</name>
+ <url>http://s3.amazonaws.com/maven.springframework.org/milestone</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.integration</groupId>
+ <artifactId>spring-integration-core</artifactId>
+ <version>${spring-integration-version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Propchange: activemq/camel/trunk/components/camel-spring-integration/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-spring-integration/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,52 @@
+/**
+ * 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.spring.integration;
+
+import org.apache.camel.Exchange;
+import org.springframework.integration.message.GenericMessage;
+
+
+/**
+ * The helper class for Mapping between the Spring Integration message and
+ * the Camel Message
+ *
+ */
+public final class SpringIntegrationBinding {
+
+ private SpringIntegrationBinding() {
+ // Helper class
+ }
+
+ @SuppressWarnings("unchecked")
+ public static org.springframework.integration.message.Message createSpringIntegrationMessage(Exchange exchange) {
+ org.apache.camel.Message message = exchange.getIn();
+ GenericMessage siMessage = new GenericMessage(message.getBody());
+ return siMessage;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static org.springframework.integration.message.Message storeToSpringIntegrationMessage(org.apache.camel.Message message) {
+ GenericMessage siMessage = new GenericMessage(message.getBody());
+ return siMessage;
+ }
+
+ public static void storeToCamelMessage(org.springframework.integration.message.Message siMessage, org.apache.camel.Message cMessage) {
+ cMessage.setBody(siMessage.getPayload());
+ //TODO copy the message header
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,36 @@
+/**
+ * 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.spring.integration;
+
+import java.util.Map;
+
+import org.apache.camel.impl.DefaultComponent;
+
+/**
+ * Represents the component that manages {@link SpringIntegrationEndpoint}. It holds the
+ * list of named direct endpoints.
+ *
+ * @version
+ */
+public class SpringIntegrationComponent extends DefaultComponent<SpringIntegrationExchange> {
+
+ protected SpringIntegrationEndpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
+ SpringIntegrationEndpoint endpoint = new SpringIntegrationEndpoint(uri, remaining, this);
+ setProperties(endpoint, parameters);
+ return endpoint;
+ }
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,110 @@
+/**
+ * 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.spring.integration;
+
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.ObjectHelper;
+import org.springframework.integration.channel.ChannelRegistry;
+import org.springframework.integration.channel.MessageChannel;
+import org.springframework.integration.config.MessageBusParser;
+import org.springframework.integration.message.GenericMessage;
+
+/**
+ * A consumer of exchanges for the Spring Integration
+ * Please specify the inputChannel in the endpoint url for this consumer.
+ * If the message pattern is inOut, the outputChannel property
+ * should be set for the outgoing message.
+ * @version
+ */
+public class SpringIntegrationConsumer extends ScheduledPollConsumer<SpringIntegrationExchange> {
+ private SpringCamelContext context;
+ private MessageChannel inputChannel;
+ private MessageChannel outputChannel;
+ private String inputChannelName;
+ private ChannelRegistry channelRegistry;
+ private SpringIntegrationEndpoint endpoint;
+
+ public SpringIntegrationConsumer(SpringIntegrationEndpoint endpoint, Processor processor) {
+ super(endpoint, processor);
+ this.endpoint = endpoint;
+ context = (SpringCamelContext) endpoint.getContext();
+ channelRegistry = (ChannelRegistry) context.getApplicationContext().getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME);
+
+ inputChannelName = endpoint.getDefaultChannel();
+ if (ObjectHelper.isNullOrBlank(inputChannelName)) {
+ inputChannelName = endpoint.getInputChannel();
+ }
+ if (!ObjectHelper.isNullOrBlank(inputChannelName)) {
+ inputChannel = (MessageChannel) channelRegistry.lookupChannel(inputChannelName);
+ ObjectHelper.notNull(inputChannel, "The inputChannel with the name [" + inputChannelName + "]");
+ } else {
+ throw new RuntimeCamelException("Can't find the right inputChannelName");
+ }
+ if (endpoint.isInOut()) {
+ endpoint.setExchangePattern(ExchangePattern.InOut);
+ }
+
+ }
+
+ @Override
+ protected void poll() throws Exception {
+ org.springframework.integration.message.Message siInMessage = inputChannel.receive(this.getDelay());
+ SpringIntegrationExchange exchange = getEndpoint().createExchange();
+ exchange.setIn(new SpringIntegrationMessage(siInMessage));
+ getProcessor().process(exchange);
+ if (endpoint.isInOut()) {
+ // get the output channel from message header
+ Object returnAddress = siInMessage.getHeader().getReturnAddress();
+ MessageChannel reply = null;
+
+ if (returnAddress != null) {
+ if (returnAddress instanceof String) {
+ reply = (MessageChannel)context.getApplicationContext().getBean((String)returnAddress);
+ } else if (returnAddress instanceof MessageChannel) {
+ reply = (MessageChannel) returnAddress;
+ }
+ } else {
+ if (outputChannel != null) {
+ // using the outputChannel
+ reply = outputChannel;
+ } else {
+ if (ObjectHelper.isNullOrBlank(endpoint.getOutputChannel())) {
+ outputChannel = (MessageChannel) channelRegistry.lookupChannel(endpoint.getOutputChannel());
+ ObjectHelper.notNull(inputChannel, "The outputChannel with the name [" + endpoint.getOutputChannel() + "]");
+ reply = outputChannel;
+ } else {
+ throw new RuntimeCamelException("Can't find the right outputChannelName");
+ }
+ }
+ }
+ // put the message back the outputChannel if we need
+ org.springframework.integration.message.Message siOutMessage =
+ SpringIntegrationBinding.storeToSpringIntegrationMessage(exchange.getOut());
+ reply.send(siOutMessage);
+ }
+
+
+ }
+
+ //TODO We need to clean the channel when shutdown the endpoint
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,98 @@
+/**
+ * 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.spring.integration;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultConsumer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.DefaultExchange;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Defines the <a href="http://activemq.apache.org/camel/springIntergration.html">Spring Intergration Endpoint</a>
+ *
+ * @version
+ */
+public class SpringIntegrationEndpoint extends DefaultEndpoint<SpringIntegrationExchange> {
+ private static final Log LOG = LogFactory.getLog(SpringIntegrationEndpoint.class);
+ private String inputChannel;
+ private String outputChannel;
+ private String defaultChannel;
+ private boolean inOut;
+
+ public SpringIntegrationEndpoint(String uri, String channel, SpringIntegrationComponent component) {
+ super(uri, component);
+ defaultChannel = channel;
+ }
+
+ public Producer<SpringIntegrationExchange> createProducer() throws Exception {
+ return new SpringIntegrationProducer(this);
+ }
+
+ public Consumer<SpringIntegrationExchange> createConsumer(Processor processor) throws Exception {
+ return new SpringIntegrationConsumer(this, processor);
+ }
+
+ public SpringIntegrationExchange createExchange() {
+ return createExchange(getExchangePattern());
+ }
+
+ public SpringIntegrationExchange createExchange(ExchangePattern pattern) {
+ return new SpringIntegrationExchange(getContext(), pattern);
+ }
+
+ public void setInputChannel(String input) {
+ inputChannel = input;
+ }
+
+ public String getInputChannel() {
+ return inputChannel;
+ }
+
+ public void setOutputChannel(String output) {
+ outputChannel = output;
+ }
+
+ public String getOutputChannel() {
+ return outputChannel;
+ }
+
+ public String getDefaultChannel() {
+ return defaultChannel;
+ }
+
+ public boolean isSingleton() {
+ return false;
+ }
+
+ public void setInOut(boolean inOut) {
+ this.inOut = inOut;
+ }
+
+ public boolean isInOut() {
+ return this.inOut;
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,82 @@
+/**
+ * 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.spring.integration;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultExchange;
+
+/**
+ * An {@link Exchange} for working with Spring Integration endpoints which exposes the underlying
+ * Spring messages via {@link #getInMessage()} and {@link #getOutMessage()}
+ *
+ * @version
+ */
+public class SpringIntegrationExchange extends DefaultExchange {
+
+ public SpringIntegrationExchange(CamelContext context) {
+ super(context);
+ }
+
+ public SpringIntegrationExchange(CamelContext context, ExchangePattern pattern) {
+ super(context, pattern);
+ }
+
+ @Override
+ public Exchange newInstance() {
+ return new SpringIntegrationExchange(this.getContext());
+ }
+
+ @Override
+ public SpringIntegrationMessage getIn() {
+ return (SpringIntegrationMessage) super.getIn();
+ }
+
+ @Override
+ public SpringIntegrationMessage getOut() {
+ return (SpringIntegrationMessage) super.getOut();
+ }
+
+ @Override
+ public SpringIntegrationMessage getOut(boolean lazyCreate) {
+ return (SpringIntegrationMessage) super.getOut(lazyCreate);
+ }
+
+ @Override
+ public SpringIntegrationMessage getFault() {
+ return (SpringIntegrationMessage) super.getFault();
+ }
+
+ @Override
+ protected Message createFaultMessage() {
+ return new SpringIntegrationMessage();
+ }
+
+ @Override
+ protected Message createInMessage() {
+ return new SpringIntegrationMessage();
+ }
+
+ @Override
+ protected Message createOutMessage() {
+ return new SpringIntegrationMessage();
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationHelper.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationHelper.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationHelper.java Mon Apr 14 09:16:05 2008
@@ -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.component.spring.integration;
+
+public final class SpringIntegrationHelper {
+ private SpringIntegrationHelper() {
+ // Helper class
+ }
+
+ public static void checkSpringBeanInstance(Object bean, String name) {
+ if (bean == null) {
+ throw new IllegalArgumentException("Can't find the bean: " + name + " from the Spring context");
+ }
+ }
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationHelper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,117 @@
+/**
+ * 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.spring.integration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.impl.DefaultMessage;
+import org.springframework.integration.message.MessageHeader;
+
+/**
+ * The Message {@link DefaultMessage} implementation
+ * for accessing the SpringIntegrationMessage
+ *
+ * @version
+ */
+public class SpringIntegrationMessage extends DefaultMessage {
+ private org.springframework.integration.message.Message siMessage;
+
+ public SpringIntegrationMessage(org.springframework.integration.message.Message message) {
+ siMessage = message;
+ }
+
+ public SpringIntegrationMessage() {
+
+ }
+
+ public void setMessage(org.springframework.integration.message.Message message) {
+ siMessage = message;
+ }
+
+ public org.springframework.integration.message.Message getMessage() {
+ return siMessage;
+ }
+
+ @Override
+ public void copyFrom(org.apache.camel.Message that) {
+ setMessageId(that.getMessageId());
+ setBody(that.getBody());
+ getHeaders().putAll(that.getHeaders());
+ if (that instanceof SpringIntegrationMessage) {
+ SpringIntegrationMessage orig = (SpringIntegrationMessage) that;
+ setMessage(orig.getMessage());
+ }
+ }
+
+ @Override
+ public String toString() {
+ if (siMessage != null) {
+ return "SpringIntegrationMessage: " + siMessage;
+ } else {
+ return "SpringIntegrationMessage: " + getBody();
+ }
+ }
+
+ @Override
+ public SpringIntegrationExchange getExchange() {
+ return (SpringIntegrationExchange)super.getExchange();
+ }
+
+
+ public Object getHeader(String name) {
+ if (siMessage != null) {
+ return siMessage.getHeader().getAttribute(name);
+ } else {
+ return super.getHeader(name);
+ }
+ }
+
+ @Override
+ public void setHeader(String name, Object value) {
+ if (siMessage != null) {
+ siMessage.getHeader().setAttribute(name, value);
+ } else {
+ super.setHeader(name, value);
+ }
+ }
+
+ @Override
+ public Map<String, Object> getHeaders() {
+ if (siMessage != null) {
+ Map<String, Object> answer = new HashMap<String, Object>();
+ MessageHeader header = siMessage.getHeader();
+ for (String name : header.getAttributeNames()) {
+ answer.put(name, header.getAttribute(name));
+ }
+ return answer;
+ } else {
+ return super.getHeaders();
+ }
+ }
+
+ @Override
+ public SpringIntegrationMessage newInstance() {
+ return new SpringIntegrationMessage();
+ }
+
+ @Override
+ protected Object createBody() {
+ return siMessage.getPayload();
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,90 @@
+/**
+ * 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.spring.integration;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.integration.channel.ChannelRegistry;
+import org.springframework.integration.channel.MessageChannel;
+import org.springframework.integration.config.MessageBusParser;
+
+/**
+ * A producer of exchanges for the Spring Integration
+ * Please specify the outputChannel in the endpoint url for this producer.
+ * If the message pattern is inOut, the inputChannel property
+ * should be set for the receive the response message.
+ * @version
+ */
+public class SpringIntegrationProducer extends DefaultProducer<SpringIntegrationExchange> {
+ private static final transient Log LOG = LogFactory.getLog(SpringIntegrationProducer.class);
+ private SpringCamelContext context;
+ private MessageChannel inputChannel;
+ private MessageChannel outputChannel;
+ private String outputChannelName;
+ private ChannelRegistry channelRegistry;
+ private SpringIntegrationEndpoint endpoint;
+
+ public SpringIntegrationProducer(SpringIntegrationEndpoint endpoint) {
+ super(endpoint);
+ this.endpoint = endpoint;
+ context = (SpringCamelContext) endpoint.getContext();
+ outputChannelName = endpoint.getDefaultChannel();
+ channelRegistry = (ChannelRegistry) context.getApplicationContext().getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME);
+ if (ObjectHelper.isNullOrBlank(outputChannelName)) {
+ outputChannelName = endpoint.getInputChannel();
+ }
+ if (ObjectHelper.isNullOrBlank(outputChannelName)) {
+ throw new RuntimeCamelException("Can't find the right outputChannelName,"
+ + "please check the endpoint uri outputChannel part!");
+ } else {
+ outputChannel = (MessageChannel) channelRegistry.lookupChannel(outputChannelName);
+ }
+ if (endpoint.isInOut()) {
+ endpoint.setExchangePattern(ExchangePattern.InOut);
+ // we need to setup right inputChannel for further processing
+ if (ObjectHelper.isNullOrBlank(endpoint.getInputChannel())) {
+ throw new RuntimeCamelException("Can't find the right inputChannel, "
+ + "please check the endpoint uri inputChannel part!");
+ } else {
+ inputChannel = (MessageChannel) channelRegistry.lookupChannel(endpoint.getInputChannel());
+ }
+ }
+ }
+
+ public void process(Exchange exchange) throws Exception {
+ org.springframework.integration.message.Message siOutmessage = SpringIntegrationBinding.createSpringIntegrationMessage(exchange);
+ if (exchange.getPattern().isInCapable()) {
+ //Set the return channel address
+ siOutmessage.getHeader().setReturnAddress(inputChannel);
+ outputChannel.send(siOutmessage);
+ org.springframework.integration.message.Message siInMessage =
+ inputChannel.receive();
+ SpringIntegrationBinding.storeToCamelMessage(siInMessage, exchange.getOut());
+ } else {
+ outputChannel.send(siOutmessage);
+ }
+
+ }
+
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/component/si
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/component/si?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/component/si (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/component/si Mon Apr 14 09:16:05 2008
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.spring.integration.SpringIntegrationComponent
Added: activemq/camel/trunk/components/camel-spring-integration/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/resources/log4j.properties?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/resources/log4j.properties (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/resources/log4j.properties Mon Apr 14 09:16:05 2008
@@ -0,0 +1,20 @@
+
+#
+# The logging properties used for eclipse testing, We want to see debug output on the console.
+#
+log4j.rootLogger=INFO, out
+
+# uncomment the following line to turn on Camel debugging
+#log4j.logger.org.apache.camel=DEBUG
+
+# uncomment the following line to turn on ActiveMQ debugging
+#log4j.logger.org.apache.activemq=DEBUG
+
+log4j.logger.org.springframework=WARN
+
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/resources/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/resources/log4j.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/main/resources/log4j.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java Mon Apr 14 09:16:05 2008
@@ -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.component.spring.integration;
+
+/**
+ *
+ */
+public class HelloWorldService {
+
+ public String sayHello(String name) {
+ return "Hello " + name;
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/MyProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/MyProcessor.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/MyProcessor.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/MyProcessor.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,30 @@
+/**
+ * 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.spring.integration;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+public class MyProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ String request = (String) exchange.getIn().getBody();
+ String result = request + " is processed";
+ exchange.getOut().setBody(result);
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/MyProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/MyProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationOneWayConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationOneWayConsumerTest.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationOneWayConsumerTest.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationOneWayConsumerTest.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,44 @@
+/**
+ * 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.spring.integration;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.channel.MessageChannel;
+import org.springframework.integration.message.Message;
+import org.springframework.integration.message.StringMessage;
+
+
+public class SpringIntegrationOneWayConsumerTest extends SpringTestSupport {
+ private static final String MESSAGE_BODY = "hello world";
+
+ public void testSendingOneWayMessage() throws Exception {
+ MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+ resultEndpoint.expectedBodiesReceived(MESSAGE_BODY);
+ MessageChannel outputChannel = (MessageChannel) applicationContext.getBean("outputChannel");
+ outputChannel.send(new StringMessage(MESSAGE_BODY));
+ resultEndpoint.assertIsSatisfied();
+ }
+
+ public ClassPathXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/spring/integration/oneWayConsumer.xml");
+ }
+
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationOneWayConsumerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationOneWayConsumerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationProducerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationProducerTest.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationProducerTest.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationProducerTest.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,33 @@
+/**
+ * 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.spring.integration;
+
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringIntegrationProducerTest extends SpringTestSupport {
+
+ protected ClassPathXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/spring/integration/producer.xml");
+ }
+
+ public void testSendingTwoWayMessage() throws Exception {
+ String result = (String) template.sendBody("direct:start", "Willem");
+ assertEquals("Can't get the right response", result, "Hello Willem");
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationProducerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationProducerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationTwoWayConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationTwoWayConsumerTest.java?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationTwoWayConsumerTest.java (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationTwoWayConsumerTest.java Mon Apr 14 09:16:05 2008
@@ -0,0 +1,50 @@
+/**
+ * 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.spring.integration;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.channel.MessageChannel;
+import org.springframework.integration.message.Message;
+import org.springframework.integration.message.StringMessage;
+
+
+public class SpringIntegrationTwoWayConsumerTest extends SpringTestSupport {
+ private static final String MESSAGE_BODY = "Request message";
+
+ public void testSendingTwoWayMessage() throws Exception {
+
+ MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("requestChannel");
+ Message message = new StringMessage(MESSAGE_BODY);
+ message.getHeader().setReturnAddress("responseChannel");
+ requestChannel.send(message);
+
+ MessageChannel responseChannel = (MessageChannel) applicationContext.getBean("responseChannel");
+ Message responseMessage = responseChannel.receive();
+ String result = (String) responseMessage.getPayload();
+
+ assertEquals("Get the wrong result", MESSAGE_BODY + " is processed", result);
+ }
+
+ public ClassPathXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/spring/integration/twoWayConsumer.xml");
+ }
+
+
+}
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationTwoWayConsumerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationTwoWayConsumerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/oneWayConsumer.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/oneWayConsumer.xml?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/oneWayConsumer.xml (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/oneWayConsumer.xml Mon Apr 14 09:16:05 2008
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans:beans xmlns="http://www.springframework.org/schema/integration"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/integration
+ http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
+ http://activemq.apache.org/camel/schema/spring
+ http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
+
+ <message-bus auto-create-channels="true"/>
+
+ <channel id="outputChannel"/>
+
+ <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+ <route>
+ <!-- Using the & as the separator of & -->
+ <from uri="si://outputChannel"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+</beans:beans>
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/oneWayConsumer.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/oneWayConsumer.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/oneWayConsumer.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/producer.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/producer.xml?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/producer.xml (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/producer.xml Mon Apr 14 09:16:05 2008
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans:beans xmlns="http://www.springframework.org/schema/integration"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/integration
+ http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
+ http://activemq.apache.org/camel/schema/spring
+ http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
+
+ <message-bus auto-create-channels="true"/>
+
+ <endpoint input-channel="inputChannel"
+ default-output-channel="outputChannel"
+ handler-ref="helloService"
+ handler-method="sayHello"/>
+
+ <beans:bean id="helloService" class="org.apache.camel.component.spring.integration.HelloWorldService"/>
+
+ <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <!-- Using the & as the separator of & -->
+ <to uri="si:inputChannel?inOut=true&inputChannel=outputChannel"/>
+ </route>
+ </camelContext>
+</beans:beans>
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/producer.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/producer.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/producer.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/twoWayConsumer.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/twoWayConsumer.xml?rev=647877&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/twoWayConsumer.xml (added)
+++ activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/twoWayConsumer.xml Mon Apr 14 09:16:05 2008
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans:beans xmlns="http://www.springframework.org/schema/integration"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/integration
+ http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
+ http://activemq.apache.org/camel/schema/spring
+ http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
+
+ <message-bus auto-create-channels="true"/>
+
+ <channel id="requestChannel"/>
+ <channel id="responseChannel"/>
+
+ <beans:bean id="myProcessor" class="org.apache.camel.component.spring.integration.MyProcessor"/>
+
+ <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+ <route>
+ <!-- Using the & as the separator of & -->
+ <from uri="si://requestChannel?outputChannel=responseChannel&inOut=true"/>
+ <process ref="myProcessor"/>
+ </route>
+ </camelContext>
+</beans:beans>
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/twoWayConsumer.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/twoWayConsumer.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/twoWayConsumer.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: activemq/camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/pom.xml?rev=647877&r1=647876&r2=647877&view=diff
==============================================================================
--- activemq/camel/trunk/components/pom.xml (original)
+++ activemq/camel/trunk/components/pom.xml Mon Apr 14 09:16:05 2008
@@ -77,7 +77,8 @@
<module>camel-velocity</module>
<module>camel-xmlbeans</module>
<module>camel-xmpp</module>
- <module>camel-xstream</module>
+ <module>camel-xstream</module>
+ <module>camel-spring-integration</module>
</modules>
</project>