Fix for AMQ-2130 to upgrade to Camel 2.0

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@746263 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2009-02-20 14:52:36 +00:00
parent ae2a3e2182
commit e24a791f6e
19 changed files with 49 additions and 47 deletions

View File

@ -20,11 +20,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
">
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- sends messages every 10 milliseconds -->

View File

@ -20,11 +20,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://activemq.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd
">
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:TEST?concurrentConsumers=1"/>

View File

@ -20,11 +20,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
">
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="dataset:myDataSet"/>

View File

@ -20,11 +20,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
">
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="dataset:myDataSet?preloadSize=50000"/>

View File

@ -80,7 +80,7 @@ public class CamelMessageProducer extends ActiveMQMessageProducerSupport {
public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
CamelDestination camelDestination = null;
if (ObjectHelper.equals(destination, this.destination)) {
if (ObjectHelper.equal(destination, this.destination)) {
camelDestination = this.destination;
} else {
// TODO support any CamelDestination?

View File

@ -148,7 +148,7 @@ public class CamelEndpointLoader implements InitializingBean, DisposableBean, Ca
String queueUri = getQueueUri(queue);
ActiveMQComponent jmsComponent = getComponent();
Endpoint endpoint = new JmsQueueEndpoint(queueUri, jmsComponent, queue.getPhysicalName(), jmsComponent.getConfiguration());
camelContext.addSingletonEndpoint(queueUri, endpoint);
camelContext.addEndpoint(queueUri, endpoint);
}
protected String getQueueUri(ActiveMQQueue queue) {
@ -157,6 +157,6 @@ public class CamelEndpointLoader implements InitializingBean, DisposableBean, Ca
protected void removeQueue(ActiveMQQueue queue) throws Exception {
String queueUri = getQueueUri(queue);
camelContext.removeSingletonEndpoint(queueUri);
camelContext.removeEndpoints(queueUri);
}
}

View File

@ -28,10 +28,10 @@ import java.util.Map;
*
* @version $Revision$
*/
public class JournalComponent extends DefaultComponent<Exchange> {
public class JournalComponent extends DefaultComponent {
@Override
protected Endpoint<Exchange> createEndpoint(String uri, String remaining, Map parameters) throws Exception {
protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
JournalEndpoint endpoint = new JournalEndpoint(uri, this, new File(remaining));
setProperties(endpoint, parameters);
return endpoint;

View File

@ -39,12 +39,12 @@ import org.apache.camel.impl.DefaultProducer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class JournalEndpoint extends DefaultEndpoint<Exchange> {
public class JournalEndpoint extends DefaultEndpoint {
private static final transient Log LOG = LogFactory.getLog(JournalEndpoint.class);
private final File directory;
private final AtomicReference<DefaultConsumer<Exchange>> consumer = new AtomicReference<DefaultConsumer<Exchange>>();
private final AtomicReference<DefaultConsumer> consumer = new AtomicReference<DefaultConsumer>();
private final Object activationMutex = new Object();
private int referenceCount;
private AsyncDataManager dataManager;
@ -72,8 +72,8 @@ public class JournalEndpoint extends DefaultEndpoint<Exchange> {
return directory;
}
public Consumer<Exchange> createConsumer(Processor processor) throws Exception {
return new DefaultConsumer<Exchange>(this, processor) {
public Consumer createConsumer(Processor processor) throws Exception {
return new DefaultConsumer(this, processor) {
@Override
public void start() throws Exception {
super.start();
@ -115,7 +115,7 @@ public class JournalEndpoint extends DefaultEndpoint<Exchange> {
}
}
protected void deactivateConsumer(DefaultConsumer<Exchange> consumer) throws IOException {
protected void deactivateConsumer(DefaultConsumer consumer) throws IOException {
synchronized (activationMutex) {
if (this.consumer.get() != consumer) {
throw new RuntimeCamelException("Consumer was not active.");
@ -130,7 +130,7 @@ public class JournalEndpoint extends DefaultEndpoint<Exchange> {
}
}
protected void activateConsumer(DefaultConsumer<Exchange> consumer) throws IOException {
protected void activateConsumer(DefaultConsumer consumer) throws IOException {
synchronized (activationMutex) {
if (this.consumer.get() != null) {
throw new RuntimeCamelException("Consumer already active: journal endpoints only support 1 active consumer");
@ -151,7 +151,7 @@ public class JournalEndpoint extends DefaultEndpoint<Exchange> {
protected void dispatchToConsumer() {
try {
DefaultConsumer<Exchange> consumer;
DefaultConsumer consumer;
while ((consumer = this.consumer.get()) != null) {
// See if there is a new record to process
Location location = dataManager.getNextLocation(lastReadLocation);
@ -184,8 +184,8 @@ public class JournalEndpoint extends DefaultEndpoint<Exchange> {
}
}
public Producer<Exchange> createProducer() throws Exception {
return new DefaultProducer<Exchange>(this) {
public Producer createProducer() throws Exception {
return new DefaultProducer(this) {
public void process(Exchange exchange) throws Exception {
incrementReference();
try {

View File

@ -23,7 +23,7 @@ import javax.naming.Context;
import org.apache.activemq.EmbeddedBrokerTestSupport;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelTemplate;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.component.mock.MockEndpoint;
@ -37,7 +37,7 @@ import org.apache.camel.util.jndi.JndiContext;
*/
public abstract class CamelEmbeddedBrokerTestSupport extends EmbeddedBrokerTestSupport {
protected CamelContext camelContext;
protected CamelTemplate<Exchange> template;
protected ProducerTemplate template;
@Override
protected void setUp() throws Exception {
@ -47,7 +47,7 @@ public abstract class CamelEmbeddedBrokerTestSupport extends EmbeddedBrokerTestS
addCamelRoutes(camelContext);
assertValidContext(camelContext);
camelContext.start();
template = new CamelTemplate<Exchange>(camelContext);
template = camelContext.createProducerTemplate();
template.start();
}

View File

@ -29,7 +29,7 @@ import javax.jms.TextMessage;
import junit.framework.Assert;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.CamelTemplate;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.impl.DefaultProducerTemplate;
import org.apache.camel.spring.SpringTestSupport;
import org.apache.commons.logging.Log;

View File

@ -37,7 +37,7 @@ public class ActiveMQConfigureTest extends ContextTestSupport {
JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo");
JmsProducer producer = endpoint.createProducer();
JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getTemplate());
JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getInOutTemplate());
assertEquals("pubSubDomain", false, template.isPubSubDomain());
assertIsInstanceOf(PooledConnectionFactory.class, template.getConnectionFactory());
}
@ -46,7 +46,7 @@ public class ActiveMQConfigureTest extends ContextTestSupport {
JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?useSingleConnection=true");
JmsProducer producer = endpoint.createProducer();
JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getTemplate());
JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getInOutTemplate());
assertEquals("pubSubDomain", false, template.isPubSubDomain());
SingleConnectionFactory connectionFactory = assertIsInstanceOf(SingleConnectionFactory.class, template.getConnectionFactory());
assertIsInstanceOf(ActiveMQConnectionFactory.class, connectionFactory.getTargetConnectionFactory());
@ -56,7 +56,7 @@ public class ActiveMQConfigureTest extends ContextTestSupport {
JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?usePooledConnection=false");
JmsProducer producer = endpoint.createProducer();
JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getTemplate());
JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getInOutTemplate());
assertEquals("pubSubDomain", false, template.isPubSubDomain());
assertIsInstanceOf(ActiveMQConnectionFactory.class, template.getConnectionFactory());
}

View File

@ -20,7 +20,7 @@ package org.apache.activemq.camel.component;
import org.apache.activemq.camel.SetHeaderTest;
import org.apache.camel.CamelContext;
import org.apache.camel.component.uface.swing.SwingBrowser;
import org.apache.camel.CamelTemplate;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -37,7 +37,7 @@ public class BrowseQueuesInUFace extends AbstractJUnit38SpringContextTests {
@Autowired
protected CamelContext camelContext;
@Autowired
protected CamelTemplate template;
protected ProducerTemplate template;
protected String[] queueNames = {"Sample.A", "Sample.B", "Sample.C"};
public void testBrowseQueues() throws Exception {

View File

@ -20,10 +20,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file://src/test/data?noop=true"/>
<to uri="activemq:testQ-input"/>

View File

@ -20,10 +20,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<template id="camelTemplate"/>
</camelContext>

View File

@ -19,11 +19,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
<!-- START SNIPPET: example -->
<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<beanPostProcessor/>
</camelContext>

View File

@ -21,7 +21,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

View File

@ -20,7 +20,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

View File

@ -20,7 +20,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

16
pom.xml
View File

@ -42,7 +42,7 @@
<aopalliance-version>1.0</aopalliance-version>
<axion-version>1.0-M3-dev</axion-version>
<axis-version>1.2-RC1</axis-version>
<camel-version>1.6.0</camel-version>
<camel-version>2.0-SNAPSHOT</camel-version>
<cglib-version>2.0</cglib-version>
<commons-beanutils-version>1.6.1</commons-beanutils-version>
<commons-collections-version>3.1</commons-collections-version>
@ -395,6 +395,12 @@
<artifactId>camel-jms</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-web</artifactId>
<version>${camel-version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.apache.hadoop.zookeeper</groupId>
@ -407,22 +413,18 @@
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.0</version>
<version>2.1</version>
<exclusions>
<exclusion>
<groupId>javax.xml</groupId>
<artifactId>jsr173</artifactId>
</exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.0.3</version>
<version>2.1.6</version>
<exclusions>
<exclusion>
<groupId>javax.jws</groupId>