1 28 29 package com.caucho.jms.memory; 30 31 import com.caucho.jms.selector.Selector; 32 import com.caucho.jms.selector.SelectorParser; 33 import com.caucho.jms.session.SessionImpl; 34 import com.caucho.log.Log; 35 import com.caucho.util.L10N; 36 import com.caucho.util.NullEnumeration; 37 38 import javax.jms.JMSException ; 39 import javax.jms.Queue ; 40 import javax.jms.QueueBrowser ; 41 import java.util.Enumeration ; 42 import java.util.logging.Logger ; 43 44 47 public class MemoryQueueBrowser implements QueueBrowser { 48 static final Logger log = Log.open(MemoryQueueBrowser.class); 49 static final L10N L = new L10N(MemoryQueueBrowser.class); 50 51 private SessionImpl _session; 52 protected MemoryQueue _queue; 53 private String _messageSelector; 54 private Selector _selector; 55 56 MemoryQueueBrowser(SessionImpl session, 57 MemoryQueue queue, 58 String messageSelector) 59 throws JMSException 60 { 61 _session = session; 62 _queue = queue; 63 _messageSelector = messageSelector; 64 if (_messageSelector != null) { 65 SelectorParser parser = new SelectorParser(); 66 _selector = parser.parse(messageSelector); 67 } 68 } 69 70 73 public Queue getQueue() 74 throws JMSException 75 { 76 return (Queue ) _queue; 77 } 78 79 82 public String getMessageSelector() 83 throws JMSException 84 { 85 return _messageSelector; 86 } 87 88 91 public Enumeration getEnumeration() 92 throws JMSException 93 { 94 if (_session.isActive()) 95 return _queue.getEnumeration(_selector); 96 else 97 return NullEnumeration.create(); 98 } 99 100 public void close() 101 throws JMSException 102 { 103 } 104 } 105 106 | Popular Tags |