1 22 package org.jboss.mq; 23 24 import java.io.Serializable ; 25 import java.text.DateFormat ; 26 import java.util.Date ; 27 28 34 public class MessageStatistics implements Serializable 35 { 36 38 39 static final long serialVersionUID = 8056884098781414022L; 40 41 43 44 private boolean topic; 45 46 47 private boolean durable; 48 49 50 private String name; 51 52 53 private String subscriptionID; 54 55 56 private int count; 57 58 59 private int countDelta; 60 61 62 private int depth; 63 64 65 private int depthDelta; 66 67 68 private long timeLastUpdate; 69 70 72 74 77 public MessageStatistics() 78 { 79 } 80 81 83 88 public int getCount() 89 { 90 return count; 91 } 92 93 98 public void setCount(int count) 99 { 100 this.count = count; 101 } 102 103 108 public int getCountDelta() 109 { 110 return countDelta; 111 } 112 113 118 public void setCountDelta(int countDelta) 119 { 120 this.countDelta = countDelta; 121 } 122 123 128 public int getDepth() 129 { 130 return depth; 131 } 132 133 138 public void setDepth(int depth) 139 { 140 this.depth = depth; 141 } 142 143 148 public int getDepthDelta() 149 { 150 return depthDelta; 151 } 152 153 158 public void setDepthDelta(int depthDelta) 159 { 160 this.depthDelta = depthDelta; 161 } 162 163 168 public boolean isDurable() 169 { 170 return durable; 171 } 172 173 178 public void setDurable(boolean durable) 179 { 180 this.durable = durable; 181 } 182 183 188 public String getName() 189 { 190 return name; 191 } 192 193 198 public void setName(String name) 199 { 200 this.name = name; 201 } 202 203 208 public String getSubscriptionID() 209 { 210 return subscriptionID; 211 } 212 213 218 public void setSubscriptionID(String subscriptionID) 219 { 220 this.subscriptionID = subscriptionID; 221 } 222 223 228 public long getTimeLastUpdate() 229 { 230 return timeLastUpdate; 231 } 232 233 238 public void setTimeLastUpdate(long timeLastUpdate) 239 { 240 this.timeLastUpdate = timeLastUpdate; 241 } 242 243 248 public boolean isTopic() 249 { 250 return topic; 251 } 252 253 258 public void setTopic(boolean topic) 259 { 260 this.topic = topic; 261 } 262 263 271 public String getAsString() 272 { 273 StringBuffer buffer = new StringBuffer (50); 274 275 if (topic) 277 buffer.append("Topic,"); 278 else 279 buffer.append("Queue,"); 280 281 buffer.append(name).append(','); 283 284 if (subscriptionID != null) 286 buffer.append(subscriptionID).append(','); 287 else 288 buffer.append("-,"); 289 290 if (topic) 292 { 293 if (durable) 295 buffer.append("DURABLE,"); 296 else 297 buffer.append("NONDURABLE,"); 298 } 299 else 300 { 301 buffer.append("-,"); 302 } 303 304 buffer.append(count).append(',').append(countDelta).append(',').append(depth).append(',').append(depthDelta) 306 .append(','); 307 308 if (timeLastUpdate > 0) 310 { 311 DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); 312 313 buffer.append(dateFormat.format(new Date (timeLastUpdate))); 314 } 315 else 316 { 317 buffer.append('-'); 318 } 319 320 return buffer.toString(); 321 } 322 323 325 public String toString() 326 { 327 return getAsString(); 328 } 329 330 332 334 336 338 } | Popular Tags |