package org.mockejb.jms;
import javax.jms.*;
import org.mockejb.MethodNotImplementedException;
class QueueSessionImpl extends MockSession implements QueueSession {
QueueSessionImpl(
boolean transacted,
int acknowledgeMode,
MockConnection connection) {
super(transacted, acknowledgeMode, connection);
}
public Queue createQueue(String queueName) throws JMSException {
throw new MethodNotImplementedException(
"createQueue",
"QueueSessionImpl");
}
public QueueReceiver createReceiver(Queue queue) throws JMSException {
checkClosed();
return (QueueReceiver)createConsumer(queue);
}
public QueueReceiver createReceiver(Queue queue, String messageSelector)
throws JMSException {
throw new MethodNotImplementedException(
"createReceiver",
"QueueSessionImpl");
}
public QueueSender createSender(Queue queue) throws JMSException {
checkClosed();
return (QueueSender)createProducer(queue);
}
public QueueBrowser createBrowser(Queue queue) throws JMSException {
checkClosed();
if (queue instanceof MockQueue) {
return new QueueBrowserImpl((MockQueue) queue);
}
throw new javax.jms.InvalidDestinationException(
"Invalid queue specified!");
}
public QueueBrowser createBrowser(Queue queue, String messageSelector)
throws JMSException {
throw new MethodNotImplementedException(
"createBrowser",
"QueueSession");
}
public TemporaryQueue createTemporaryQueue() throws JMSException {
throw new MethodNotImplementedException(
"createTemporaryQueue",
"QueueSession");
}
public Topic createTopic(String topicName) throws JMSException {
throw new javax.jms.IllegalStateException(
"Queue session can not create topic!");
}
public TopicSubscriber createDurableSubscriber(Topic topic, String name)
throws JMSException {
throw new javax.jms.IllegalStateException(
"Queue session can not create subscriber!");
}
public TopicSubscriber createDurableSubscriber(
Topic topic,
String name,
String messageSelector,
boolean noLocal)
throws JMSException {
throw new javax.jms.IllegalStateException(
"Queue session can not create subscriber!");
}
public TemporaryTopic createTemporaryTopic() throws JMSException {
throw new javax.jms.IllegalStateException(
"Queue session can not create temporary topic!");
}
public void unsubscribe(String name) throws JMSException {
throw new javax.jms.IllegalStateException(
"Queue session can not \"unsubscribe\"!");
}
MockConsumer createMockConsumer(MockDestination destination) throws JMSException {
if (destination instanceof MockQueue) {
return new QueueReceiverImpl(this, (MockQueue) destination);
}
throw new InvalidDestinationException("Invalid queue specified!");
}
MockProducer createMockProducer(MockDestination destination) throws JMSException {
if (destination instanceof MockQueue) {
return new QueueSenderImpl((MockQueue) destination);
}
throw new InvalidDestinationException("Invalid queue specified!");
}
}