From 3f12c0a87eaab09e9084b17d21b7f4e793945908 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Thu, 5 Aug 2010 15:03:40 +0000 Subject: QPID-2786 Removed the checking for dest style and instead added support for providing the address name and subject is the exchange name and routing key is null. Otherwise we would have to modify the hashcode, equals methods etc to take the dest style into account. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@982652 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/qpid/client/AMQTopic.java | 48 ++++++++++++++-------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'qpid/java') diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java index eb432d3318..5f3f4e7d19 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java @@ -106,20 +106,8 @@ public class AMQTopic extends AMQDestination implements Topic public static AMQTopic createDurable010Topic(AMQTopic topic, String subscriptionName, AMQConnection connection) throws JMSException { - if (topic.getDestSyntax() == AMQDestination.DestSyntax.BURL) - { - return new AMQTopic(topic.getExchangeName(), ExchangeDefaults.TOPIC_EXCHANGE_CLASS, topic.getRoutingKey(), true, false, - getDurableTopicQueueName(subscriptionName, connection), true); - } - else - { - return new AMQTopic(new AMQShortString(topic.getAddressName()), - ExchangeDefaults.TOPIC_EXCHANGE_CLASS, - new AMQShortString(topic.getSubject()), - true, - false, - getDurableTopicQueueName(subscriptionName, connection), true); - } + return new AMQTopic(topic.getExchangeName(), ExchangeDefaults.TOPIC_EXCHANGE_CLASS, topic.getRoutingKey(), true, false, + getDurableTopicQueueName(subscriptionName, connection), true); } public static AMQShortString getDurableTopicQueueName(String subscriptionName, AMQConnection connection) throws JMSException @@ -129,12 +117,39 @@ public class AMQTopic extends AMQDestination implements Topic public String getTopicName() throws JMSException { - return super.getRoutingKey().toString(); + if (super.getRoutingKey() == null && super.getSubject() != null) + { + return super.getSubject(); + } + else + { + return super.getRoutingKey().toString(); + } + } + + @Override + public AMQShortString getExchangeName() + { + if (super.getExchangeName() == null && super.getAddressName() != null) + { + return new AMQShortString(super.getAddressName()); + } + else + { + return _exchangeName; + } } public AMQShortString getRoutingKey() { - return super.getRoutingKey(); + if (super.getRoutingKey() == null && super.getSubject() != null) + { + return new AMQShortString(super.getSubject()); + } + else + { + return super.getRoutingKey(); + } } public boolean isNameRequired() @@ -160,7 +175,6 @@ public class AMQTopic extends AMQDestination implements Topic return (o instanceof AMQTopic) && ((AMQTopic)o).getExchangeName().equals(getExchangeName()) && ((AMQTopic)o).getRoutingKey().equals(getRoutingKey()); - } public int hashCode() -- cgit v1.2.1