001 /*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements. See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership. The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License. You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied. See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 *
020 */
021 package org.apache.qpid.client;
022
023 import java.io.Serializable;
024
025 import javax.jms.BytesMessage;
026 import javax.jms.Destination;
027 import javax.jms.IllegalStateException;
028 import javax.jms.JMSException;
029 import javax.jms.MapMessage;
030 import javax.jms.Message;
031 import javax.jms.MessageConsumer;
032 import javax.jms.MessageListener;
033 import javax.jms.MessageProducer;
034 import javax.jms.ObjectMessage;
035 import javax.jms.Queue;
036 import javax.jms.QueueBrowser;
037 import javax.jms.Session;
038 import javax.jms.StreamMessage;
039 import javax.jms.TemporaryQueue;
040 import javax.jms.TemporaryTopic;
041 import javax.jms.TextMessage;
042 import javax.jms.Topic;
043 import javax.jms.TopicPublisher;
044 import javax.jms.TopicSession;
045 import javax.jms.TopicSubscriber;
046
047 public class AMQTopicSessionAdaptor implements TopicSession, AMQSessionAdapter
048 {
049 protected final AMQSession _session;
050
051 public AMQTopicSessionAdaptor(Session session)
052 {
053 _session = (AMQSession) session;
054 }
055
056 public Topic createTopic(String string) throws JMSException
057 {
058 return _session.createTopic(string);
059 }
060
061 public TopicSubscriber createSubscriber(Topic topic) throws JMSException
062 {
063 return _session.createSubscriber(topic);
064 }
065
066 public TopicSubscriber createSubscriber(Topic topic, String string, boolean b) throws JMSException
067 {
068 return _session.createSubscriber(topic, string, b);
069 }
070
071 public TopicSubscriber createDurableSubscriber(Topic topic, String string) throws JMSException
072 {
073 return _session.createDurableSubscriber(topic, string);
074 }
075
076 public TopicSubscriber createDurableSubscriber(Topic topic, String string, String string1, boolean b) throws JMSException
077 {
078 return _session.createDurableSubscriber(topic, string, string1, b);
079 }
080
081 public TopicPublisher createPublisher(Topic topic) throws JMSException
082 {
083 return _session.createPublisher(topic);
084 }
085
086 public TemporaryTopic createTemporaryTopic() throws JMSException
087 {
088 return _session.createTemporaryTopic();
089 }
090
091 public void unsubscribe(String string) throws JMSException
092 {
093 _session.unsubscribe(string);
094 }
095
096 public BytesMessage createBytesMessage() throws JMSException
097 {
098 return _session.createBytesMessage();
099 }
100
101 public MapMessage createMapMessage() throws JMSException
102 {
103 return _session.createMapMessage();
104 }
105
106 public Message createMessage() throws JMSException
107 {
108 return _session.createMessage();
109 }
110
111 public ObjectMessage createObjectMessage() throws JMSException
112 {
113 return _session.createObjectMessage();
114 }
115
116 public ObjectMessage createObjectMessage(Serializable serializable) throws JMSException
117 {
118 return _session.createObjectMessage();
119 }
120
121 public StreamMessage createStreamMessage() throws JMSException
122 {
123 return _session.createStreamMessage();
124 }
125
126 public TextMessage createTextMessage() throws JMSException
127 {
128 return _session.createTextMessage();
129 }
130
131 public TextMessage createTextMessage(String string) throws JMSException
132 {
133 return _session.createTextMessage(string);
134 }
135
136 public boolean getTransacted() throws JMSException
137 {
138 return _session.getTransacted();
139 }
140
141 public int getAcknowledgeMode() throws JMSException
142 {
143 return _session.getAcknowledgeMode();
144 }
145
146 public void commit() throws JMSException
147 {
148 _session.commit();
149 }
150
151 public void rollback() throws JMSException
152 {
153 _session.rollback();
154 }
155
156 public void close() throws JMSException
157 {
158 _session.close();
159 }
160
161 public void recover() throws JMSException
162 {
163 _session.recover();
164 }
165
166 public MessageListener getMessageListener() throws JMSException
167 {
168 return _session.getMessageListener();
169 }
170
171 public void setMessageListener(MessageListener messageListener) throws JMSException
172 {
173 _session.setMessageListener(messageListener);
174 }
175
176 public void run()
177 {
178 _session.run();
179 }
180
181 public MessageProducer createProducer(Destination destination) throws JMSException
182 {
183 return _session.createProducer(destination);
184 }
185
186 public MessageConsumer createConsumer(Destination destination) throws JMSException
187 {
188 return _session.createConsumer(destination);
189 }
190
191 public MessageConsumer createConsumer(Destination destination, String string) throws JMSException
192 {
193 return _session.createConsumer(destination, string);
194 }
195
196 public MessageConsumer createConsumer(Destination destination, String string, boolean b) throws JMSException
197 {
198 return _session.createConsumer(destination, string, b);
199 }
200
201 //The following methods cannot be called from a TopicSession as per JMS spec
202 public Queue createQueue(String string) throws JMSException
203 {
204 throw new IllegalStateException("Cannot call createQueue from TopicSession");
205 }
206
207 public QueueBrowser createBrowser(Queue queue) throws JMSException
208 {
209 throw new IllegalStateException("Cannot call createBrowser from TopicSession");
210 }
211
212 public QueueBrowser createBrowser(Queue queue, String string) throws JMSException
213 {
214 throw new IllegalStateException("Cannot call createBrowser from TopicSession");
215 }
216
217 public TemporaryQueue createTemporaryQueue() throws JMSException
218 {
219 throw new IllegalStateException("Cannot call createTemporaryQueue from TopicSession");
220 }
221
222 public AMQSession getSession()
223 {
224 return _session;
225 }
226 }
|