View Javadoc
1 /* 2 * @(#)QueueSessionImpl.java 3 * 4 * JFoxMQ the open source JMS MOM. 5 * 6 * Corpyright 2002-2003 Huihoo Power, Inc. All Rights Reserved. This software 7 * is licensed under LGPL license. 8 * 9 * For more information, please visit: http://www.huihoo.org 10 */ 11 12 package org.huihoo.jfox.ms.jms.queue; 13 14 import javax.jms.IllegalStateException; 15 import javax.jms.JMSException; 16 import javax.jms.Queue; 17 import javax.jms.QueueBrowser; 18 import javax.jms.QueueReceiver; 19 import javax.jms.QueueSender; 20 import javax.jms.QueueSession; 21 import javax.jms.TemporaryQueue; 22 23 import org.huihoo.jfox.ms.jms.base.ConnectionImpl; 24 import org.huihoo.jfox.ms.jms.base.SessionImpl; 25 26 /*** 27 * <p> 28 * This class implements the JMS queue session. The queue session object is 29 * received from a queue connection. 30 * </p> 31 * 32 * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter.Cheng</a> 33 * @version Revision: 1.1 Date: 2003-05-20 21:29:53 34 */ 35 36 public class QueueSessionImpl extends SessionImpl implements QueueSession { 37 38 public QueueSessionImpl( 39 ConnectionImpl connection, 40 boolean transacted, 41 int acknowledgeMode) { 42 super(connection, transacted, acknowledgeMode); 43 } 44 45 /*** 46 * Create a reference to a queue with given a Queue name. 47 * 48 * @param queueName 49 * @return Queue 50 * @throws JMSException 51 */ 52 public Queue createQueue(String queueName) throws JMSException { 53 if (isClosed()) { 54 throw new IllegalStateException("The queue session is closed."); 55 } 56 return new QueueImpl(queueName); 57 } 58 59 /*** 60 * Creates a QueueSender object to send messages to the specified queue. 61 * 62 * @param queue 63 * the Queue to access, or null if this is an unidentified 64 * producer 65 * @return QueueReceiver 66 * @throws JMSException 67 */ 68 public QueueReceiver createReceiver(Queue queue) throws JMSException { 69 if (isClosed()) { 70 throw new IllegalStateException("The queue session is closed."); 71 } 72 return createReceiver(queue, null); 73 } 74 75 /*** 76 * @param queue 77 * the Queue to access, or null if this is an unidentified 78 * producer 79 * @param messageSelector 80 * @return QueueReceiver 81 * @throws JMSException 82 */ 83 public QueueReceiver createReceiver(Queue queue, String messageSelector) 84 throws JMSException { 85 if (messageSelector != null) { 86 throw new IllegalStateException("Unsupport message selector."); 87 } else { 88 QueueReceiverImpl queueReceiver = 89 new QueueReceiverImpl(this, queue, messageSelector); 90 91 return queueReceiver; 92 } 93 } 94 95 /*** 96 * Create a QueueSender object to send messages to the specified queue. 97 * 98 * @param queue 99 * @return QueueSender 100 * @throws JMSException 101 */ 102 public QueueSender createSender(Queue queue) throws JMSException { 103 if (isClosed()) { 104 throw new IllegalStateException("The queue session is closed."); 105 } 106 return new QueueSenderImpl(this, queue); 107 } 108 109 /*** 110 * Creates a <CODE>QueueBrowser</CODE> object to peek at the messages on 111 * the specified queue. 112 * 113 * @param queue 114 * the <CODE>Queue</CODE> to access 115 * 116 * @exception JMSException 117 * if the session fails to create a browser due to some 118 * internal error. 119 * @exception InvalidDestinationException 120 * if an invalid queue is specified. 121 */ 122 public QueueBrowser createBrowser(Queue queue) throws JMSException { 123 // TODO 124 return null; 125 } 126 127 /*** 128 * Creates a <CODE>QueueBrowser</CODE> object to peek at the messages on 129 * the specified queue using a message selector. 130 * 131 * @param queue 132 * the <CODE>Queue</CODE> to access 133 * @param messageSelector 134 * only messages with properties matching the message selector 135 * expression are delivered. A value of null or an empty string 136 * indicates that there is no message selector for the message 137 * consumer. 138 * 139 * @exception JMSException 140 * if the session fails to create a browser due to some 141 * internal error. 142 * @exception InvalidDestinationException 143 * if an invalid queue is specified. 144 * @exception InvalidSelectorException 145 * if the message selector is invalid. 146 */ 147 public QueueBrowser createBrowser(Queue queue, String messageSelector) 148 throws JMSException { 149 // TODO 150 return null; 151 } 152 153 /*** 154 * Creates a <CODE>TemporaryQueue</CODE> object. Its lifetime will be 155 * that of the <CODE>QueueConnection</CODE> unless it is deleted earlier. 156 * 157 * @return a temporary queue identity 158 * 159 * @exception JMSException 160 * if the session fails to create a temporary queue due to 161 * some internal error. 162 */ 163 public TemporaryQueue createTemporaryQueue() throws JMSException { 164 // TODO 165 return null; 166 } 167 168 /*** 169 * Add the specified receiver to the list of managed receivers. 170 * 171 * @param queueReceiver 172 * @throws JMSException 173 */ 174 protected void addReceiver(QueueReceiverImpl queueReceiver) 175 throws JMSException { 176 addConsumer(queueReceiver); 177 } 178 }

This page was automatically generated by Maven