You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2007/09/04 12:28:48 UTC
svn commit: r572607 - in /activemq/camel/trunk: ./ apache-camel/
apache-camel/src/main/descriptors/ camel-core/src/main/java/org/apache/camel/
camel-core/src/main/java/org/apache/camel/component/file/
camel-core/src/main/java/org/apache/camel/component...
Author: jstrachan
Date: Tue Sep 4 03:28:46 2007
New Revision: 572607
URL: http://svn.apache.org/viewvc?rev=572607&view=rev
Log:
initial implementation of Message ExchangePattern support for CAMEL-133
Added:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangePattern.java (with props)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangePatternTest.java (with props)
Modified:
activemq/camel/trunk/apache-camel/pom.xml
activemq/camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml
activemq/camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java
activemq/camel/trunk/pom.xml
Modified: activemq/camel/trunk/apache-camel/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/apache-camel/pom.xml?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/apache-camel/pom.xml (original)
+++ activemq/camel/trunk/apache-camel/pom.xml Tue Sep 4 03:28:46 2007
@@ -72,6 +72,14 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-jdbc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jetty</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-jing</artifactId>
</dependency>
<dependency>
@@ -105,6 +113,10 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-msv</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-ognl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
Modified: activemq/camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml (original)
+++ activemq/camel/trunk/apache-camel/src/main/descriptors/unix-bin.xml Tue Sep 4 03:28:46 2007
@@ -90,6 +90,7 @@
<include>org.apache.camel:camel-irc</include>
<include>org.apache.camel:camel-jaxb</include>
<include>org.apache.camel:camel-jdbc</include>
+ <include>org.apache.camel:camel-jetty</include>
<include>org.apache.camel:camel-jing</include>
<include>org.apache.camel:camel-jms</include>
<include>org.apache.camel:camel-josql</include>
Modified: activemq/camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml (original)
+++ activemq/camel/trunk/apache-camel/src/main/descriptors/windows-bin.xml Tue Sep 4 03:28:46 2007
@@ -96,6 +96,7 @@
<include>org.apache.camel:camel-irc</include>
<include>org.apache.camel:camel-jaxb</include>
<include>org.apache.camel:camel-jdbc</include>
+ <include>org.apache.camel:camel-jetty</include>
<include>org.apache.camel:camel-jing</include>
<include>org.apache.camel:camel-jms</include>
<include>org.apache.camel:camel-josql</include>
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java Tue Sep 4 03:28:46 2007
@@ -78,7 +78,7 @@
* @param exchange the exchange to send
*/
public E send(Endpoint<E> endpoint, E exchange) {
- E convertedExchange = endpoint.toExchangeType(exchange);
+ E convertedExchange = endpoint.createExchange(exchange);
producerCache.send(endpoint, convertedExchange);
return convertedExchange;
}
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=572607&r1=572606&r2=572607&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 Sep 4 03:28:46 2007
@@ -53,11 +53,6 @@
E createExchange(Exchange exchange);
/**
- * Converts the given exchange to this endpoints required type
- */
- E toExchangeType(Exchange exchange);
-
- /**
* Returns the context which created the endpoint
*
* @return the context which created the endpoint
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Tue Sep 4 03:28:46 2007
@@ -31,18 +31,11 @@
public interface Exchange {
/**
- * Returns the exchange id
- *
- * @return the unique id of the exchange
- */
- String getExchangeId();
-
- /**
- * Set the exchange id
- *
- * @param id
+ * Returns the {@link ExchangePattern} (MEP) of this exchange.
+ *
+ * @return the message exchange pattern of this exchange
*/
- void setExchangeId(String id);
+ ExchangePattern getExchangePattern();
/**
* Returns a property associated with this exchange by name
@@ -160,5 +153,24 @@
*/
void copyFrom(Exchange source);
+ /**
+ * Returns the unit of work that this exchange belongs to; which may map to
+ * zero, one or more physical transactions
+ */
UnitOfWork getUnitOfWork();
+
+ /**
+ * Returns the exchange id
+ *
+ * @return the unique id of the exchange
+ */
+ String getExchangeId();
+
+ /**
+ * Set the exchange id
+ *
+ * @param id
+ */
+ void setExchangeId(String id);
+
}
Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangePattern.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangePattern.java?rev=572607&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangePattern.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangePattern.java Tue Sep 4 03:28:46 2007
@@ -0,0 +1,107 @@
+/**
+ *
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Represents the kind of message exchange pattern
+ *
+ * @version $Revision: 1.1 $
+ */
+public enum ExchangePattern {
+ InOnly,
+ RobustInOnly,
+ InOut,
+ InOptionalOut,
+ OutOnly,
+ RobustOutOnly,
+ OutIn,
+ OutOptionalIn;
+
+ protected static final Map<String, ExchangePattern> map = new HashMap<String, ExchangePattern>();
+
+ /**
+ * Returns the WSDL URI for this message exchange pattern
+ *
+ * @return the WSDL URI for this message exchange pattern
+ */
+ public String getWsdlUri() {
+ switch (this) {
+ case InOnly:
+ return "http://www.w3.org/ns/wsdl/in-only";
+ case InOptionalOut:
+ return "http://www.w3.org/ns/wsdl/in-optional-out";
+ case InOut:
+ return "http://www.w3.org/ns/wsdl/in-out";
+ case OutIn:
+ return "http://www.w3.org/ns/wsdl/out-in";
+ case OutOnly:
+ return "http://www.w3.org/ns/wsdl/out-only";
+ case OutOptionalIn:
+ return "http://www.w3.org/ns/wsdl/out-optional_in";
+ case RobustInOnly:
+ return "http://www.w3.org/ns/wsdl/robust-in-only";
+ case RobustOutOnly:
+ return "http://www.w3.org/ns/wsdl/robust-out-only";
+ default:
+ throw new IllegalArgumentException("Unknown message exchange pattern: " + this);
+ }
+ }
+
+ /**
+ * Return true if there can be an IN message
+ */
+ public boolean isInCapable() {
+ switch (this) {
+ case OutOnly:
+ case RobustOutOnly:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Return true if there can be an OUT message
+ */
+ public boolean isOutCapable() {
+ switch (this) {
+ case InOnly:
+ case RobustInOnly:
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ /**
+ * Converts the WSDL URI into a {@link ExchangePattern} instance
+ */
+ public static ExchangePattern fromWsdlUri(String wsdlUri) {
+ return map.get(wsdlUri);
+ }
+
+ static {
+ for (ExchangePattern mep : values()) {
+ String uri = mep.getWsdlUri();
+ map.put(uri, mep);
+ }
+ }
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangePattern.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java Tue Sep 4 03:28:46 2007
@@ -55,7 +55,7 @@
* @see org.apache.camel.Processor#process(Exchange)
*/
public void process(Exchange exchange) throws Exception {
- process(endpoint.toExchangeType(exchange));
+ process(endpoint.createExchange(exchange));
}
public void process(FileExchange exchange) throws Exception {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java Tue Sep 4 03:28:46 2007
@@ -28,7 +28,7 @@
*
* @version $Revision: 519973 $
*/
-public class QueueComponent<E extends Exchange> extends SedaComponent<E> {
+public class QueueComponent extends SedaComponent {
private static final transient Log LOG = LogFactory.getLog(QueueComponent.class);
public QueueComponent() {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java Tue Sep 4 03:28:46 2007
@@ -30,13 +30,13 @@
*
* @version $Revision: 1.1 $
*/
-public class SedaComponent<E extends Exchange> extends DefaultComponent<E> {
- public BlockingQueue<SedaEndpoint.Entry<E>> createQueue() {
- return new LinkedBlockingQueue<SedaEndpoint.Entry<E>>(1000);
+public class SedaComponent extends DefaultComponent {
+ public BlockingQueue<SedaEndpoint.Entry> createQueue() {
+ return new LinkedBlockingQueue<SedaEndpoint.Entry>(1000);
}
@Override
- protected Endpoint<E> createEndpoint(String uri, String remaining, Map parameters) throws Exception {
- return new SedaEndpoint<E>(uri, this);
+ protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
+ return new SedaEndpoint(uri, this);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java Tue Sep 4 03:28:46 2007
@@ -32,26 +32,26 @@
/**
* @version $Revision$
*/
-public class SedaConsumer<E extends Exchange> extends ServiceSupport implements Consumer<E>, Runnable {
+public class SedaConsumer extends ServiceSupport implements Consumer, Runnable {
private static final Log LOG = LogFactory.getLog(SedaConsumer.class);
- private SedaEndpoint<E> endpoint;
+ private SedaEndpoint endpoint;
private AsyncProcessor processor;
private Thread thread;
- public SedaConsumer(SedaEndpoint<E> endpoint, Processor processor) {
+ public SedaConsumer(SedaEndpoint endpoint, Processor processor) {
this.endpoint = endpoint;
this.processor = AsyncProcessorTypeConverter.convert(processor);
}
@Override
public String toString() {
- return "QueueConsumer: " + endpoint.getEndpointUri();
+ return "SedaConsumer: " + endpoint.getEndpointUri();
}
public void run() {
while (!isStopping()) {
- final SedaEndpoint.Entry<E> entry;
+ final SedaEndpoint.Entry entry;
try {
entry = endpoint.getQueue().poll(1000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java Tue Sep 4 03:28:46 2007
@@ -37,21 +37,21 @@
*
* @version $Revision: 519973 $
*/
-public class SedaEndpoint<E extends Exchange> extends DefaultEndpoint<E> {
+public class SedaEndpoint extends DefaultEndpoint<Exchange> {
- static public class Entry<E extends Exchange> {
- E exchange;
+ static public class Entry {
+ Exchange exchange;
AsyncCallback callback;
- public Entry(E exchange, AsyncCallback callback) {
+ public Entry(Exchange exchange, AsyncCallback callback) {
this.exchange = exchange;
this.callback = callback;
}
- public E getExchange() {
+ public Exchange getExchange() {
return exchange;
}
- public void setExchange(E exchange) {
+ public void setExchange(Exchange exchange) {
this.exchange = exchange;
}
public AsyncCallback getCallback() {
@@ -68,40 +68,38 @@
super(endpoint);
}
public void process(Exchange exchange) {
- queue.add(new Entry<E>(toExchangeType(exchange), null));
+ queue.add(new Entry(createExchange(exchange), null));
}
public boolean process(Exchange exchange, AsyncCallback callback) {
- queue.add(new Entry<E>(toExchangeType(exchange), callback));
+ queue.add(new Entry(createExchange(exchange), callback));
return false;
}
}
- private BlockingQueue<Entry<E>> queue;
+ private BlockingQueue<Entry> queue;
- public SedaEndpoint(String endpointUri, Component component, BlockingQueue<Entry<E>> queue) {
+ public SedaEndpoint(String endpointUri, Component component, BlockingQueue<Entry> queue) {
super(endpointUri, component);
this.queue = queue;
}
- public SedaEndpoint(String uri, SedaComponent<E> component) {
+ public SedaEndpoint(String uri, SedaComponent component) {
this(uri, component, component.createQueue());
}
- public Producer<E> createProducer() throws Exception {
+ public Producer createProducer() throws Exception {
return new SedaProducer(this);
}
- public Consumer<E> createConsumer(Processor processor) throws Exception {
- return new SedaConsumer<E>(this, processor);
+ public Consumer createConsumer(Processor processor) throws Exception {
+ return new SedaConsumer(this, processor);
}
- public E createExchange() {
- // How can we create a specific Exchange if we are generic??
- // perhaps it would be better if we did not implement this.
- return (E)new DefaultExchange(getContext());
+ public Exchange createExchange() {
+ return new DefaultExchange(getContext());
}
- public BlockingQueue<Entry<E>> getQueue() {
+ public BlockingQueue<Entry> getQueue() {
return queue;
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java Tue Sep 4 03:28:46 2007
@@ -34,18 +34,18 @@
*
* @version $Revision: 1.1 $
*/
-public class VmComponent<E extends Exchange> extends SedaComponent<E> {
+public class VmComponent extends SedaComponent {
protected static Map<String, BlockingQueue> queues = new HashMap<String, BlockingQueue>();
@Override
- protected Endpoint<E> createEndpoint(String uri, String remaining, Map parameters) throws Exception {
- BlockingQueue<SedaEndpoint.Entry<E>> blockingQueue = (BlockingQueue<SedaEndpoint.Entry<E>>) getBlockingQueue(uri);
- return new SedaEndpoint<E>(uri, this, blockingQueue);
+ protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
+ BlockingQueue<SedaEndpoint.Entry> blockingQueue = getBlockingQueue(uri);
+ return new SedaEndpoint(uri, this, blockingQueue);
}
- protected BlockingQueue<Entry<E>> getBlockingQueue(String uri) {
+ protected BlockingQueue<Entry> getBlockingQueue(String uri) {
synchronized (queues) {
- BlockingQueue<Entry<E>> answer = queues.get(uri);
+ BlockingQueue<Entry> answer = queues.get(uri);
if (answer == null) {
answer = createQueue();
queues.put(uri, answer);
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=572607&r1=572606&r2=572607&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 Sep 4 03:28:46 2007
@@ -130,11 +130,6 @@
return answer;
}
- public E toExchangeType(Exchange exchange) {
- // TODO avoid cloning exchanges if E == Exchange!
- return createExchange(exchange);
- }
-
/**
* Returns the type of the exchange which is generated by this component
*/
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java Tue Sep 4 03:28:46 2007
@@ -18,6 +18,7 @@
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
import org.apache.camel.Message;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.spi.UnitOfWork;
@@ -41,9 +42,15 @@
private Throwable exception;
private String exchangeId = DefaultExchange.DEFAULT_ID_GENERATOR.generateId();
private UnitOfWork unitOfWork;
+ private ExchangePattern exchangePattern;
public DefaultExchange(CamelContext context) {
+ this(context, ExchangePattern.InOnly);
+ }
+
+ public DefaultExchange(CamelContext context, ExchangePattern exchangePattern) {
this.context = context;
+ this.exchangePattern = exchangePattern;
}
@Override
@@ -76,6 +83,7 @@
setException(exchange.getException());
unitOfWork = exchange.getUnitOfWork();
+ exchangePattern = exchange.getExchangePattern();
}
private static void safeCopy(Message message, Exchange exchange, Message that) {
@@ -178,6 +186,14 @@
public void setException(Throwable exception) {
this.exception = exception;
+ }
+
+ public ExchangePattern getExchangePattern() {
+ return exchangePattern;
+ }
+
+ public void setExchangePattern(ExchangePattern exchangePattern) {
+ this.exchangePattern = exchangePattern;
}
public void throwException() throws Exception {
Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangePatternTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangePatternTest.java?rev=572607&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangePatternTest.java (added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangePatternTest.java Tue Sep 4 03:28:46 2007
@@ -0,0 +1,35 @@
+/**
+ *
+ * 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;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class ExchangePatternTest extends TestCase {
+ public void testExchangePattern() throws Exception {
+ ExchangePattern mep = ExchangePattern.InOut;
+ assertEquals("WSDL Uri", "http://www.w3.org/ns/wsdl/in-out", mep.getWsdlUri());
+ }
+
+ public void testStringToMEP() throws Exception {
+ ExchangePattern mep = ExchangePattern.fromWsdlUri("http://www.w3.org/ns/wsdl/in-only");
+ assertEquals("MEP", ExchangePattern.InOnly, mep);
+ }
+}
Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangePatternTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java Tue Sep 4 03:28:46 2007
@@ -71,12 +71,12 @@
Class type = endpoint.getExchangeType();
assertEquals("exchange type", MyExchange.class, type);
- MyExchange actual = endpoint.toExchangeType(exchange);
+ MyExchange actual = endpoint.createExchange(exchange);
assertNotNull(actual);
assertTrue("Not same exchange", actual != exchange);
MyExchange expected = new MyExchange(context);
- actual = endpoint.toExchangeType(expected);
+ actual = endpoint.createExchange(expected);
assertSame("Should not copy an exchange when of the correct type", expected, actual);
Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Tue Sep 4 03:28:46 2007
@@ -16,12 +16,7 @@
*/
package org.apache.camel.component.cxf;
-import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
-
-import java.io.IOException;
-import java.io.InputStream;
import java.util.List;
-import java.util.concurrent.CountDownLatch;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeCamelException;
@@ -30,28 +25,12 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.endpoint.ClientImpl;
import org.apache.cxf.frontend.ClientFactoryBean;
-import org.apache.cxf.frontend.ClientProxyFactoryBean;
-import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.model.BindingInfo;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.Destination;
-import org.apache.cxf.transport.MessageObserver;
-import org.apache.cxf.wsdl11.WSDLServiceFactory;
-import java.io.IOException;
import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.concurrent.CountDownLatch;
-
-import javax.xml.namespace.QName;
-
/**
* Sends messages from Camel into the CXF endpoint
@@ -88,7 +67,7 @@
}
public void process(Exchange exchange) {
- CxfExchange cxfExchange = endpoint.toExchangeType(exchange);
+ CxfExchange cxfExchange = endpoint.createExchange(exchange);
process(cxfExchange);
}
Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java Tue Sep 4 03:28:46 2007
@@ -34,7 +34,7 @@
}
public void process(Exchange exchange) throws Exception {
- process(endpoint.toExchangeType(exchange));
+ process(endpoint.createExchange(exchange));
}
public void process(RemoteFileExchange exchange) throws Exception {
Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java Tue Sep 4 03:28:46 2007
@@ -36,7 +36,7 @@
}
public void process(Exchange exchange) throws Exception {
- process(endpoint.toExchangeType(exchange));
+ process(endpoint.createExchange(exchange));
}
public void process(RemoteFileExchange exchange) throws Exception {
Modified: activemq/camel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/pom.xml?rev=572607&r1=572606&r2=572607&view=diff
==============================================================================
--- activemq/camel/trunk/pom.xml (original)
+++ activemq/camel/trunk/pom.xml Tue Sep 4 03:28:46 2007
@@ -234,6 +234,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-jetty</artifactId>
+ <version>${camel-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-jing</artifactId>
<version>${camel-version}</version>
</dependency>