diff --git a/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java b/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java index 047604cda4..a36e0735b9 100644 --- a/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java +++ b/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java @@ -17,18 +17,17 @@ package org.apache.activemq.camel.component; import java.net.URISyntaxException; -import java.util.*; +import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; +import javax.jms.Connection; + import org.apache.activemq.EnhancedConnection; import org.apache.activemq.Service; import org.apache.activemq.advisory.DestinationSource; -import org.apache.activemq.command.ActiveMQDestination; import org.apache.camel.CamelContext; -import org.apache.camel.ComponentConfiguration; import org.apache.camel.component.jms.JmsComponent; import org.apache.camel.component.jms.JmsConfiguration; -import org.apache.camel.spi.EndpointCompleter; import org.apache.camel.util.IntrospectionSupport; import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.URISupport; @@ -37,23 +36,20 @@ import org.slf4j.LoggerFactory; import org.springframework.jms.connection.SingleConnectionFactory; import org.springframework.jms.core.JmsTemplate; -import javax.jms.Connection; - /** * The ActiveMQ Component */ -public class ActiveMQComponent extends JmsComponent implements EndpointCompleter { +public class ActiveMQComponent extends JmsComponent { private final CopyOnWriteArrayList singleConnectionFactoryList = - new CopyOnWriteArrayList(); + new CopyOnWriteArrayList(); private final CopyOnWriteArrayList pooledConnectionFactoryServiceList = - new CopyOnWriteArrayList(); + new CopyOnWriteArrayList(); private static final transient Logger LOG = LoggerFactory.getLogger(ActiveMQComponent.class); private boolean exposeAllQueues; private CamelEndpointLoader endpointLoader; private EnhancedConnection connection; DestinationSource source; - boolean sourceInitialized = false; /** * Creates an ActiveMQ Component @@ -103,14 +99,6 @@ public class ActiveMQComponent extends JmsComponent implements EndpointCompleter } } - /** - * @deprecated - use JmsComponent#setUsername(String) - * @see JmsComponent#setUsername(String) - */ - public void setUserName(String userName) { - setUsername(userName); - } - public void setTrustAllPackages(boolean trustAllPackages) { if (getConfiguration() instanceof ActiveMQConfiguration) { ((ActiveMQConfiguration)getConfiguration()).setTrustAllPackages(trustAllPackages); @@ -258,34 +246,4 @@ public class ActiveMQComponent extends JmsComponent implements EndpointCompleter return answer; } - @Override - public List completeEndpointPath(ComponentConfiguration componentConfiguration, String completionText) { - // try to initialize destination source only the first time - if (!sourceInitialized) { - createDestinationSource(); - sourceInitialized = true; - } - ArrayList answer = new ArrayList(); - if (source != null) { - Set candidates = source.getQueues(); - String destinationName = completionText; - if (completionText.startsWith("topic:")) { - candidates = source.getTopics(); - destinationName = completionText.substring(6); - } else if (completionText.startsWith("queue:")) { - destinationName = completionText.substring(6); - } - - Iterator it = candidates.iterator(); - - while (it.hasNext()) { - ActiveMQDestination destination = (ActiveMQDestination) it.next(); - if (destination.getPhysicalName().startsWith(destinationName)) { - answer.add(destination.getPhysicalName()); - } - } - } - return answer; - } - } diff --git a/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java b/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java index 77a687ad65..bb1016e6b4 100644 --- a/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java +++ b/activemq-camel/src/test/java/org/apache/activemq/camel/component/AutoExposeQueuesInCamelTest.java @@ -66,29 +66,6 @@ public class AutoExposeQueuesInCamelTest extends EmbeddedBrokerTestSupport { assertEquals("Should have found an endpoint: "+ endpoints, 2, endpoints.size()); } - public void testCompleter() throws Exception { - Thread.sleep(1000); - List result = component.completeEndpointPath(null, "foo"); - assertThat(result, is(Arrays.asList("foo.bar"))); - result = component.completeEndpointPath(null, "queue:foo"); - assertThat(result, is(Arrays.asList("foo.bar"))); - result = component.completeEndpointPath(null, "topic:ch"); - assertThat(result, is(Arrays.asList("cheese"))); - result = component.completeEndpointPath(null, "ch"); - assertTrue(result.isEmpty()); - result = component.completeEndpointPath(null, "queue:ch"); - assertTrue(result.isEmpty()); - result = component.completeEndpointPath(null, "topic:foo"); - assertTrue(result.isEmpty()); - - broker.getAdminView().addQueue("runtime"); - - Thread.sleep(1000); - - result = component.completeEndpointPath(null, "run"); - assertThat(result, is(Arrays.asList("runtime"))); - } - public List getEndpoints(CamelContext camelContext, Class type) { List answer = new ArrayList(); Collection endpoints = camelContext.getEndpoints();