blob: 31c75536bb825afb709e656880971f1f7ebc6c1e [file] [log] [blame]
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.qpid.jms;
import javax.jms.Destination;
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.TemporaryTopic;
import javax.jms.Topic;
import javax.jms.TopicPublisher;
import javax.jms.TopicSubscriber;
import org.apache.qpid.jms.meta.JmsSessionId;
/**
* JMS QueueSession implementation
*/
public class JmsQueueSession extends JmsSession {
protected JmsQueueSession(JmsConnection connection, JmsSessionId sessionId, int acknowledgementMode) throws JMSException {
super(connection, sessionId, acknowledgementMode);
}
@Override
public MessageConsumer createConsumer(Destination destination) throws JMSException {
if (destination instanceof Topic) {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
return super.createConsumer(destination);
}
/**
* @param destination
* @param messageSelector
* @return
* @throws JMSException
* @see javax.jms.Session#createConsumer(javax.jms.Destination,
* java.lang.String)
*/
@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
if (destination instanceof Topic) {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
return super.createConsumer(destination, messageSelector);
}
/**
* @param destination
* @param messageSelector
* @param noLocal
* @return
* @throws JMSException
* @see javax.jms.Session#createConsumer(javax.jms.Destination,
* java.lang.String, boolean)
*/
@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException {
if (destination instanceof Topic) {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
return super.createConsumer(destination, messageSelector, noLocal);
}
/**
* @param topic
* @param name
* @return
* @throws JMSException
* @see javax.jms.Session#createDurableSubscriber(javax.jms.Topic,
* java.lang.String)
*/
@Override
public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
/**
* @param topic
* @param name
* @param messageSelector
* @param noLocal
* @return
* @throws IllegalStateException
* @throws JMSException
* @see javax.jms.Session#createDurableSubscriber(javax.jms.Topic,
* java.lang.String, java.lang.String, boolean)
*/
@Override
public TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal) throws IllegalStateException {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
/**
* @param destination
* @return
* @throws JMSException
* @see javax.jms.Session#createProducer(javax.jms.Destination)
*/
@Override
public MessageProducer createProducer(Destination destination) throws JMSException {
if (destination instanceof Topic) {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
return super.createProducer(destination);
}
/**
* @return
* @throws JMSException
* @see javax.jms.Session#createTemporaryTopic()
*/
@Override
public TemporaryTopic createTemporaryTopic() throws JMSException {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
/**
* @param topicName
* @return
* @throws JMSException
* @see javax.jms.Session#createTopic(java.lang.String)
*/
@Override
public Topic createTopic(String topicName) throws JMSException {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
/**
* @param name
* @throws JMSException
* @see javax.jms.Session#unsubscribe(java.lang.String)
*/
@Override
public void unsubscribe(String name) throws JMSException {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
/**
* @param topic
* @return
* @throws JMSException
* @see javax.jms.TopicSession#createPublisher(javax.jms.Topic)
*/
@Override
public TopicPublisher createPublisher(Topic topic) throws JMSException {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
/**
* @param topic
* @return
* @throws JMSException
* @see javax.jms.TopicSession#createSubscriber(javax.jms.Topic)
*/
@Override
public TopicSubscriber createSubscriber(Topic topic) throws JMSException {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
/**
* @param topic
* @param messageSelector
* @param noLocal
* @return
* @throws JMSException
* @see javax.jms.TopicSession#createSubscriber(javax.jms.Topic,
* java.lang.String, boolean)
*/
@Override
public TopicSubscriber createSubscriber(Topic topic, String messageSelector, boolean noLocal) throws JMSException {
throw new IllegalStateException("Operation not supported by a QueueSession");
}
}