01: package org.mockejb.jms;
02:
03: import java.util.Enumeration;
04: import javax.jms.*;
05:
06: /**
07: * <code>QueueBrowser</code> implementation.
08: * @author Dimitar Gospodinov
09: * @see javax.jms.QueueBrowser
10: */
11: class QueueBrowserImpl implements QueueBrowser {
12:
13: private MockQueue queue;
14:
15: /**
16: * Creates new queue browser for <code>queue</code>
17: * @param queue
18: */
19: QueueBrowserImpl(MockQueue queue) {
20: this .queue = queue;
21: }
22:
23: /**
24: * @see javax.jms.QueueBrowser#getQueue()
25: */
26: public Queue getQueue() throws JMSException {
27: return queue;
28: }
29:
30: /**
31: * Returns null.
32: * @see javax.jms.QueueBrowser#getMessageSelector()
33: */
34: public String getMessageSelector() throws JMSException {
35: return null;
36: }
37:
38: /**
39: * @see javax.jms.QueueBrowser#getEnumeration()
40: */
41: public Enumeration getEnumeration() throws JMSException {
42: return new CollectionEnumeration(queue.getMessages().iterator());
43: }
44:
45: /**
46: * Does nothing
47: * @see javax.jms.QueueBrowser#close()
48: */
49: public void close() throws JMSException {
50: // Does nothing.
51: }
52:
53: }
|