1 55 56 package org.jboss.axis.transport.jms; 57 58 import javax.jms.MessageListener ; 59 import java.util.HashMap ; 60 61 68 69 public class Subscription 70 { 71 MessageListener m_listener; 72 JMSEndpoint m_endpoint; 73 String m_messageSelector; 74 int m_ackMode; 75 76 Subscription(MessageListener listener, 77 JMSEndpoint endpoint, 78 HashMap properties) 79 { 80 m_listener = listener; 81 m_endpoint = endpoint; 82 m_messageSelector = MapUtils.removeStringProperty(properties, 83 JMSConstants.MESSAGE_SELECTOR, 84 null); 85 m_ackMode = MapUtils.removeIntProperty(properties, 86 JMSConstants.ACKNOWLEDGE_MODE, 87 JMSConstants.DEFAULT_ACKNOWLEDGE_MODE); 88 } 89 90 public int hashCode() 91 { 92 return toString().hashCode(); 93 } 94 95 public boolean equals(Object obj) 96 { 97 if (obj == null || !(obj instanceof Subscription)) 98 return false; 99 Subscription other = (Subscription)obj; 100 if (m_messageSelector == null) 101 { 102 if (other.m_messageSelector != null) 103 return false; 104 } 105 else 106 { 107 if (other.m_messageSelector == null || 108 !other.m_messageSelector.equals(m_messageSelector)) 109 return false; 110 } 111 return m_ackMode == other.m_ackMode && 112 m_endpoint.equals(other.m_endpoint) && 113 other.m_listener.equals(m_listener); 114 } 115 116 public String toString() 117 { 118 return m_listener.toString(); 119 } 120 121 } | Popular Tags |