1 22 package org.jboss.mq; 23 24 import java.io.Serializable ; 25 26 import javax.jms.Topic ; 27 import javax.naming.Reference ; 28 import javax.naming.Referenceable ; 29 import javax.naming.StringRefAddr ; 30 31 40 public class SpyTopic extends SpyDestination implements Serializable , Topic , Referenceable 41 { 42 44 45 static final long serialVersionUID = -4784950783387129468L; 46 47 49 50 protected DurableSubscriptionID durableSubscriptionID; 51 52 53 private String toStringStr; 54 56 58 63 public SpyTopic(String topicName) 64 { 65 super(topicName); 66 toStringStr = "TOPIC." + name; 67 } 68 69 77 public SpyTopic(SpyTopic topic, String clientID, String subscriptionName, String selector) 78 { 79 this(topic, new DurableSubscriptionID(clientID, subscriptionName, selector)); 80 } 81 82 88 public SpyTopic(SpyTopic topic, DurableSubscriptionID subid) 89 { 90 super(topic.getTopicName()); 91 if (subid == null) 92 toStringStr = "TOPIC." + name; 93 else 94 toStringStr = "TOPIC." + name + "." + subid; 95 this.durableSubscriptionID = subid; 96 } 97 98 100 105 public DurableSubscriptionID getDurableSubscriptionID() 106 { 107 return durableSubscriptionID; 108 } 109 110 112 public String getTopicName() 113 { 114 return name; 115 } 116 117 public Reference getReference() throws javax.naming.NamingException 119 { 120 return new Reference ("org.jboss.mq.SpyTopic", new StringRefAddr ("name", name), 121 "org.jboss.mq.referenceable.SpyDestinationObjectFactory", null); 122 } 123 124 126 public boolean equals(Object obj) 127 { 128 if (!(obj instanceof SpyTopic)) 129 return false; 130 if (obj.hashCode() != hash) 131 return false; 132 return ((SpyDestination) obj).name.equals(name); 133 } 134 135 public String toString() 136 { 137 return toStringStr; 138 } 139 140 142 144 146 } | Popular Tags |