svn commit: r663796 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/test/java/org/apache/camel/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/tran...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r663796 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/test/java/org/apache/camel/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/tran...

hadrian-3
Author: hadrian
Date: Thu Jun  5 18:25:25 2008
New Revision: 663796

URL: http://svn.apache.org/viewvc?rev=663796&view=rev
Log:
fix CAMEL-527.  Moved CamelTemplate back to o.a.c. but deprecated it.  The preferred way moving forward is to use ProducerTemplate.  See comments.

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java
      - copied, changed from r663723, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelTemplate.java
Removed:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelTemplate.java
Modified:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
    activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcRouteTest.java
    activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
    activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
    activemq/camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/SpringJXPathFilterTest.java
    activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelTemplateFactoryBean.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DependencyInjectCamelTemplateTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/NamespacePrefixTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/TemplateUsingBean.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/managment/CamelChoiceWithManagementTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java
    activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java
    activemq/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java
    activemq/camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java
    activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java

Copied: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java (from r663723, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelTemplate.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java?p2=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelTemplate.java&r1=663723&r2=663796&rev=663796&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelTemplate.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelTemplate.java Thu Jun  5 18:25:25 2008
@@ -14,22 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.impl;
+package org.apache.camel;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.AsyncCallback;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.Message;
-import org.apache.camel.NoSuchEndpointException;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.impl.DefaultProducerTemplate;
 
 /**
  * A client helper object (named like Spring's TransactionTemplate & JmsTemplate
@@ -39,284 +26,13 @@
  * @version $Revision$
  * @deprecated use {@link ProducerTemplate} instead, can be created using {@link org.apache.camel.CamelContext#createProducerTemplate()}.
  */
-public class CamelTemplate<E extends Exchange> extends ServiceSupport implements ProducerTemplate<E> {
-    private CamelContext context;
-    private final ProducerCache<E> producerCache = new ProducerCache<E>();
-    private boolean useEndpointCache = true;
-    private final Map<String, Endpoint<E>> endpointCache = new HashMap<String, Endpoint<E>>();
-    private Endpoint<E> defaultEndpoint;
+public class CamelTemplate<E extends Exchange> extends DefaultProducerTemplate<E> {
 
     public CamelTemplate(CamelContext context) {
-        this.context = context;
+        super(context);
     }
 
     public CamelTemplate(CamelContext context, Endpoint defaultEndpoint) {
-        this(context);
-        this.defaultEndpoint = defaultEndpoint;
-    }
-
-    public E send(String endpointUri, E exchange) {
-        Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
-        return send(endpoint, exchange);
-    }
-
-    public E send(String endpointUri, Processor processor) {
-        Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
-        return send(endpoint, processor);
-    }
-
-    public E send(String endpointUri, Processor processor, AsyncCallback callback) {
-        Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
-        return send(endpoint, processor, callback);
-    }
-
-    public E send(String endpointUri, ExchangePattern pattern, Processor processor) {
-        Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
-        return send(endpoint, pattern, processor);
-    }
-
-    public E send(Endpoint<E> endpoint, E exchange) {
-        //E convertedExchange = endpoint.createExchange(exchange);
-        E convertedExchange = exchange;
-        producerCache.send(endpoint, convertedExchange);
-        return convertedExchange;
-    }
-
-    public E send(Endpoint<E> endpoint, Processor processor) {
-        return producerCache.send(endpoint, processor);
-    }
-
-    public E send(Endpoint<E> endpoint, Processor processor, AsyncCallback callback) {
-        return producerCache.send(endpoint, processor, callback);
-    }
-
-    public E send(Endpoint<E> endpoint, ExchangePattern pattern, Processor processor) {
-        return producerCache.send(endpoint, pattern, processor);
-    }
-
-    public Object sendBody(Endpoint<E> endpoint, ExchangePattern pattern, Object body) {
-        E result = send(endpoint, pattern, createSetBodyProcessor(body));
-        return extractResultBody(result);
-    }
-
-    public Object sendBody(Endpoint<E> endpoint, Object body) {
-        E result = send(endpoint, createSetBodyProcessor(body));
-        return extractResultBody(result);
+        super(context, defaultEndpoint);
     }
-
-    public Object sendBody(String endpointUri, Object body) {
-        Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
-        return sendBody(endpoint, body);
-    }
-
-    public Object sendBody(String endpointUri, ExchangePattern pattern, Object body) {
-        Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
-        return sendBody(endpoint, pattern, body);
-    }
-
-    public Object sendBodyAndHeader(String endpointUri, final Object body, final String header,
-            final Object headerValue) {
-        return sendBodyAndHeader(resolveMandatoryEndpoint(endpointUri), body, header, headerValue);
-    }
-
-    public Object sendBodyAndHeader(Endpoint 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,
-            final Object headerValue) {
-        E result = send(endpoint, pattern, createBodyAndHeaderProcessor(body, header, headerValue));
-        return extractResultBody(result);
-    }
-
-    public Object sendBodyAndHeader(String endpoint, ExchangePattern pattern, final Object body, final String header,
-            final Object headerValue) {
-        E result = send(endpoint, pattern, createBodyAndHeaderProcessor(body, header, headerValue));
-        return extractResultBody(result);
-    }
-
-    public Object sendBodyAndHeaders(String endpointUri, final Object body, final Map<String, Object> headers) {
-        return sendBodyAndHeaders(resolveMandatoryEndpoint(endpointUri), body, headers);
-    }
-
-    public Object sendBodyAndHeaders(Endpoint endpoint, final Object body, final Map<String, Object> headers) {
-        E result = send(endpoint, new Processor() {
-            public void process(Exchange exchange) {
-                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
-    // -----------------------------------------------------------------------
-
-    public E request(Endpoint<E> endpoint, Processor processor) {
-        return send(endpoint, ExchangePattern.InOut, processor);
-    }
-
-    public Object requestBody(Endpoint<E> endpoint, Object body) {
-        return sendBody(endpoint, ExchangePattern.InOut, body);
-    }
-
-    public Object requestBodyAndHeader(Endpoint<E> endpoint, Object body, String header, Object headerValue) {
-        return sendBodyAndHeader(endpoint, ExchangePattern.InOut, body, header, headerValue);
-    }
-
-    public E request(String endpoint, Processor processor) {
-        return send(endpoint, ExchangePattern.InOut, processor);
-    }
-
-    public Object requestBody(String endpoint, Object body) {
-        return sendBody(endpoint, ExchangePattern.InOut, body);
-    }
-
-    public Object requestBodyAndHeader(String endpoint, Object body, String header, Object headerValue) {
-        return sendBodyAndHeader(endpoint, ExchangePattern.InOut, body, header, headerValue);
-    }
-
-    // Methods using the default endpoint
-    // -----------------------------------------------------------------------
-
-    public Object sendBody(Object body) {
-        return sendBody(getMandatoryDefaultEndpoint(), body);
-    }
-
-    public E send(E exchange) {
-        return send(getMandatoryDefaultEndpoint(), exchange);
-    }
-
-    public E send(Processor processor) {
-        return send(getMandatoryDefaultEndpoint(), processor);
-    }
-
-    public Object sendBodyAndHeader(Object body, String header, Object headerValue) {
-        return sendBodyAndHeader(getMandatoryDefaultEndpoint(), body, header, headerValue);
-    }
-
-    public Object sendBodyAndHeaders(Object body, Map<String, Object> headers) {
-        return sendBodyAndHeaders(getMandatoryDefaultEndpoint(), body, headers);
-    }
-
-    // Properties
-    // -----------------------------------------------------------------------
-    public Producer<E> getProducer(Endpoint<E> endpoint) {
-        return producerCache.getProducer(endpoint);
-    }
-
-    public CamelContext getContext() {
-        return context;
-    }
-
-    public Endpoint<E> getDefaultEndpoint() {
-        return defaultEndpoint;
-    }
-
-    public void setDefaultEndpoint(Endpoint<E> defaultEndpoint) {
-        this.defaultEndpoint = defaultEndpoint;
-    }
-
-    /**
-     * Sets the default endpoint to use if none is specified
-     */
-    public void setDefaultEndpointUri(String endpointUri) {
-        setDefaultEndpoint(getContext().getEndpoint(endpointUri));
-    }
-
-    public boolean isUseEndpointCache() {
-        return useEndpointCache;
-    }
-
-    public void setUseEndpointCache(boolean useEndpointCache) {
-        this.useEndpointCache = useEndpointCache;
-    }
-
-    public <T extends Endpoint<?>> T getResolvedEndpoint(String endpointUri, Class<T> expectedClass) {
-        Endpoint<?> e = null;
-        synchronized (endpointCache) {
-            e = endpointCache.get(endpointUri);
-        }
-        if (e != null && expectedClass.isAssignableFrom(e.getClass())) {
-            return expectedClass.asSubclass(expectedClass).cast(e);
-        }
-        return null;
-    }
-    
-    // Implementation methods
-    // -----------------------------------------------------------------------
-
-    protected Processor createBodyAndHeaderProcessor(final Object body, final String header, final Object headerValue) {
-        return new Processor() {
-            public void process(Exchange exchange) {
-                Message in = exchange.getIn();
-                in.setHeader(header, headerValue);
-                in.setBody(body);
-            }
-        };
-    }
-
-    protected Processor createSetBodyProcessor(final Object body) {
-        return new Processor() {
-            public void process(Exchange exchange) {
-                Message in = exchange.getIn();
-                in.setBody(body);
-            }
-        };
-    }
-
-    protected Endpoint resolveMandatoryEndpoint(String endpointUri) {
-        Endpoint endpoint = null;
-
-        if (isUseEndpointCache()) {
-            synchronized (endpointCache) {
-                endpoint = endpointCache.get(endpointUri);
-                if (endpoint == null) {
-                    endpoint = context.getEndpoint(endpointUri);
-                    if (endpoint != null) {
-                        endpointCache.put(endpointUri, endpoint);
-                    }
-                }
-            }
-        } else {
-            endpoint = context.getEndpoint(endpointUri);
-        }
-        if (endpoint == null) {
-            throw new NoSuchEndpointException(endpointUri);
-        }
-        return endpoint;
-    }
-
-    protected Endpoint<E> getMandatoryDefaultEndpoint() {
-        Endpoint<E> answer = getDefaultEndpoint();
-        ObjectHelper.notNull(answer, "defaultEndpoint");
-        return answer;
-    }
-
-    protected void doStart() throws Exception {
-        producerCache.start();
-    }
-
-    protected void doStop() throws Exception {
-        producerCache.stop();
-    }
-
-    protected Object extractResultBody(E result) {
-        Object answer = null;
-        if (result != null) {
-            Message out = result.getOut(false);
-            if (out != null) {
-                answer = out.getBody();
-            } else {
-                answer = result.getIn().getBody();
-            }
-        }
-        return answer;
-    }
-
 }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java Thu Jun  5 18:25:25 2008
@@ -30,7 +30,7 @@
 
 /**
  * A useful base class which creates a {@link CamelContext} with some routes
- * along with a {@link CamelTemplate} for use in the test case
+ * along with a {@link ProducerTemplate} for use in the test case
  *
  * @version $Revision$
  */

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java Thu Jun  5 18:25:25 2008
@@ -25,9 +25,9 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.cxf.CxfConstants;
 import org.apache.camel.component.cxf.CxfSoapBinding;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
@@ -51,7 +51,7 @@
     private CamelContext camelContext;
     private EndpointInfo endpointInfo;
     private String targetCamelEndpointUri;
-    private CamelTemplate<Exchange> camelTemplate;
+    private ProducerTemplate<Exchange> camelTemplate;
     private Bus bus;
 
     public CamelConduit(CamelContext context, Bus b, EndpointInfo endpointInfo) {
@@ -113,20 +113,18 @@
         }
     }
 
-    public CamelTemplate getCamelTemplate() {
+    public ProducerTemplate<Exchange> getCamelTemplate() {
         if (camelTemplate == null) {
-            if (camelContext != null) {
-                camelTemplate = new CamelTemplate<Exchange>(camelContext);
-            } else {
-                camelTemplate = new CamelTemplate<Exchange>(new DefaultCamelContext());
-            }
+         CamelContext ctx = camelContext != null ? camelContext : new DefaultCamelContext();
+         camelTemplate = ctx.createProducerTemplate();
         }
         return camelTemplate;
     }
 
-    public void setCamelTemplate(CamelTemplate<Exchange> template) {
+    public void setCamelTemplate(ProducerTemplate<Exchange> template) {
         camelTemplate = template;
     }
+    
     private class CamelOutputStream extends CachedOutputStream {
         private Message outMessage;
         private boolean isOneWay;

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java Thu Jun  5 18:25:25 2008
@@ -26,9 +26,9 @@
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.cxf.CxfConstants;
 import org.apache.camel.component.cxf.CxfSoapBinding;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
@@ -56,7 +56,7 @@
     CamelContext camelContext;
     Consumer consumer;
     String camelDestinationUri;
-    private CamelTemplate<Exchange> camelTemplate;
+    private ProducerTemplate<Exchange> camelTemplate;
     private Endpoint distinationEndpoint;
 
     public CamelDestination(CamelContext camelContext, Bus bus, ConduitInitiator ci, EndpointInfo info) throws IOException {
@@ -112,18 +112,15 @@
         this.deactivate();
     }
 
-    public CamelTemplate getCamelTemplate() {
+    public ProducerTemplate<Exchange> getCamelTemplate() {
         if (camelTemplate == null) {
-            if (camelContext != null) {
-                camelTemplate = new CamelTemplate<Exchange>(camelContext);
-            } else {
-                camelTemplate = new CamelTemplate<Exchange>(new DefaultCamelContext());
-            }
+         CamelContext ctx = camelContext != null ? camelContext : new DefaultCamelContext();
+         camelTemplate = ctx.createProducerTemplate();
         }
         return camelTemplate;
     }
 
-    public void setCamelTemplate(CamelTemplate<Exchange> template) {
+    public void setCamelTemplate(ProducerTemplate<Exchange> template) {
         camelTemplate = template;
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java Thu Jun  5 18:25:25 2008
@@ -23,10 +23,11 @@
 import javax.xml.ws.Endpoint;
 
 import junit.framework.TestCase;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.impl.CamelTemplate;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -50,7 +51,7 @@
     private static final transient Log LOG = LogFactory.getLog(CxfProducerTest.class);
 
     protected CamelContext camelContext = new DefaultCamelContext();
-    protected CamelTemplate<CxfExchange> template = new CamelTemplate<CxfExchange>(camelContext);
+    protected ProducerTemplate<CxfExchange> template = camelContext.createProducerTemplate();
 
     private ServerImpl simpleServer;
     private Endpoint jaxwsEndpoint;

Modified: activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcRouteTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcRouteTest.java (original)
+++ activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcRouteTest.java Thu Jun  5 18:25:25 2008
@@ -24,11 +24,12 @@
 import javax.sql.DataSource;
 
 import junit.framework.TestCase;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.util.jndi.JndiContext;
 
@@ -64,7 +65,7 @@
 
         // START SNIPPET: invoke
         Endpoint<Exchange> endpoint = camelContext.getEndpoint("direct:hello");
-        CamelTemplate<Exchange> template = new CamelTemplate<Exchange>(camelContext);
+        ProducerTemplate<Exchange> template = camelContext.createProducerTemplate();
         Exchange exchange = endpoint.createExchange();
         exchange.getIn().setBody("select * from customer");
         Exchange out = template.send(endpoint, exchange);

Modified: activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java Thu Jun  5 18:25:25 2008
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.component.jpa;
 
+import static org.apache.camel.util.ServiceHelper.startServices;
+import static org.apache.camel.util.ServiceHelper.stopServices;
+
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -30,25 +33,21 @@
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.examples.SendEmail;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.springframework.orm.jpa.JpaCallback;
 import org.springframework.orm.jpa.JpaTemplate;
 
-import static org.apache.camel.util.ServiceHelper.startServices;
-import static org.apache.camel.util.ServiceHelper.stopServices;
-
 /**
  * @version $Revision$
  */
 public class JpaTest extends TestCase {
     private static final transient Log LOG = LogFactory.getLog(JpaTest.class);
     protected CamelContext camelContext = new DefaultCamelContext();
-    protected CamelTemplate template = new CamelTemplate(camelContext);
+    protected ProducerTemplate template = camelContext.createProducerTemplate();
     protected JpaEndpoint endpoint;
     protected TransactionStrategy transactionStrategy;
     protected JpaTemplate jpaTemplate;

Modified: activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java (original)
+++ activemq/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java Thu Jun  5 18:25:25 2008
@@ -30,13 +30,12 @@
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.examples.MultiSteps;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.util.ServiceHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.springframework.orm.jpa.JpaCallback;
 import org.springframework.orm.jpa.JpaTemplate;
 
@@ -46,7 +45,7 @@
 public class JpaWithNamedQueryTest extends TestCase {
     private static final transient Log LOG = LogFactory.getLog(JpaWithNamedQueryTest.class);
     protected CamelContext camelContext = new DefaultCamelContext();
-    protected CamelTemplate template = new CamelTemplate(camelContext);
+    protected ProducerTemplate template = camelContext.createProducerTemplate();
     protected JpaEndpoint endpoint;
     protected TransactionStrategy transactionStrategy;
     protected JpaTemplate jpaTemplate;

Modified: activemq/camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/SpringJXPathFilterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/SpringJXPathFilterTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/SpringJXPathFilterTest.java (original)
+++ activemq/camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/SpringJXPathFilterTest.java Thu Jun  5 18:25:25 2008
@@ -17,8 +17,8 @@
 package org.apache.camel.language.jxpath;
 
 import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.CamelTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
@@ -29,7 +29,7 @@
 @ContextConfiguration
 public class SpringJXPathFilterTest extends AbstractJUnit38SpringContextTests {
     @Autowired
-    protected CamelTemplate template;
+    protected ProducerTemplate template;
     @EndpointInject(uri = "mock:results")
     protected MockEndpoint endpoint;
 

Modified: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java (original)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java Thu Jun  5 18:25:25 2008
@@ -16,12 +16,13 @@
  */
 package org.apache.camel.component.spring.integration.adapter;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.spring.integration.SpringIntegrationBinding;
 import org.apache.camel.component.spring.integration.SpringIntegrationExchange;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -38,16 +39,16 @@
 public class CamelTargetAdapter extends AbstractCamelAdapter {
 
     private final Log logger = LogFactory.getLog(this.getClass());
-    private CamelTemplate<Exchange> camelTemplate;
+    private ProducerTemplate<Exchange> camelTemplate;
     private Endpoint camelEndpoint;
 
-    public CamelTemplate<Exchange> getCamelTemplate() {
+    public ProducerTemplate<Exchange> getCamelTemplate() {
         if (camelTemplate == null) {
-            if (getCamelContext() != null) {
-                camelTemplate = new CamelTemplate<Exchange>(getCamelContext());
-            } else {
-                camelTemplate = new CamelTemplate<Exchange>(new DefaultCamelContext());
-            }
+         CamelContext ctx = getCamelContext();
+         if (ctx == null) {
+         ctx = new DefaultCamelContext();
+         }
+         camelTemplate = ctx.createProducerTemplate();
         }
         return camelTemplate;
     }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java Thu Jun  5 18:25:25 2008
@@ -35,7 +35,7 @@
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.Service;
 import org.apache.camel.component.bean.BeanProcessor;
-import org.apache.camel.impl.CamelTemplate;
+import org.apache.camel.impl.DefaultProducerTemplate;
 import org.apache.camel.spring.util.ReflectionUtils;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
@@ -220,8 +220,8 @@
                 return endpoint;
             } else if (type.isAssignableFrom(Producer.class)) {
                 return createInjectionProducer(endpoint);
-            } else if (type.isAssignableFrom(CamelTemplate.class)) {
-                return new CamelTemplate(getCamelContext(), endpoint);
+            } else if (type.isAssignableFrom(DefaultProducerTemplate.class)) {
+                return new DefaultProducerTemplate(getCamelContext(), endpoint);
             } else if (type.isAssignableFrom(PollingConsumer.class)) {
                 return createInjectionPollingConsumer(endpoint);
             } else {

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelTemplateFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelTemplateFactoryBean.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelTemplateFactoryBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelTemplateFactoryBean.java Thu Jun  5 18:25:25 2008
@@ -25,13 +25,13 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.CamelTemplate;
+import org.apache.camel.impl.DefaultProducerTemplate;
 import org.apache.camel.model.IdentifiedType;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.InitializingBean;
 
 /**
- * A Spring {@link FactoryBean} for creating a new {@link CamelTemplate}
+ * A Spring {@link FactoryBean} for creating a new {@link ProducerTemplate}
  * instance with a minimum of XML
  *
  * @version $Revision$
@@ -57,14 +57,14 @@
             if (endpoint == null) {
                 throw new IllegalArgumentException("No endpoint found for URI: " + defaultEndpoint);
             } else {
-                return new CamelTemplate(context, endpoint);
+                return new DefaultProducerTemplate(context, endpoint);
             }
         }
-        return new CamelTemplate(context);
+        return new DefaultProducerTemplate(context);
     }
 
     public Class getObjectType() {
-        return CamelTemplate.class;
+        return DefaultProducerTemplate.class;
     }
 
     public boolean isSingleton() {

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java Thu Jun  5 18:25:25 2008
@@ -28,8 +28,8 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.model.RouteType;
 import org.apache.camel.processor.interceptor.Debugger;
@@ -63,7 +63,7 @@
     private List<SpringCamelContext> camelContexts = new ArrayList<SpringCamelContext>();
     private AbstractApplicationContext parentApplicationContext;
     private String parentApplicationContextUri;
-    private CamelTemplate camelTemplate;
+    private ProducerTemplate camelTemplate;
 
     public Main() {
         addOption(new Option("h", "help", "Displays the help screen") {
@@ -391,12 +391,12 @@
     }
 
     /**
-     * Returns a {@link CamelTemplate} from the Spring {@link ApplicationContext} instances
+     * Returns a {@link ProducerTemplate} from the Spring {@link ApplicationContext} instances
      * or lazily creates a new one dynamically
      *
      * @return
      */
-    public CamelTemplate getCamelTemplate() {
+    public ProducerTemplate getCamelTemplate() {
         if (camelTemplate == null) {
             camelTemplate = findOrCreateCamelTemplate();
         }
@@ -405,15 +405,15 @@
 
     // Implementation methods
     // -------------------------------------------------------------------------
-    protected CamelTemplate findOrCreateCamelTemplate() {
-        String[] names = getApplicationContext().getBeanNamesForType(CamelTemplate.class);
+    protected ProducerTemplate findOrCreateCamelTemplate() {
+        String[] names = getApplicationContext().getBeanNamesForType(ProducerTemplate.class);
         if (names != null && names.length > 0) {
-            return (CamelTemplate) getApplicationContext().getBean(names[0], CamelTemplate.class);
+            return (ProducerTemplate) getApplicationContext().getBean(names[0], ProducerTemplate.class);
         }
         for (SpringCamelContext camelContext : camelContexts) {
-            return new CamelTemplate(camelContext);
+            return camelContext.createProducerTemplate();
         }
-        throw new IllegalArgumentException("No CamelContexts are available so cannot create a CamelTemplate!");
+        throw new IllegalArgumentException("No CamelContexts are available so cannot create a ProducerTemplate!");
     }
 
     protected void doStart() throws Exception {

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java Thu Jun  5 18:25:25 2008
@@ -19,7 +19,7 @@
 import javax.annotation.Resource;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.CamelTemplate;
+import org.apache.camel.ProducerTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
@@ -30,7 +30,7 @@
 @ContextConfiguration
 public class BeanRouteUsingSpringEndpointTest extends AbstractJUnit38SpringContextTests {
     @Autowired
-    protected CamelTemplate template;
+    protected ProducerTemplate template;
     @Resource
     protected Endpoint helloEndpoint;
     @Resource

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java Thu Jun  5 18:25:25 2008
@@ -20,10 +20,10 @@
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.TestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.hamcrest.Assertions;
-import org.apache.camel.impl.CamelTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
@@ -35,7 +35,7 @@
 public class SpringFileRouteTest extends AbstractJUnit38SpringContextTests {
     protected String expectedBody = "Hello World!";
     @Autowired
-    protected CamelTemplate template;
+    protected ProducerTemplate template;
     @Autowired
     protected Endpoint inputFile;
     @EndpointInject(uri = "mock:result")

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java Thu Jun  5 18:25:25 2008
@@ -21,11 +21,10 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.Route;
 import org.apache.camel.TestSupport;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.spring.example.MyProcessor;
-
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -43,7 +42,7 @@
         assertValidContext(context);
 
         // now lets send a message
-        CamelTemplate<Exchange> template = new CamelTemplate<Exchange>(context);
+        ProducerTemplate<Exchange> template = context.createProducerTemplate();
         template.send("direct:start", new Processor() {
             public void process(Exchange exchange) {
                 Message in = exchange.getIn();

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java Thu Jun  5 18:25:25 2008
@@ -18,11 +18,11 @@
 
 import java.util.List;
 
+import org.apache.camel.CamelTemplate;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Route;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.spring.example.DummyBean;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java Thu Jun  5 18:25:25 2008
@@ -16,12 +16,12 @@
  */
 package org.apache.camel.spring;
 
+
 import org.apache.camel.Endpoint;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.Producer;
 import org.apache.camel.ProducerTemplate;
-import org.apache.camel.impl.CamelTemplate;
 
 /**
  * @version $Revision$
@@ -34,8 +34,8 @@
     private Producer fieldInjectedProducer;
     private Producer propertyInjectedProducer;
     @EndpointInject(uri = "direct:fieldInjectedCamelTemplate")
-    private CamelTemplate fieldInjectedCamelTemplate;
-    private CamelTemplate propertyInjectedCamelTemplate;
+    private ProducerTemplate fieldInjectedCamelTemplate;
+    private ProducerTemplate propertyInjectedCamelTemplate;
     @EndpointInject
     private ProducerTemplate injectByFieldName;
     private ProducerTemplate injectByPropertyName;
@@ -76,16 +76,16 @@
 
     // CamelTemplate
     //-----------------------------------------------------------------------
-    public CamelTemplate getFieldInjectedCamelTemplate() {
+    public ProducerTemplate getFieldInjectedCamelTemplate() {
         return fieldInjectedCamelTemplate;
     }
 
-    public CamelTemplate getPropertyInjectedCamelTemplate() {
+    public ProducerTemplate getPropertyInjectedCamelTemplate() {
         return propertyInjectedCamelTemplate;
     }
 
     @EndpointInject(uri = "direct:propertyInjectedCamelTemplate")
-    public void setPropertyInjectedCamelTemplate(CamelTemplate propertyInjectedCamelTemplate) {
+    public void setPropertyInjectedCamelTemplate(ProducerTemplate propertyInjectedCamelTemplate) {
         this.propertyInjectedCamelTemplate = propertyInjectedCamelTemplate;
     }
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java Thu Jun  5 18:25:25 2008
@@ -21,11 +21,10 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.Route;
 import org.apache.camel.TestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.CamelTemplate;
-
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -46,7 +45,7 @@
         resultEndpoint.expectedBodiesReceived(body);
 
         // now lets send a message
-        CamelTemplate<Exchange> template = new CamelTemplate<Exchange>(context);
+        ProducerTemplate<Exchange> template = context.createProducerTemplate();
         template.send("seda:start", new Processor() {
             public void process(Exchange exchange) {
                 Message in = exchange.getIn();

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DependencyInjectCamelTemplateTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DependencyInjectCamelTemplateTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DependencyInjectCamelTemplateTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/DependencyInjectCamelTemplateTest.java Thu Jun  5 18:25:25 2008
@@ -17,8 +17,8 @@
 package org.apache.camel.spring.config;
 
 import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.CamelTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
@@ -40,7 +40,7 @@
 
     public void testBeanHasCamelTemplateInjected() throws Exception {
         assertNotNull("Bean should be injected", bean);
-        CamelTemplate template = bean.getTemplate();
+        ProducerTemplate template = bean.getTemplate();
         assertNotNull("Bean should have a CamelTemplate", template);
 
         endpoint.expectedBodiesReceived(body);

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/NamespacePrefixTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/NamespacePrefixTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/NamespacePrefixTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/NamespacePrefixTest.java Thu Jun  5 18:25:25 2008
@@ -17,8 +17,8 @@
 package org.apache.camel.spring.config;
 
 import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.CamelTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
@@ -31,7 +31,7 @@
     protected String body = "Hello";
 
     @Autowired
-    private CamelTemplate template;
+    private ProducerTemplate template;
 
     @EndpointInject(uri = "mock:results")
     private MockEndpoint endpoint;

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/TemplateUsingBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/TemplateUsingBean.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/TemplateUsingBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/TemplateUsingBean.java Thu Jun  5 18:25:25 2008
@@ -16,19 +16,19 @@
  */
 package org.apache.camel.spring.config;
 
-import org.apache.camel.impl.CamelTemplate;
+import org.apache.camel.ProducerTemplate;
 
 /**
  * @version $Revision$
  */
 public class TemplateUsingBean {
-    private CamelTemplate template;
+    private ProducerTemplate template;
 
-    public CamelTemplate getTemplate() {
+    public ProducerTemplate getTemplate() {
         return template;
     }
 
-    public void setTemplate(CamelTemplate template) {
+    public void setTemplate(ProducerTemplate template) {
         this.template = template;
     }
 }

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java Thu Jun  5 18:25:25 2008
@@ -19,9 +19,7 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.CamelTemplate;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -32,7 +30,7 @@
         super.setUp();
         ApplicationContext c = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/scan/componentScan.xml");
         context = (CamelContext)c.getBean("camelContext");
-        template = new CamelTemplate<Exchange>(context);
+        template = context.createProducerTemplate();
 
     }
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java Thu Jun  5 18:25:25 2008
@@ -19,8 +19,9 @@
 import java.util.List;
 
 import junit.framework.TestCase;
+
 import org.apache.camel.Exchange;
-import org.apache.camel.impl.CamelTemplate;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.model.RouteType;
 import org.apache.camel.processor.interceptor.DebugInterceptor;
 import org.apache.camel.processor.interceptor.Debugger;
@@ -61,7 +62,7 @@
         assertEquals("Number of routes", 1, routes.size());
 
         // now lets send a message
-        CamelTemplate template = main.getCamelTemplate();
+        ProducerTemplate template = main.getCamelTemplate();
         template.sendBody("direct:a", expectedBody);
 
         List<Exchange> o1Messages = o1.getExchanges();

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java Thu Jun  5 18:25:25 2008
@@ -18,7 +18,7 @@
 
 import org.apache.camel.EndpointInject;
 import org.apache.camel.MessageDriven;
-import org.apache.camel.impl.CamelTemplate;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -31,7 +31,7 @@
 public class MyConsumer {
     private static final Log LOG = LogFactory.getLog(MyConsumer.class);
     @EndpointInject(uri = "mock:result")
-    private CamelTemplate destination;
+    private ProducerTemplate destination;
 
     @MessageDriven(uri = "direct:start")
     public void doSomething(String body) {
@@ -41,11 +41,11 @@
         destination.sendBody(body);
     }
 
-    public CamelTemplate getDestination() {
+    public ProducerTemplate getDestination() {
         return destination;
     }
 
-    public void setDestination(CamelTemplate destination) {
+    public void setDestination(ProducerTemplate destination) {
         this.destination = destination;
     }
 }

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/managment/CamelChoiceWithManagementTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/managment/CamelChoiceWithManagementTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/managment/CamelChoiceWithManagementTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/managment/CamelChoiceWithManagementTest.java Thu Jun  5 18:25:25 2008
@@ -17,18 +17,15 @@
 package org.apache.camel.spring.managment;
 
 
-import junit.framework.Assert;
+import static org.apache.camel.component.mock.MockEndpoint.expectsMessageCount;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.spring.SpringInstrumentationAgent;
 
-import static org.apache.camel.component.mock.MockEndpoint.expectsMessageCount;
-
 /**
  * @version $Revision$
  */
@@ -45,7 +42,7 @@
         assertValidContext(context);
 
 
-        template = new CamelTemplate<Exchange>(context);
+        template = context.createProducerTemplate();
         agent = new SpringInstrumentationAgent();
         agent.setCamelContext(context);
         agent.enableJmx();

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java Thu Jun  5 18:25:25 2008
@@ -17,8 +17,8 @@
 package org.apache.camel.spring.processor;
 
 import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.CamelTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
@@ -33,7 +33,7 @@
     protected MockEndpoint resultEndpoint;
 
     @Autowired
-    protected CamelTemplate template;
+    protected ProducerTemplate template;
 
 
     public void testXslt() throws Exception {

Modified: activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java (original)
+++ activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/CamelCxfExample.java Thu Jun  5 18:25:25 2008
@@ -17,12 +17,12 @@
 package org.apache.camel.example.cxf;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.CamelTemplate;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.example.jms.JmsBroker;
 
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 
 /**

Modified: activemq/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java (original)
+++ activemq/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java Thu Jun  5 18:25:25 2008
@@ -22,9 +22,9 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 
 /**
@@ -67,7 +67,7 @@
         // END SNIPPET: e3
         // Camel template - a handy class for kicking off exchanges
         // START SNIPPET: e4
-        CamelTemplate template = new CamelTemplate(context);
+        ProducerTemplate template = context.createProducerTemplate();
         // END SNIPPET: e4
         // Now everything is set up - lets start the context
         context.start();

Modified: activemq/camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java (original)
+++ activemq/camel/trunk/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/Client.java Thu Jun  5 18:25:25 2008
@@ -22,9 +22,9 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.impl.CamelTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
 
 public class Client extends RouteBuilder {
@@ -38,7 +38,7 @@
 
         context.addRoutes(new Client());
 
-        CamelTemplate template = new CamelTemplate(context);
+        ProducerTemplate template = context.createProducerTemplate();
 
         context.start();
         for (int i = 0; i < 2; i++) {

Modified: activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java?rev=663796&r1=663795&r2=663796&view=diff
==============================================================================
--- activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java (original)
+++ activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java Thu Jun  5 18:25:25 2008
@@ -17,8 +17,8 @@
 package org.apache.camel.example.client;
 
 import org.apache.camel.ExchangePattern;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.jms.JmsExchange;
-import org.apache.camel.impl.CamelTemplate;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -36,7 +36,7 @@
     public static void main(final String[] args) {
 
         ApplicationContext context = new ClassPathXmlApplicationContext("camel-client.xml");
-        CamelTemplate<JmsExchange> camelTemplate = (CamelTemplate)context.getBean("camelTemplate");
+        ProducerTemplate<JmsExchange> camelTemplate = (ProducerTemplate)context.getBean("camelTemplate");
 
         int response = (Integer)camelTemplate.sendBody("jms:queue:numbers", ExchangePattern.InOut, 22);
         System.out.println("Invoking the multiply with 22, the result is " + response);