1 22 package org.jboss.resource.adapter.jms; 23 24 import javax.jms.Queue ; 25 import javax.jms.Topic ; 26 import javax.resource.ResourceException ; 27 28 import org.jboss.util.Strings; 29 30 37 public class JmsMCFProperties 38 implements java.io.Serializable 39 { 40 static final long serialVersionUID = -7997396849692340121L; 41 42 public static final String QUEUE_TYPE = Queue .class.getName(); 43 public static final String TOPIC_TYPE = Topic .class.getName(); 44 45 String userName; 46 String password; 47 String clientID; 48 String providerJNDI = "java:DefaultJMSProvider"; 49 int type = JmsConnectionFactory.BOTH; 50 51 public JmsMCFProperties() 52 { 53 } 55 56 59 public void setUserName(final String userName) 60 { 61 this.userName = userName; 62 } 63 64 67 public String getUserName() 68 { 69 return userName; 70 } 71 72 75 public void setPassword(final String password) 76 { 77 this.password = password; 78 } 79 80 83 public String getPassword() 84 { 85 return password; 86 } 87 88 91 public String getClientID() 92 { 93 return clientID; 94 } 95 96 99 public void setClientID(final String clientID) 100 { 101 this.clientID = clientID; 102 } 103 104 109 public void setProviderJNDI(final String providerJNDI) 110 { 111 this.providerJNDI = providerJNDI; 112 } 113 114 117 public String getProviderJNDI() 118 { 119 return providerJNDI; 120 } 121 122 125 public int getType() 126 { 127 return type; 128 } 129 130 133 public void setType(int type) 134 { 135 this.type = type; 136 } 137 138 144 public void setSessionDefaultType(String type) throws ResourceException 145 { 146 if (type.equals(QUEUE_TYPE)) 147 this.type = JmsConnectionFactory.QUEUE; 148 else if(type.equals(TOPIC_TYPE)) 149 this.type = JmsConnectionFactory.TOPIC; 150 else 151 this.type = JmsConnectionFactory.BOTH; 152 } 153 154 public String getSessionDefaultType() 155 { 156 if (type == JmsConnectionFactory.BOTH) 157 return "both"; 158 else if (type == JmsConnectionFactory.QUEUE) 159 return TOPIC_TYPE; 160 else 161 return QUEUE_TYPE; 162 } 163 164 167 public boolean equals(Object obj) 168 { 169 if (obj == null) return false; 170 171 if (obj instanceof JmsMCFProperties) 172 { 173 JmsMCFProperties you = (JmsMCFProperties) obj; 174 return (Strings.compare(userName, you.getUserName()) && 175 Strings.compare(password, you.getPassword()) && 176 Strings.compare(providerJNDI, you.getProviderJNDI()) && 177 this.type == you.type); 178 } 179 180 return false; 181 } 182 183 186 public int hashCode() 187 { 188 String result = "" + userName + password + providerJNDI + type; 190 return result.hashCode(); 191 } 192 } 193 | Popular Tags |