1 16 17 package org.apache.axis.transport.jms; 18 19 import javax.jms.MessageListener ; 20 import java.util.HashMap ; 21 22 29 public class Subscription 30 { 31 MessageListener m_listener; 32 JMSEndpoint m_endpoint; 33 String m_messageSelector; 34 int m_ackMode; 35 36 Subscription(MessageListener listener, 37 JMSEndpoint endpoint, 38 HashMap properties) 39 { 40 m_listener = listener; 41 m_endpoint = endpoint; 42 m_messageSelector = MapUtils.removeStringProperty( 43 properties, 44 JMSConstants.MESSAGE_SELECTOR, 45 null); 46 m_ackMode = MapUtils.removeIntProperty(properties, 47 JMSConstants.ACKNOWLEDGE_MODE, 48 JMSConstants.DEFAULT_ACKNOWLEDGE_MODE); 49 } 50 51 public int hashCode() 52 { 53 return toString().hashCode(); 54 } 55 56 public boolean equals(Object obj) 57 { 58 if(obj == null || !(obj instanceof Subscription)) 59 return false; 60 Subscription other = (Subscription)obj; 61 if(m_messageSelector == null) 62 { 63 if(other.m_messageSelector != null) 64 return false; 65 } 66 else 67 { 68 if(other.m_messageSelector == null || 69 !other.m_messageSelector.equals(m_messageSelector)) 70 return false; 71 } 72 return m_ackMode == other.m_ackMode && 73 m_endpoint.equals(other.m_endpoint) && 74 other.m_listener.equals(m_listener); 75 } 76 77 public String toString() 78 { 79 return m_listener.toString(); 80 } 81 82 } | Popular Tags |