Author: ningjiang
Date: Tue Apr 29 20:06:35 2008
New Revision: 652235
URL: http://svn.apache.org/viewvc?rev=652235&view=rev
Log:
CAMEL-477 PhaseI coverting the SI's channel to camel-spring-integration endpoint
Added:
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
(with props)
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationChannelConverterTest.java
(with props)
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/springChannelConverter.xml
(with props)
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/BodyAndHeaderConvertTest.java
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java?rev=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
Tue Apr 29 20:06:35 2008
@@ -24,7 +24,7 @@
* href="http://activemq.apache.org/camel/message-endpoint.html">Message
* Endpoint</a> pattern and represents an endpoint that can send and receive
* message exchanges
- *
+ *
* @see Exchange
* @see Message
* @version $Revision$
@@ -66,14 +66,14 @@
/**
* Returns the context which created the endpoint
- *
+ *
* @return the context which created the endpoint
*/
CamelContext getContext();
/**
* Creates a new producer which is used send messages into the endpoint
- *
+ *
* @return a newly created producer
*/
Producer<E> createProducer() throws Exception;
@@ -83,7 +83,7 @@
* href="http://activemq.apache.org/camel/event-driven-consumer.html">Event
* Driven Consumer</a> which consumes messages from the endpoint using the
* given processor
- *
+ *
* @return a newly created consumer
*/
Consumer<E> createConsumer(Processor processor) throws Exception;
@@ -98,11 +98,13 @@
* rather than using the <a
* href="http://activemq.apache.org/camel/event-driven-consumer.html">Event
* Based Consumer</a> returned by [EMAIL PROTECTED]
#createConsumer(Processor)}
- *
+ *
* @return a newly created pull consumer
* @throws Exception if the pull consumer could not be created
*/
PollingConsumer<E> createPollingConsumer() throws Exception;
-
+
void configureProperties(Map options);
+
+ void setContext(CamelContext context);
}
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java?rev=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
Tue Apr 29 20:06:35 2008
@@ -82,6 +82,10 @@
return component;
}
+ public void setContext(CamelContext context) {
+ this.context = context;
+ }
+
/**
* @return the executor
*/
Modified:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/BodyAndHeaderConvertTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/BodyAndHeaderConvertTest.java?rev=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/BodyAndHeaderConvertTest.java
(original)
+++
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/BodyAndHeaderConvertTest.java
Tue Apr 29 20:06:35 2008
@@ -21,14 +21,16 @@
import javax.activation.DataHandler;
import javax.activation.URLDataSource;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import junit.framework.TestCase;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.DefaultExchange;
+
+
+
/**
* @version $Revision$
*/
@@ -55,7 +57,7 @@
// TODO better conversion example when the property editor support is
added
}
-
+
public void testConversionOfMessageAttachments() throws Exception {
DataHandler handler = exchange.getIn().getAttachment("att");
assertNotNull("attachment got lost", handler);
Modified:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java?rev=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
(original)
+++
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
Tue Apr 29 20:06:35 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -46,8 +45,7 @@
try {
result.assertIsSatisfied();
fail("Should have failed this test!");
- }
- catch (AssertionError e) {
+ } catch (AssertionError e) {
log.info("Caught expected assertion failure: " + e, e);
}
}
Modified:
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java?rev=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
(original)
+++
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
Tue Apr 29 20:06:35 2008
@@ -154,4 +154,8 @@
public QName getServiceName() {
return serviceName;
}
+
+ public void setContext(CamelContext context) {
+ endpoint.setContext(context);
+ }
}
Modified:
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=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
(original)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
Tue Apr 29 20:06:35 2008
@@ -23,7 +23,7 @@
/**
* The helper class for Mapping between the Spring Integration message and
* the Camel Message
- *
+ * @version $Revision
*/
public final class SpringIntegrationBinding {
Modified:
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=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java
(original)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationComponent.java
Tue Apr 29 20:06:35 2008
@@ -24,7 +24,7 @@
* Represents the component that manages [EMAIL PROTECTED]
SpringIntegrationEndpoint}. It holds the
* list of named direct endpoints.
*
- * @version
+ * @version $Revision
*/
public class SpringIntegrationComponent extends
DefaultComponent<SpringIntegrationExchange> {
Modified:
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=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
(original)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
Tue Apr 29 20:06:35 2008
@@ -33,7 +33,7 @@
* 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
+ * @version $Revision
*/
public class SpringIntegrationConsumer extends
ScheduledPollConsumer<SpringIntegrationExchange> {
private SpringCamelContext context;
@@ -47,17 +47,24 @@
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 + "]");
+ if (context != null && endpoint.getMessageChannel() == null) {
+ 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, , please check your configuration.");
+ }
} else {
- throw new RuntimeCamelException("Can't find the right
inputChannelName");
+ if (endpoint.getMessageChannel() != null) {
+ inputChannel = endpoint.getMessageChannel();
+ } else {
+ throw new RuntimeCamelException("Can't find the right message
channel, please check your configuration.");
+ }
}
if (endpoint.isInOut()) {
endpoint.setExchangePattern(ExchangePattern.InOut);
Modified:
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=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java
(original)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationEndpoint.java
Tue Apr 29 20:06:35 2008
@@ -16,30 +16,27 @@
*/
package org.apache.camel.component.spring.integration;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
+import org.apache.camel.CamelContext;
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;
+import org.springframework.integration.channel.MessageChannel;
/**
* Defines the <a
href="http://activemq.apache.org/camel/springIntergration.html">Spring
Intergration Endpoint</a>
*
- * @version
+ * @version $Revision
*/
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 MessageChannel messageChannel;
private boolean inOut;
public SpringIntegrationEndpoint(String uri, String channel,
SpringIntegrationComponent component) {
@@ -47,6 +44,11 @@
defaultChannel = channel;
}
+ public SpringIntegrationEndpoint(String uri, MessageChannel channel,
CamelContext context) {
+ super(uri, context);
+ messageChannel = channel;
+ }
+
public Producer<SpringIntegrationExchange> createProducer() throws
Exception {
return new SpringIntegrationProducer(this);
}
@@ -83,6 +85,10 @@
return defaultChannel;
}
+ public MessageChannel getMessageChannel() {
+ return messageChannel;
+ }
+
public boolean isSingleton() {
return false;
}
Modified:
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=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java
(original)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationExchange.java
Tue Apr 29 20:06:35 2008
@@ -27,7 +27,7 @@
* An [EMAIL PROTECTED] Exchange} for working with Spring Integration
endpoints which exposes the underlying
* Spring messages via [EMAIL PROTECTED] #getInMessage()} and [EMAIL
PROTECTED] #getOutMessage()}
*
- * @version
+ * @version $Revision
*/
public class SpringIntegrationExchange extends DefaultExchange {
Modified:
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=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
(original)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
Tue Apr 29 20:06:35 2008
@@ -26,7 +26,7 @@
* The Message [EMAIL PROTECTED] DefaultMessage} implementation
* for accessing the SpringIntegrationMessage
*
- * @version
+ * @version $Revision
*/
public class SpringIntegrationMessage extends DefaultMessage {
private org.springframework.integration.message.Message siMessage;
Modified:
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=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
(original)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
Tue Apr 29 20:06:35 2008
@@ -33,7 +33,7 @@
* 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
+ * @version $Revision
*/
public class SpringIntegrationProducer extends
DefaultProducer<SpringIntegrationExchange> {
private static final transient Log LOG =
LogFactory.getLog(SpringIntegrationProducer.class);
@@ -48,16 +48,24 @@
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!");
+ if (context != null && endpoint.getMessageChannel() == null) {
+ 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);
+ }
} else {
- outputChannel = (MessageChannel)
channelRegistry.lookupChannel(outputChannelName);
+ if (endpoint.getMessageChannel() != null) {
+ outputChannel = endpoint.getMessageChannel();
+ } else {
+ throw new RuntimeCamelException("Can't find the right message
channel, please check your configuration.");
+ }
}
if (endpoint.isInOut()) {
endpoint.setExchangePattern(ExchangePattern.InOut);
Added:
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java?rev=652235&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
(added)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
Tue Apr 29 20:06:35 2008
@@ -0,0 +1,57 @@
+/**
+ * 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.converter;
+
+import org.apache.camel.Converter;
+import org.apache.camel.Endpoint;
+import org.apache.camel.component.spring.integration.SpringIntegrationEndpoint;
+import org.springframework.integration.channel.MessageChannel;
+
+/**
+ * The <a href="http://activemq.apache.org/camel/type-converter.html">Type
Converters</a>
+ * for turning the Spring Integration types into Camel native type.
+ *
+ * @version $Revision$
+ */
+
[EMAIL PROTECTED]
+public final class SpringIntegrationConverter {
+
+ private SpringIntegrationConverter() {
+ // Helper class
+ }
+
+ /**
+ * @param Spring Integration MessageChannel
+ * @return an Camel Endpoint
+ * @throws Exception
+ */
+ @Converter
+ public static Endpoint toEndpoint(final MessageChannel channel) throws
Exception {
+ if (channel == null) {
+ throw new IllegalArgumentException("The MessageChannel is null");
+ }
+ Endpoint answer = new SpringIntegrationEndpoint("URL", channel, null);
+ System.out.println("call the toEndpoint method");
+ // check the channel
+ return answer;
+ }
+
+ //TODO add the message and endpoint type converter
+
+
+}
Propchange:
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/TypeConverter?rev=652235&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
(added)
+++
activemq/camel/trunk/components/camel-spring-integration/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
Tue Apr 29 20:06:35 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.
+#
+
+org.apache.camel.component.spring.integration.converter
\ No newline at end of file
Modified:
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=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java
(original)
+++
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/HelloWorldService.java
Tue Apr 29 20:06:35 2008
@@ -18,7 +18,7 @@
package org.apache.camel.component.spring.integration;
/**
- *
+ * The bean class which implements the business logical
*/
public class HelloWorldService {
Added:
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationChannelConverterTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationChannelConverterTest.java?rev=652235&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationChannelConverterTest.java
(added)
+++
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationChannelConverterTest.java
Tue Apr 29 20:06:35 2008
@@ -0,0 +1,27 @@
+/**
+ * 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.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+public class SpringIntegrationChannelConverterTest extends
SpringIntegrationOneWayConsumerTest {
+ public ClassPathXmlApplicationContext createApplicationContext() {
+ return new
ClassPathXmlApplicationContext("org/apache/camel/component/spring/integration/springChannelConverter.xml");
+ }
+}
Propchange:
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationChannelConverterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
activemq/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationChannelConverterTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/springChannelConverter.xml
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/springChannelConverter.xml?rev=652235&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/springChannelConverter.xml
(added)
+++
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/springChannelConverter.xml
Tue Apr 29 20:06:35 2008
@@ -0,0 +1,38 @@
+<?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>
+ <from uri="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/springChannelConverter.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/springChannelConverter.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
activemq/camel/trunk/components/camel-spring-integration/src/test/resources/org/apache/camel/component/spring/integration/springChannelConverter.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
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?rev=652235&r1=652234&r2=652235&view=diff
==============================================================================
---
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
Tue Apr 29 20:06:35 2008
@@ -168,6 +168,12 @@
}
protected Endpoint convertBeanToEndpoint(String uri, Object bean) {
+ //We will use the type convert to build the endpoint first
+ Endpoint endpoint = getTypeConverter().convertTo(Endpoint.class, bean);
+ if (endpoint != null) {
+ endpoint.setContext(this);
+ return endpoint;
+ }
Processor processor = new BeanProcessor(bean, this);
return new ProcessorEndpoint(uri, this, processor);
}