summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2010-08-05 15:03:40 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2010-08-05 15:03:40 +0000
commit578406f02e803c86a156c20e1e5cca4ea060b9ce (patch)
treeeb922a0ff4e215858c819370e5a81b83bfc849bf
parentd0f0fb169944bef6d0bdbcc6578c0308fe67aece (diff)
downloadqpid-python-578406f02e803c86a156c20e1e5cca4ea060b9ce.tar.gz
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/qpid@982652 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQTopic.java48
1 files changed, 31 insertions, 17 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java b/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java
index eb432d3318..5f3f4e7d19 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java
+++ b/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()