Author: davsclaus
Date: Thu Nov 13 02:20:46 2008
New Revision: 713697

URL: http://svn.apache.org/viewvc?rev=713697&view=rev
Log:
Merged revisions 713136 via svnmerge from 
https://svn.apache.org/repos/asf/activemq/camel/trunk

........
  r713136 | davsclaus | 2008-11-11 20:48:11 +0100 (ti, 11 nov 2008) | 1 line
  
  CAMEL-1065: Aligned sendBody and requestBody methods. Polished javadoc.
........

Modified:
    activemq/camel/branches/camel-1.x/   (props changed)
    
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java
    
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 13 02:20:46 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,713273,713290,713292,713295,713314,713475,713625
+/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

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/ProducerTemplate.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java?rev=713697&r1=713696&r2=713697&view=diff
==============================================================================
--- 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java
 Thu Nov 13 02:20:46 2008
@@ -49,7 +49,7 @@
     E send(E exchange);
 
     /**
-     * Sends an exchange to the default endpoint using a supplied
+     * Sends an exchange to the default endpoint using a supplied processor
      *
      * @param processor the transformer used to populate the new exchange
      * [EMAIL PROTECTED] Processor} to populate the exchange
@@ -235,7 +235,7 @@
      * @param headerValue the header value
      * @return the result (see class javadoc)
      */
-    Object sendBodyAndHeader(Endpoint endpoint, Object body, String header,
+    Object sendBodyAndHeader(Endpoint<E> endpoint, Object body, String header,
                                     Object headerValue);
 
     /**
@@ -249,7 +249,7 @@
      * @param headerValue the header value
      * @return the result (see class javadoc)
      */
-    Object sendBodyAndHeader(Endpoint endpoint, ExchangePattern pattern, 
Object body, String header,
+    Object sendBodyAndHeader(Endpoint<E> endpoint, ExchangePattern pattern, 
Object body, String header,
                                     Object headerValue);
 
     /**
@@ -286,14 +286,42 @@
      * @param headers headers
      * @return the result (see class javadoc)
      */
-    Object sendBodyAndHeaders(Endpoint endpoint, Object body, Map<String, 
Object> headers);
+    Object sendBodyAndHeaders(Endpoint<E> endpoint, Object body, Map<String, 
Object> headers);
+
+    /**
+     * Sends the body to an endpoint with the specified headers and header
+     * values
+     *
+     * @param endpointUri the endpoint URI to send to
+     * @param pattern the message [EMAIL PROTECTED] ExchangePattern} such as
+     *   [EMAIL PROTECTED] ExchangePattern#InOnly} or [EMAIL PROTECTED] 
ExchangePattern#InOut}
+     * @param body the payload to send
+     * @param headers headers
+     * @return the result (see class javadoc)
+     */
+    Object sendBodyAndHeaders(String endpointUri, ExchangePattern pattern, 
Object body,
+                              Map<String, Object> headers);
+
+    /**
+     * Sends the body to an endpoint with the specified headers and header
+     * values
+     *
+     * @param endpoint the endpoint URI to send to
+     * @param pattern the message [EMAIL PROTECTED] ExchangePattern} such as
+     *   [EMAIL PROTECTED] ExchangePattern#InOnly} or [EMAIL PROTECTED] 
ExchangePattern#InOut}
+     * @param body the payload to send
+     * @param headers headers
+     * @return the result (see class javadoc)
+     */
+    Object sendBodyAndHeaders(Endpoint<E> endpoint, ExchangePattern pattern, 
Object body,
+                              Map<String, Object> headers);
 
 
     // Methods using an InOut ExchangePattern
     // -----------------------------------------------------------------------
 
     /**
-     * Send the body to an endpoint returning any result output body.
+     * Sends an exchange to an endpoint using a supplied processor
      * Uses an [EMAIL PROTECTED] ExchangePattern#InOut} message exchange 
pattern.
      *
      * @param endpoint  the Endpoint to send to
@@ -303,6 +331,16 @@
     E request(Endpoint<E> endpoint, Processor processor);
 
     /**
+     * Sends an exchange to an endpoint using a supplied processor
+     * Uses an [EMAIL PROTECTED] ExchangePattern#InOut} message exchange 
pattern.
+     *
+     * @param endpointUri the endpoint URI to send to
+     * @param processor the processor which will populate the exchange before 
sending
+     * @return the result (see class javadoc)
+     */
+    Exchange request(String endpointUri, Processor processor);
+
+    /**
      * Send the body to an endpoint returning any result output body.
      * Uses an [EMAIL PROTECTED] ExchangePattern#InOut} message exchange 
pattern.
      *
@@ -316,6 +354,16 @@
      * Send the body to an endpoint returning any result output body.
      * Uses an [EMAIL PROTECTED] ExchangePattern#InOut} message exchange 
pattern.
      *
+     * @param endpointUri the endpoint URI to send to
+     * @param body        the payload
+     * @return the result (see class javadoc)
+     */
+    Object requestBody(String endpointUri, Object body);
+
+    /**
+     * Send the body to an endpoint returning any result output body.
+     * Uses an [EMAIL PROTECTED] ExchangePattern#InOut} message exchange 
pattern.
+     *
      * @param endpoint    the Endpoint to send to
      * @param body        the payload
      * @param header      the header name
@@ -329,31 +377,34 @@
      * Uses an [EMAIL PROTECTED] ExchangePattern#InOut} message exchange 
pattern.
      *
      * @param endpointUri the endpoint URI to send to
-     * @param processor the processor which will populate the exchange before 
sending
+     * @param body        the payload
+     * @param header      the header name
+     * @param headerValue the header value
      * @return the result (see class javadoc)
      */
-    E request(String endpointUri, Processor processor);
+    Object requestBodyAndHeader(String endpointUri, Object body, String 
header, Object headerValue);
 
     /**
-     * Send the body to an endpoint returning any result output body.
+     * Sends the body to an endpoint with the specified headers and header
+     * values.
      * Uses an [EMAIL PROTECTED] ExchangePattern#InOut} message exchange 
pattern.
      *
      * @param endpointUri the endpoint URI to send to
-     * @param body        the payload
+     * @param body the payload to send
+     * @param headers headers
      * @return the result (see class javadoc)
      */
-    Object requestBody(String endpointUri, Object body);
+    Object requestBodyAndHeaders(String endpointUri, Object body, Map<String, 
Object> headers);
 
     /**
-     * Send the body to an endpoint returning any result output body.
+     * Sends the body to an endpoint with the specified headers and header
+     * values.
      * Uses an [EMAIL PROTECTED] ExchangePattern#InOut} message exchange 
pattern.
      *
-     * @param endpointUri the endpoint URI to send to
-     * @param body        the payload
-     * @param header      the header name
-     * @param headerValue the header value
+     * @param endpoint the endpoint URI to send to
+     * @param body the payload to send
+     * @param headers headers
      * @return the result (see class javadoc)
      */
-    Object requestBodyAndHeader(String endpointUri, Object body, String 
header, Object headerValue);
-
+    Object requestBodyAndHeaders(Endpoint<E> endpoint, Object body, 
Map<String, Object> headers);
 }

Modified: 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java?rev=713697&r1=713696&r2=713697&view=diff
==============================================================================
--- 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java
 Thu Nov 13 02:20:46 2008
@@ -124,13 +124,13 @@
         return sendBodyAndHeader(resolveMandatoryEndpoint(endpointUri), body, 
header, headerValue);
     }
 
