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.StreamMessage ; 36 import javax.jms.TemporaryQueue ; 37 import javax.jms.TemporaryTopic ; 38 import javax.jms.TextMessage ; 39 import javax.jms.Topic ; 40 import javax.jms.TopicPublisher ; 41 import javax.jms.TopicSession ; 42 import javax.jms.TopicSubscriber ; 43 44 55 public class ActiveMQTopicSession implements TopicSession { 56 57 private final TopicSession next; 58 59 public ActiveMQTopicSession(TopicSession next) { 60 this.next = next; 61 } 62 63 66 public void close() throws JMSException { 67 next.close(); 68 } 69 72 public void commit() throws JMSException { 73 next.commit(); 74 } 75 80 public QueueBrowser createBrowser(Queue queue) throws JMSException { 81 throw new IllegalStateException ("Operation not supported by a TopicSession"); 82 } 83 89 public QueueBrowser createBrowser(Queue queue, String messageSelector) 90 throws JMSException { 91 throw new IllegalStateException ("Operation not supported by a TopicSession"); 92 } 93 97 public BytesMessage createBytesMessage() throws JMSException { 98 return next.createBytesMessage(); 99 } 100 105 public MessageConsumer createConsumer(Destination destination) 106 throws JMSException { 107 if( destination instanceof Queue ) 108 throw new InvalidDestinationException ("Queues are not supported by a TopicSession"); 109 return next.createConsumer(destination); 110 } 111 117 public MessageConsumer createConsumer(Destination destination, 118 String messageSelector) throws JMSException { 119 if( destination instanceof Queue ) 120 throw new InvalidDestinationException ("Queues are not supported by a TopicSession"); 121 return next.createConsumer(destination, messageSelector); 122 } 123 130 public MessageConsumer createConsumer(Destination destination, 131 String messageSelector, boolean NoLocal) throws JMSException { 132 if( destination instanceof Queue ) 133 throw new InvalidDestinationException ("Queues are not supported by a TopicSession"); 134 return next.createConsumer(destination, messageSelector, NoLocal); 135 } 136 142 public TopicSubscriber createDurableSubscriber(Topic topic, String name) 143 throws JMSException { 144 return next.createDurableSubscriber(topic, name); 145 } 146 154 public TopicSubscriber createDurableSubscriber(Topic topic, String name, 155 String messageSelector, boolean noLocal) throws JMSException { 156 return next.createDurableSubscriber(topic, name, messageSelector, 157 noLocal); 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 Queue ) 197 throw new InvalidDestinationException ("Queues are not supported by a TopicSession"); 198 return next.createProducer(destination); 199 } 200 205 public TopicPublisher createPublisher(Topic topic) throws JMSException { 206 return next.createPublisher(topic); 207 } 208 213 public Queue createQueue(String queueName) throws JMSException { 214 throw new IllegalStateException ("Operation not supported by a TopicSession"); 215 } 216 220 public StreamMessage createStreamMessage() throws JMSException { 221 return next.createStreamMessage(); 222 } 223 228 public TopicSubscriber createSubscriber(Topic topic) throws JMSException { 229 return next.createSubscriber(topic); 230 } 231 238 public TopicSubscriber createSubscriber(Topic topic, 239 String messageSelector, boolean noLocal) throws JMSException { 240 return next.createSubscriber(topic, messageSelector, noLocal); 241 } 242 246 public TemporaryQueue createTemporaryQueue() throws JMSException { 247 throw new IllegalStateException ("Operation not supported by a TopicSession"); 248 } 249 253 public TemporaryTopic createTemporaryTopic() throws JMSException { 254 return next.createTemporaryTopic(); 255 } 256 260 public TextMessage createTextMessage() throws JMSException { 261 return next.createTextMessage(); 262 } 263 268 public TextMessage createTextMessage(String text) throws JMSException { 269 return next.createTextMessage(text); 270 } 271 276 public Topic createTopic(String topicName) throws JMSException { 277 return next.createTopic(topicName); 278 } 279 282 public boolean equals(Object arg0) { 283 return next.equals(arg0); 284 } 285 289 public int getAcknowledgeMode() throws JMSException { 290 return next.getAcknowledgeMode(); 291 } 292 296 public MessageListener getMessageListener() throws JMSException { 297 return next.getMessageListener(); 298 } 299 303 public boolean getTransacted() throws JMSException { 304 return next.getTransacted(); 305 } 306 309 public int hashCode() { 310 return next.hashCode(); 311 } 312 315 public void recover() throws JMSException { 316 next.recover(); 317 } 318 321 public void rollback() throws JMSException { 322 next.rollback(); 323 } 324 327 public void run() { 328 next.run(); 329 } 330 334 public void setMessageListener(MessageListener listener) 335 throws JMSException { 336 next.setMessageListener(listener); 337 } 338 341 public String toString() { 342 return next.toString(); 343 } 344 348 public void unsubscribe(String name) throws JMSException { 349 next.unsubscribe(name); 350 } 351 352 public TopicSession getNext() { 353 return next; 354 } 355 } 356 | Popular Tags |