| 1 package net.walend.somnifugi; 2 3 import java.util.Enumeration ; 4 5 import javax.jms.Queue ; 6 import javax.jms.QueueBrowser ; 7 import javax.jms.JMSException ; 8 9 14 15 public class SomniQueueBrowser 16 implements QueueBrowser  17 { 18 19 private SomniQueue queue; 20 private SomniMessageSelector messageSelector = null; 21 22 SomniQueueBrowser(SomniQueue queue) 23 { 24 this.queue = queue; 25 SomniLogger.IT.fine("Created SomniQueueBrowser for "+queue.getName()+"."); 26 } 27 28 SomniQueueBrowser(SomniQueue queue,String messageSelectorString) 29 throws SomniMessageSelectorException 30 { 31 this.queue = queue; 32 this.messageSelector = new SQL92MessageSelector(messageSelectorString); 33 SomniLogger.IT.fine("Created SomniQueueBrowser for "+queue.getName()+" with messageSelector '"+messageSelectorString+"'."); 34 } 35 36 44 public Queue getQueue() throws JMSException  45 { 46 return queue; 47 } 48 49 50 61 public String getMessageSelector() throws JMSException  62 { 63 return messageSelector.toString(); 64 } 65 66 67 76 public Enumeration getEnumeration() throws JMSException  77 { 78 if(messageSelector == null) 79 { 80 return queue.snapShot(); 81 } 82 else 83 { 84 return queue.snapShot(messageSelector); 85 } 86 } 87 88 89 100 public void close() throws JMSException  101 { 102 SomniLogger.IT.fine("Closed SomniQueueBrowser for "+queue.getName()+" with messageSelector '"+messageSelector+"'."); 103 } 104 105 } 106 107 127 | Popular Tags |