-    public Object sendBodyAndHeader(Endpoint endpoint, final Object body, 
final String header,
+    public Object sendBodyAndHeader(Endpoint<E> endpoint, final Object body, 
final String header,
             final Object headerValue) {
         E result = send(endpoint, createBodyAndHeaderProcessor(body, header, 
headerValue));
         return extractResultBody(result);
     }
 
-    public Object sendBodyAndHeader(Endpoint endpoint, ExchangePattern 
pattern, final Object body, final String header,
+    public Object sendBodyAndHeader(Endpoint<E> endpoint, ExchangePattern 
pattern, final Object body, final String header,
             final Object headerValue) {
         E result = send(endpoint, pattern, createBodyAndHeaderProcessor(body, 
header, headerValue));
         return extractResultBody(result, pattern);
@@ -146,7 +146,7 @@
         return sendBodyAndHeaders(resolveMandatoryEndpoint(endpointUri), body, 
headers);
     }
 
-    public Object sendBodyAndHeaders(Endpoint endpoint, final Object body, 
final Map<String, Object> headers) {
+    public Object sendBodyAndHeaders(Endpoint<E> endpoint, final Object body, 
final Map<String, Object> headers) {
         E result = send(endpoint, new Processor() {
             public void process(Exchange exchange) {
                 Message in = exchange.getIn();
@@ -159,6 +159,23 @@
         return extractResultBody(result);
     }
 
+    public Object sendBodyAndHeaders(String endpointUri, ExchangePattern 
pattern, Object body, Map<String, Object> headers) {
+        return sendBodyAndHeaders(resolveMandatoryEndpoint(endpointUri), 
pattern, body, headers);
+    }
+
+    public Object sendBodyAndHeaders(Endpoint<E> endpoint, ExchangePattern 
pattern, final Object body, final Map<String, Object> headers) {
+        E result = send(endpoint, pattern, new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                Message in = exchange.getIn();
+                for (Map.Entry<String, Object> header : headers.entrySet()) {
+                    in.setHeader(header.getKey(), header.getValue());
+                }
+                in.setBody(body);
+            }
+        });
+        return extractResultBody(result);
+    }
+
     // Methods using an InOut ExchangePattern
     // -----------------------------------------------------------------------
 
@@ -186,6 +203,14 @@
         return sendBodyAndHeader(endpoint, ExchangePattern.InOut, body, 
header, headerValue);
     }
 
+    public Object requestBodyAndHeaders(String endpointUri, Object body, 
Map<String, Object> headers) {
+        return requestBodyAndHeaders(resolveMandatoryEndpoint(endpointUri), 
body, headers);
+    }
+
+    public Object requestBodyAndHeaders(Endpoint<E> endpoint, final Object 
body, final Map<String, Object> headers) {
+        return sendBodyAndHeaders(endpoint, ExchangePattern.InOut, body, 
headers);
+    }
+
     // Methods using the default endpoint
     // -----------------------------------------------------------------------
 


Reply via email to