Author: hadrian
Date: Sun Nov 9 16:56:34 2008
New Revision: 712589
URL: http://svn.apache.org/viewvc?rev=712589&view=rev
Log:
CAMEL-872. Producer and Consumer don't need the generic argument, but get to
keep it for now. Part 2 of many.
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/PollingConsumer.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Producer.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducer.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultScheduledPollConsumer.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenPollingConsumer.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/PollingConsumerSupport.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/PollingConsumer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/PollingConsumer.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/PollingConsumer.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/PollingConsumer.java
Sun Nov 9 16:56:34 2008
@@ -33,7 +33,7 @@
*
* @return the message exchange received.
*/
- E receive();
+ Exchange receive();
/**
* Attempts to receive a message exchange immediately without waiting and
@@ -42,7 +42,7 @@
* @return the message exchange if one is immediately available otherwise
* <tt>null</tt>
*/
- E receiveNoWait();
+ Exchange receiveNoWait();
/**
* Attempts to receive a message exchange, waiting up to the given timeout
@@ -54,6 +54,6 @@
* @return the message exchange if one iwas available within the timeout
* period, or <tt>null</tt> if the timeout expired
*/
- E receive(long timeout);
+ Exchange receive(long timeout);
}
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Producer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Producer.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Producer.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Producer.java
Sun Nov 9 16:56:34 2008
@@ -31,18 +31,18 @@
*
* @return a newly created exchange
*/
- E createExchange();
+ Exchange createExchange();
/**
* Creates a new exchange of the given pattern to send to this endpoint
*
* @return a newly created exchange
*/
- E createExchange(ExchangePattern pattern);
+ Exchange createExchange(ExchangePattern pattern);
/**
* Creates a new exchange for communicating with this exchange using the
* given exchange to pre-populate the values of the headers and messages
*/
- E createExchange(E exchange);
+ Exchange createExchange(Exchange exchange);
}
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducer.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducer.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducer.java
Sun Nov 9 16:56:34 2008
@@ -42,16 +42,16 @@
return endpoint;
}
- public E createExchange() {
- return (E) endpoint.createExchange();
+ public Exchange createExchange() {
+ return endpoint.createExchange();
}
- public E createExchange(ExchangePattern pattern) {
- return (E) endpoint.createExchange(pattern);
+ public Exchange createExchange(ExchangePattern pattern) {
+ return endpoint.createExchange(pattern);
}
- public E createExchange(E exchange) {
- return (E) endpoint.createExchange(exchange);
+ public Exchange createExchange(Exchange exchange) {
+ return endpoint.createExchange(exchange);
}
protected void doStart() throws Exception {
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultScheduledPollConsumer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultScheduledPollConsumer.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultScheduledPollConsumer.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultScheduledPollConsumer.java
Sun Nov 9 16:56:34 2008
@@ -43,7 +43,7 @@
protected void poll() throws Exception {
while (true) {
- E exchange = pollingConsumer.receiveNoWait();
+ E exchange = (E) pollingConsumer.receiveNoWait();
if (exchange == null) {
break;
}
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenPollingConsumer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenPollingConsumer.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenPollingConsumer.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenPollingConsumer.java
Sun Nov 9 16:56:34 2008
@@ -52,11 +52,11 @@
this.queue = queue;
}
- public E receiveNoWait() {
+ public Exchange receiveNoWait() {
return receive(0);
}
- public E receive() {
+ public Exchange receive() {
while (isRunAllowed()) {
try {
return queue.take();
@@ -68,7 +68,7 @@
return null;
}
- public E receive(long timeout) {
+ public Exchange receive(long timeout) {
try {
return queue.poll(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/PollingConsumerSupport.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/PollingConsumerSupport.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/PollingConsumerSupport.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/PollingConsumerSupport.java
Sun Nov 9 16:56:34 2008
@@ -26,8 +26,7 @@
*
* @version $Revision$
*/
-public abstract class PollingConsumerSupport<E extends Exchange> extends
ServiceSupport implements
- PollingConsumer<E> {
+public abstract class PollingConsumerSupport<E extends Exchange> extends
ServiceSupport implements PollingConsumer<E> {
private final Endpoint<E> endpoint;
private ExceptionHandler exceptionHandler;
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
Sun Nov 9 16:56:34 2008
@@ -84,7 +84,7 @@
public E send(Endpoint<E> endpoint, Processor processor) {
try {
Producer<E> producer = getProducer(endpoint);
- E exchange = producer.createExchange();
+ E exchange = (E) producer.createExchange();
return sendExchange(endpoint, producer, processor, exchange);
} catch (Exception e) {
throw wrapRuntimeCamelException(e);
@@ -102,7 +102,7 @@
public E send(Endpoint<E> endpoint, Processor processor, AsyncCallback
callback) {
try {
Producer<E> producer = getProducer(endpoint);
- E exchange = producer.createExchange();
+ E exchange = (E) producer.createExchange();
boolean sync = sendExchange(endpoint, producer, processor,
exchange, callback);
setProcessedSync(exchange, sync);
return exchange;
@@ -132,7 +132,7 @@
public E send(Endpoint<E> endpoint, ExchangePattern pattern, Processor
processor) {
try {
Producer<E> producer = getProducer(endpoint);
- E exchange = producer.createExchange(pattern);
+ E exchange = (E) producer.createExchange(pattern);
return sendExchange(endpoint, producer, processor, exchange);
} catch (Exception e) {
throw wrapRuntimeCamelException(e);
Modified:
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
(original)
+++
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
Sun Nov 9 16:56:34 2008
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.io.InputStream;
+import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.http.helper.LoadingByteArrayOutputStream;
@@ -45,15 +46,15 @@
httpClient = endpoint.createHttpClient();
}
- public HttpExchange receive() {
+ public Exchange receive() {
return receiveNoWait();
}
- public HttpExchange receive(long timeout) {
+ public Exchange receive(long timeout) {
return receiveNoWait();
}
- public HttpExchange receiveNoWait() {
+ public Exchange receiveNoWait() {
HttpExchange exchange = (HttpExchange) endpoint.createExchange();
HttpMethod method = createMethod();
Modified:
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
(original)
+++
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
Sun Nov 9 16:56:34 2008
@@ -218,5 +218,4 @@
}
}
}
-
}
Modified:
activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
(original)
+++
activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
Sun Nov 9 16:56:34 2008
@@ -36,7 +36,7 @@
HttpEndpoint endpoiont = (HttpEndpoint)
component.createEndpoint("http://www.google.com");
MyHttpProducer producer = new MyHttpProducer(endpoiont, "GET", null);
- HttpExchange exchange = producer.createExchange();
+ HttpExchange exchange = (HttpExchange) producer.createExchange();
exchange.getIn().setBody(null);
try {
producer.process(exchange);
@@ -53,7 +53,7 @@
HttpEndpoint endpoiont = (HttpEndpoint)
component.createEndpoint("http://www.google.com");
MyHttpProducer producer = new MyHttpProducer(endpoiont, "POST", null);
- HttpExchange exchange = producer.createExchange();
+ HttpExchange exchange = (HttpExchange) producer.createExchange();
exchange.getIn().setBody("This is some data to post");
try {
producer.process(exchange);
@@ -70,7 +70,7 @@
HttpEndpoint endpoiont = (HttpEndpoint)
component.createEndpoint("http://www.google.com");
MyHttpProducer producer = new MyHttpProducer(endpoiont, "POST", null);
- HttpExchange exchange = producer.createExchange();
+ HttpExchange exchange = (HttpExchange) producer.createExchange();
exchange.getIn().setBody("");
exchange.getIn().setHeader(HTTP_METHOD, POST);
try {
@@ -88,7 +88,7 @@
HttpEndpoint endpoiont = (HttpEndpoint)
component.createEndpoint("http://www.google.com");
MyHttpProducer producer = new MyHttpProducer(endpoiont, "GET", null);
- HttpExchange exchange = producer.createExchange();
+ HttpExchange exchange = (HttpExchange) producer.createExchange();
exchange.getIn().setBody("");
exchange.getIn().setHeader(HTTP_METHOD, GET);
try {
@@ -106,7 +106,7 @@
HttpEndpoint endpoiont = (HttpEndpoint)
component.createEndpoint("http://www.google.com?q=Camel");
MyHttpProducer producer = new MyHttpProducer(endpoiont, "GET",
"q=Camel");
- HttpExchange exchange = producer.createExchange();
+ HttpExchange exchange = (HttpExchange) producer.createExchange();
exchange.getIn().setBody("");
try {
producer.process(exchange);
@@ -123,7 +123,7 @@
HttpEndpoint endpoiont = (HttpEndpoint)
component.createEndpoint("http://www.google.com");
MyHttpProducer producer = new MyHttpProducer(endpoiont, "GET",
"q=Camel");
- HttpExchange exchange = producer.createExchange();
+ HttpExchange exchange = (HttpExchange) producer.createExchange();
exchange.getIn().setBody("");
exchange.getIn().setHeader(HttpProducer.QUERY, "q=Camel");
try {
@@ -141,7 +141,7 @@
HttpEndpoint endpoiont = (HttpEndpoint)
component.createEndpoint("http://www.google.com?q=Donkey");
MyHttpProducer producer = new MyHttpProducer(endpoiont, "GET",
"q=Camel");
- HttpExchange exchange = producer.createExchange();
+ HttpExchange exchange = (HttpExchange) producer.createExchange();
exchange.getIn().setBody("");
exchange.getIn().setHeader(HttpProducer.QUERY, "q=Camel");
try {
Modified:
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java?rev=712589&r1=712588&r2=712589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java
(original)
+++
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java
Sun Nov 9 16:56:34 2008
@@ -18,6 +18,7 @@
import javax.jms.Message;
+import org.apache.camel.Exchange;
import org.apache.camel.impl.PollingConsumerSupport;
import org.springframework.jms.core.JmsOperations;
@@ -39,15 +40,15 @@
return (JmsEndpoint)super.getEndpoint();
}
- public JmsExchange receiveNoWait() {
+ public Exchange receiveNoWait() {
return receive(0);
}
- public JmsExchange receive() {
+ public Exchange receive() {
return receive(-1);
}
- public JmsExchange receive(long timeout) {
+ public Exchange receive(long timeout) {
setReceiveTimeout(timeout);
Message message = template.receive();
if (message != null) {