1 18 package org.apache.activemq; 19 20 import java.io.Serializable ; 21 22 import javax.jms.BytesMessage ; 23 import javax.jms.Destination ; 24 import javax.jms.IllegalStateException ; 25 import javax.jms.InvalidDestinationException ; 26 import javax.jms.JMSException ; 27 import javax.jms.MapMessage ; 28 import javax.jms.Message ; 29 import javax.jms.MessageConsumer ; 30 import javax.jms.MessageListener ; 31 import javax.jms.MessageProducer ; 32 import javax.jms.ObjectMessage ; 33 import javax.jms.Queue ; 34 import javax.jms.QueueBrowser ; 35 import javax.jms.QueueReceiver ; 36 import javax.jms.QueueSender ; 37 import javax.jms.QueueSession ; 38 import javax.jms.StreamMessage ; 39 import javax.jms.TemporaryQueue ; 40 import javax.jms.TemporaryTopic ; 41 import javax.jms.TextMessage ; 42 import javax.jms.Topic ; 43 import javax.jms.TopicSubscriber ; 44 45 56 public class ActiveMQQueueSession implements QueueSession { 57 58 private final QueueSession next; 59 60 public ActiveMQQueueSession(QueueSession next) { 61 this.next = next; 62 } 63 64 67 public void close() throws JMSException { 68 next.close(); 69 } 70 73 public void commit() throws JMSException { 74 next.commit(); 75 } 76 81 public QueueBrowser createBrowser(Queue queue) throws JMSException { 82 return next.createBrowser(queue); 83 } 84 90 public QueueBrowser createBrowser(Queue queue, String messageSelector) 91 throws JMSException { 92 return next.createBrowser(queue, messageSelector); 93 } 94 98 public BytesMessage createBytesMessage() throws JMSException { 99 return next.createBytesMessage(); 100 } 101 106 public MessageConsumer createConsumer(Destination destination) 107 throws JMSException { 108 if( destination instanceof Topic ) 109 throw new InvalidDestinationException ("Topics are not supported by a QueueSession"); 110 return next.createConsumer(destination); 111 } 112 118 public MessageConsumer createConsumer(Destination destination, 119 String messageSelector) throws JMSException { 120 if( destination instanceof Topic ) 121 throw new InvalidDestinationException ("Topics are not supported by a QueueSession"); 122 return next.createConsumer(destination, messageSelector); 123 } 124 131 public MessageConsumer createConsumer(Destination destination, 132 String messageSelector, boolean NoLocal) throws JMSException { 133 if( destination instanceof Topic ) 134 throw new InvalidDestinationException ("Topics are not supported by a QueueSession"); 135 return next.createConsumer(destination, messageSelector, NoLocal); 136 } 137 143 public TopicSubscriber createDurableSubscriber(Topic topic, String name) 144 throws JMSException { 145 throw new IllegalStateException ("Operation not supported by a QueueSession"); 146 } 147 155 public TopicSubscriber createDurableSubscriber(Topic topic, String name, 156 String messageSelector, boolean noLocal) throws JMSException { 157 throw new IllegalStateException ("Operation not supported by a QueueSession"); 158 } 159 163 public MapMessage createMapMessage() throws JMSException { 164 return next.createMapMessage(); 165 } 166 170 public Message createMessage() throws JMSException { 171 return next.createMessage(); 172 } 173 177 public ObjectMessage createObjectMessage() throws JMSException { 178 return next.createObjectMessage(); 179 } 180 185 public ObjectMessage createObjectMessage(Serializable object) 186 throws JMSException { 187 return next.createObjectMessage(object); 188 } 189 194 public MessageProducer createProducer(Destination destination) 195 throws JMSException { 196 if( destination instanceof Topic ) 197 throw new InvalidDestinationException ("Topics are not supported by a QueueSession"); 198 return next.createProducer(destination); 199 } 200 205 public Queue createQueue(String queueName) throws JMSException { 206 return next.createQueue(queueName); 207 } 208 213 public QueueReceiver createReceiver(Queue queue) throws JMSException { 214 return next.createReceiver(queue); 215 } 216 222 public QueueReceiver createReceiver(Queue queue, String messageSelector) 223 throws JMSException { 224 return next.createReceiver(queue, messageSelector); 225 } 226 231 public QueueSender createSender(Queue queue) throws JMSException { 232 return next.createSender(queue); 233 } 234 238 public StreamMessage createStreamMessage() throws JMSException { 239 return next.createStreamMessage(); 240 } 241 245 public TemporaryQueue createTemporaryQueue() throws JMSException { 246 return next.createTemporaryQueue(); 247 } 248 252 public TemporaryTopic createTemporaryTopic() throws JMSException { 253 throw new IllegalStateException ("Operation not supported by a QueueSession"); 254 } 255 259 public TextMessage createTextMessage() throws JMSException { 260 return next.createTextMessage(); 261 } 262 267 public TextMessage createTextMessage(String text) throws JMSException { 268 return next.createTextMessage(text); 269 } 270 275 public Topic createTopic(String topicName) throws JMSException { 276 throw new IllegalStateException ("Operation not supported by a QueueSession"); 277 } 278 281 public boolean equals(Object arg0) { 282 return next.equals(arg0); 283 } 284 288 public int getAcknowledgeMode() throws JMSException { 289 return next.getAcknowledgeMode(); 290 } 291 295 public MessageListener getMessageListener() throws JMSException { 296 return next.getMessageListener(); 297 } 298 302 public boolean getTransacted() throws JMSException { 303 return next.getTransacted(); 304 } 305 308 public int hashCode() { 309 return next.hashCode(); 310 } 311 314 public void recover() throws JMSException { 315 next.recover(); 316 } 317 320 public void rollback() throws JMSException { 321 next.rollback(); 322 } 323 326 public void run() { 327 next.run(); 328 } 329 333 public void setMessageListener(MessageListener listener) 334 throws JMSException { 335 next.setMessageListener(listener); 336 } 337 340 public String toString() { 341 return next.toString(); 342 } 343 347 public void unsubscribe(String name) throws JMSException { 348 throw new IllegalStateException ("Operation not supported by a QueueSession"); 349 } 350 351 public QueueSession getNext() { 352 return next; 353 } 354 355 } 356 | Popular Tags |