01: package org.mockejb.jms;
02:
03: import javax.jms.*;
04:
05: /**
06: * <code>Queue</code> implementation.
07: * @author Dimitar Gospodinov
08: * @see javax.jms.Queue
09: */
10: public class MockQueue extends MockDestination implements Queue {
11:
12: private MessageListener listener = null;
13:
14: /**
15: * Creates <code>MockQueue</code> with the specified name
16: * <code>name</code>
17: * @param name
18: */
19: public MockQueue(String name) {
20: super (name);
21: }
22:
23: /**
24: * @see javax.jms.Queue#getQueueName()
25: */
26: public String getQueueName() throws JMSException {
27: return getName();
28: }
29:
30: public void addMessageListener(MessageListener listener) {
31: this .listener = listener;
32: }
33:
34: public void dispatch(Message msg) {
35: if (listener != null) {
36: listener.onMessage(msg);
37: }
38: }
39:
40: }
|