Author: ningjiang
Date: Thu Dec 11 05:03:17 2008
New Revision: 725675
URL: http://svn.apache.org/viewvc?rev=725675&view=rev
Log:
Merged revisions 725612 via svnmerge from
https://svn.apache.org/repos/asf/activemq/camel/trunk
........
r725612 | jstrachan | 2008-12-11 15:51:20 +0800 (Thu, 11 Dec 2008) | 1 line
minor improvemnet to CAMEL-1171 so that we can use to(pattern, uris...) or
to(pattern, endpoints...) so if a pattern is specified with to() it is the
first parameter. Also added similar inOut(endpoints...) and inOnly(...)
methods. Finally added an extra ExchangePattern constructor argument to ToType
so that when using [inOut|inOnly](uris|endpoints) we only need a single step in
the DSL which is a tad faster & minimises copying etc
........
Modified:
activemq/camel/branches/camel-1.x/ (props changed)
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
(contents, props changed)
activemq/camel/branches/camel-1.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromQueueThenConsumeFtpToMockTest.java
(props changed)
activemq/camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java
(props changed)
activemq/camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
(props changed)
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 11 05:03:17 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320,725340,725351,725569-725572
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320,725340,725351,725569-725572,725612
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java?rev=725675&r1=725674&r2=725675&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
(original)
+++
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
Thu Dec 11 05:03:17 2008
@@ -141,12 +141,12 @@
/**
* Sends the exchange with certain exchange pattern to the given endpoint
*
+ * @param pattern the pattern to use for the message exchange
* @param uri the endpoint to send to
* @return the builder
*/
- public Type to(String uri, ExchangePattern ep) {
- addOutput(new SetExchangePatternType(ep));
- addOutput(new ToType(uri));
+ public Type to(ExchangePattern pattern, String uri) {
+ addOutput(new ToType(uri, pattern));
return (Type) this;
}
@@ -154,12 +154,12 @@
/**
* Sends the exchange with certain exchange pattern to the given endpoint
*
+ * @param pattern the pattern to use for the message exchange
* @param endpoint the endpoint to send to
* @return the builder
*/
- public Type to(Endpoint endpoint, ExchangePattern ep) {
- addOutput(new SetExchangePatternType(ep));
- addOutput(new ToType(endpoint));
+ public Type to(ExchangePattern pattern, Endpoint endpoint) {
+ addOutput(new ToType(endpoint, pattern));
return (Type) this;
}
@@ -173,6 +173,7 @@
return (Type) this;
}
+
/**
* Sends the exchange to a list of endpoints
*/
@@ -186,7 +187,7 @@
/**
* Sends the exchange to a list of endpoint
*/
- public Type to(Collection<Endpoint> endpoints) {
+ public Type to(Iterable<Endpoint> endpoints) {
for (Endpoint endpoint : endpoints) {
addOutput(new ToType(endpoint));
}
@@ -194,8 +195,211 @@
}
+ /**
+ * Sends the exchange to a list of endpoints
+ *
+ * @param pattern the pattern to use for the message exchanges
+ * @param uris list of endpoints to send to
+ * @return the builder
+ */
+ public Type to(ExchangePattern pattern, String... uris) {
+ for (String uri : uris) {
+ addOutput(new ToType(uri, pattern));
+ }
+ return (Type) this;
+ }
+
+ /**
+ * Sends the exchange to a list of endpoints
+ *
+ * @param pattern the pattern to use for the message exchanges
+ * @param endpoints list of endpoints to send to
+ * @return the builder
+ */
+ public Type to(ExchangePattern pattern, Endpoint... endpoints) {
+ for (Endpoint endpoint : endpoints) {
+ addOutput(new ToType(endpoint, pattern));
+ }
+ return (Type) this;
+ }
+
+ /**
+ * Sends the exchange to a list of endpoints
+ *
+ * @param pattern the pattern to use for the message exchanges
+ * @param endpoints list of endpoints to send to
+ * @return the builder
+ */
+ public Type to(ExchangePattern pattern, Iterable<Endpoint> endpoints) {
+ for (Endpoint endpoint : endpoints) {
+ addOutput(new ToType(endpoint, pattern));
+ }
+ return (Type) this;
+ }
+
+
+ /**
+ * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
+ * set the ExchangePattern [EMAIL PROTECTED] ExchangePattern} into the
exchange
+ *
+ * @param exchangePattern instance of [EMAIL PROTECTED] ExchangePattern}
+ * @return the builder
+ */
+ public Type setExchangePattern(ExchangePattern exchangePattern) {
+ addOutput(new SetExchangePatternType(exchangePattern));
+ return (Type) this;
+ }
/**
+ * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
+ * set the exchange's ExchangePattern [EMAIL PROTECTED] ExchangePattern}
to be InOnly
+ *
+ *
+ * @return the builder
+ */
+ public Type inOnly() {
+ return setExchangePattern(ExchangePattern.InOnly);
+ }
+
+ /**
+ * Sends the message to the given endpoint using an
+ * <a href="http://activemq.apache.org/camel/event-message.html">Event
Message</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOnly
exchange pattern</a>
+ *
+ * @param uri The endpoint uri which is used for sending the exchange
+ * @return the builder
+ */
+ public Type inOnly(String uri) {
+ return to(ExchangePattern.InOnly, uri);
+ }
+
+ /**
+ * Sends the message to the given endpoint using an
+ * <a href="http://activemq.apache.org/camel/event-message.html">Event
Message</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOnly
exchange pattern</a>
+ *
+ * @param endpoint The endpoint which is used for sending the exchange
+ * @return the builder
+ */
+ public Type inOnly(Endpoint endpoint) {
+ return to(ExchangePattern.InOnly, endpoint);
+ }
+
+
+ /**
+ * Sends the message to the given endpoints using an
+ * <a href="http://activemq.apache.org/camel/event-message.html">Event
Message</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOnly
exchange pattern</a>
+ *
+ * @param uris list of endpoints to send to
+ * @return the builder
+ */
+ public Type inOnly(String... uris) {
+ return to(ExchangePattern.InOnly, uris);
+ }
+
+
+ /**
+ * Sends the message to the given endpoints using an
+ * <a href="http://activemq.apache.org/camel/event-message.html">Event
Message</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOnly
exchange pattern</a>
+ *
+ * @param endpoints list of endpoints to send to
+ * @return the builder
+ */
+ public Type inOnly(Endpoint... endpoints) {
+ return to(ExchangePattern.InOnly, endpoints);
+ }
+
+ /**
+ * Sends the message to the given endpoints using an
+ * <a href="http://activemq.apache.org/camel/event-message.html">Event
Message</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOnly
exchange pattern</a>
+ *
+ * @param endpoints list of endpoints to send to
+ * @return the builder
+ */
+ public Type inOnly(Iterable<Endpoint> endpoints) {
+ return to(ExchangePattern.InOnly, endpoints);
+ }
+
+
+ /**
+ * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
+ * set the exchange's ExchangePattern [EMAIL PROTECTED] ExchangePattern}
to be InOut
+ *
+ *
+ * @return the builder
+ */
+ public Type inOut() {
+ return setExchangePattern(ExchangePattern.InOut);
+ }
+
+ /**
+ * Sends the message to the given endpoint using an
+ * <a href="http://activemq.apache.org/camel/request-reply.html">Request
Reply</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOut
exchange pattern</a>
+ *
+ * @param uri The endpoint uri which is used for sending the exchange
+ * @return the builder
+ */
+ public Type inOut(String uri) {
+ return to(ExchangePattern.InOut, uri);
+ }
+
+
+ /**
+ * Sends the message to the given endpoint using an
+ * <a href="http://activemq.apache.org/camel/request-reply.html">Request
Reply</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOut
exchange pattern</a>
+ *
+ * @param endpoint The endpoint which is used for sending the exchange
+ * @return the builder
+ */
+ public Type inOut(Endpoint endpoint) {
+ return to(ExchangePattern.InOut, endpoint);
+ }
+
+ /**
+ * Sends the message to the given endpoints using an
+ * <a href="http://activemq.apache.org/camel/request-reply.html">Request
Reply</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOut
exchange pattern</a>
+ *
+ * @param uris list of endpoints to send to
+ * @return the builder
+ */
+ public Type inOut(String... uris) {
+ return to(ExchangePattern.InOut, uris);
+ }
+
+
+ /**
+ * Sends the message to the given endpoints using an
+ * <a href="http://activemq.apache.org/camel/request-reply.html">Request
Reply</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOut
exchange pattern</a>
+ *
+ * @param endpoints list of endpoints to send to
+ * @return the builder
+ */
+ public Type inOut(Endpoint... endpoints) {
+ return to(ExchangePattern.InOut, endpoints);
+ }
+
+ /**
+ * Sends the message to the given endpoints using an
+ * <a href="http://activemq.apache.org/camel/request-reply.html">Request
Reply</a> or
+ * <a href="http://activemq.apache.org/camel/exchange-pattern.html">InOut
exchange pattern</a>
+ *
+ * @param endpoints list of endpoints to send to
+ * @return the builder
+ */
+ public Type inOut(Iterable<Endpoint> endpoints) {
+ return to(ExchangePattern.InOut, endpoints);
+ }
+
+
+ /**
+ * <a href="http://activemq.apache.org/camel/multicast.html">Multicast
EIP:</a>
* Multicasts messages to all its child outputs; so that each processor and
* destination gets a copy of the original message to avoid the processors
* interfering with each other.
@@ -1591,84 +1795,6 @@
addOutput(new MarshalType(dataTypeRef));
return (Type) this;
}
-
- /**
- * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
- * set the ExchangePattern [EMAIL PROTECTED] ExchangePattern} into the
exchange
- *
- * @param exchangePattern instance of [EMAIL PROTECTED] ExchangePattern}
- * @return the builder
- */
- public Type setExchangePattern(ExchangePattern exchangePattern) {
- addOutput(new SetExchangePatternType(exchangePattern));
- return (Type) this;
- }
-
- /**
- * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
- * set the exchange's ExchangePattern [EMAIL PROTECTED] ExchangePattern}
to be InOnly
- *
- *
- * @return the builder
- */
- public Type inOnly() {
- return setExchangePattern(ExchangePattern.InOnly);
- }
-
- /**
- * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
- * set the exchange's ExchangePattern [EMAIL PROTECTED] ExchangePattern}
to be InOut
- *
- *
- * @return the builder
- */
- public Type inOut() {
- return setExchangePattern(ExchangePattern.InOut);
- }
-
- /**
- * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
- * set the exchange's ExchangePattern [EMAIL PROTECTED] ExchangePattern}
to be InOnly
- *
- * @param uri The endpoint uri which is used for sending the exchange
- * @return the builder
- */
- public Type inOnly(String uri) {
- return to(uri, ExchangePattern.InOnly);
- }
-
- /**
- * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
- * set the exchange's ExchangePattern [EMAIL PROTECTED] ExchangePattern}
to be InOut
- *
- * @param uri The endpoint uri which is used for sending the exchange
- * @return the builder
- */
- public Type inOut(String uri) {
- return to(uri, ExchangePattern.InOut);
- }
-
- /**
- * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
- * set the exchange's ExchangePattern [EMAIL PROTECTED] ExchangePattern}
to be InOnly
- *
- * @param uri The endpoint which is used for sending the exchange
- * @return the builder
- */
- public Type inOnly(Endpoint endpoint) {
- return to(endpoint, ExchangePattern.InOnly);
- }
-
- /**
- * <a
href="http://activemq.apache.org/camel/exchange-pattern.html">ExchangePattern:</a>
- * set the exchange's ExchangePattern [EMAIL PROTECTED] ExchangePattern}
to be InOut
- *
- * @param uri The endpoint which is used for sending the exchange
- * @return the builder
- */
- public Type inOut(Endpoint endpoint) {
- return to(endpoint, ExchangePattern.InOut);
- }
// Properties
//
-------------------------------------------------------------------------
Modified:
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java?rev=725675&r1=725674&r2=725675&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java
(original)
+++
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java
Thu Dec 11 05:03:17 2008
@@ -47,6 +47,16 @@
setEndpoint(endpoint);
}
+ public ToType(String uri, ExchangePattern pattern) {
+ this(uri);
+ this.pattern = pattern;
+ }
+
+ public ToType(Endpoint endpoint, ExchangePattern pattern) {
+ this(endpoint);
+ this.pattern = pattern;
+ }
+
@Override
public String toString() {
return "To[" + getLabel() + "]";
Modified:
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java?rev=725675&r1=725674&r2=725675&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
(original)
+++
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
Thu Dec 11 05:03:17 2008
@@ -76,7 +76,7 @@
//Set the exchange pattern to InOut, then send it from
direct:inOut to mock:result endpoint
from("direct:inOut").setExchangePattern(ExchangePattern.InOnly).to("mock:result");
//Send the exchange from direct:inOut1 to mock:result with
setting the exchange pattern to be RobustInOnly
- from("direct:inOut1").to("mock:result",
ExchangePattern.RobustInOnly);
+ from("direct:inOut1").to(ExchangePattern.RobustInOnly,
"mock:result");
//Send the exchange from direct:inOut2 to mock:result with
setting the exchange pattern to be InOnly
from("direct:inOut2").inOnly("mock:result");
// END SNIPPET: example
Propchange:
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
('svn:mergeinfo' removed)
Propchange:
activemq/camel/branches/camel-1.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromQueueThenConsumeFtpToMockTest.java
('svn:mergeinfo' removed)
Propchange:
activemq/camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetExchangePatternTest.java
('svn:mergeinfo' removed)
Propchange:
activemq/camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/setExchangePattern.xml
('svn:mergeinfo' removed)