Modified: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java?rev=1299257&r1=1299256&r2=1299257&view=diff ============================================================================== --- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java (original) +++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java Sat Mar 10 19:22:10 2012 @@ -20,12 +20,23 @@ */ package org.apache.qpid.client; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Hashtable; -import java.util.UUID; +import org.apache.qpid.jms.ConnectionURL; +import org.apache.qpid.url.AMQBindingURL; +import org.apache.qpid.url.URLSyntaxException; -import javax.jms.*; +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.JMSException; +import javax.jms.QueueConnection; +import javax.jms.QueueConnectionFactory; +import javax.jms.TopicConnection; +import javax.jms.TopicConnectionFactory; +import javax.jms.XAConnection; +import javax.jms.XAConnectionFactory; +import javax.jms.XAQueueConnection; +import javax.jms.XAQueueConnectionFactory; +import javax.jms.XATopicConnection; +import javax.jms.XATopicConnectionFactory; import javax.naming.Context; import javax.naming.Name; import javax.naming.NamingException; @@ -34,10 +45,10 @@ import javax.naming.Reference; import javax.naming.Referenceable; import javax.naming.StringRefAddr; import javax.naming.spi.ObjectFactory; - -import org.apache.qpid.jms.ConnectionURL; -import org.apache.qpid.url.AMQBindingURL; -import org.apache.qpid.url.URLSyntaxException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Hashtable; +import java.util.UUID; public class AMQConnectionFactory implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, @@ -46,12 +57,6 @@ public class AMQConnectionFactory implem { private final ConnectionURL _connectionDetails; - // The default constructor is necessary to allow AMQConnectionFactory to be deserialised from JNDI - public AMQConnectionFactory() - { - _connectionDetails = null; - } - public AMQConnectionFactory(final String url) throws URLSyntaxException { if (url == null) @@ -119,35 +124,27 @@ public class AMQConnectionFactory implem public Connection createConnection(String userName, String password, String id) throws JMSException { - if (_connectionDetails != null) + try { - try + _connectionDetails.setUsername(userName); + _connectionDetails.setPassword(password); + + if (id != null && !id.equals("")) { - ConnectionURL connectionDetails = new AMQConnectionURL(_connectionDetails.toString()); - connectionDetails.setUsername(userName); - connectionDetails.setPassword(password); - - if (id != null && !id.equals("")) - { - connectionDetails.setClientName(id); - } - else if (connectionDetails.getClientName() == null || connectionDetails.getClientName().equals("")) - { - connectionDetails.setClientName(getUniqueClientID()); - } - return new AMQConnection(connectionDetails); - } - catch (Exception e) + _connectionDetails.setClientName(id); + } + else if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals("")) { - JMSException jmse = new JMSException("Error creating connection: " + e.getMessage()); - jmse.setLinkedException(e); - jmse.initCause(e); - throw jmse; + _connectionDetails.setClientName(getUniqueClientID()); } + return new AMQConnection(_connectionDetails); } - else + catch (Exception e) { - throw new JMSException("The connection factory wasn't created with a proper URL, the connection details are empty"); + JMSException jmse = new JMSException("Error creating connection: " + e.getMessage()); + jmse.setLinkedException(e); + jmse.initCause(e); + throw jmse; } } @@ -266,7 +263,7 @@ public class AMQConnectionFactory implem * * @return A newly created XAConnection * @throws JMSException If creating the XAConnection fails due to some internal error. - * @throws JMSSecurityException If client authentication fails due to an invalid user name or password. + * @throws javax.jms.JMSSecurityException If client authentication fails due to an invalid user name or password. */ public XAConnection createXAConnection() throws JMSException { @@ -293,36 +290,25 @@ public class AMQConnectionFactory implem * @param password the caller's password * @return A newly created XAConnection. * @throws JMSException If creating the XAConnection fails due to some internal error. - * @throws JMSSecurityException If client authentication fails due to an invalid user name or password. + * @throws javax.jms.JMSSecurityException If client authentication fails due to an invalid user name or password. */ public XAConnection createXAConnection(String username, String password) throws JMSException { if (_connectionDetails != null) { - try - { - ConnectionURL connectionDetails = new AMQConnectionURL(_connectionDetails.toString()); - connectionDetails.setUsername(username); - connectionDetails.setPassword(password); - - if (connectionDetails.getClientName() == null || connectionDetails.getClientName().equals("")) - { - connectionDetails.setClientName(getUniqueClientID()); - } - return new XAConnectionImpl(connectionDetails); - } - catch (Exception e) + _connectionDetails.setUsername(username); + _connectionDetails.setPassword(password); + + if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals("")) { - JMSException jmse = new JMSException("Error creating XA Connection: " + e.getMessage()); - jmse.setLinkedException(e); - jmse.initCause(e); - throw jmse; + _connectionDetails.setClientName(getUniqueClientID()); } } else { - throw new JMSException("The connection factory wasn't created with a proper URL, the connection details are empty"); - } + throw new JMSException("A URL must be specified to access XA connections"); + } + return createXAConnection(); } @@ -334,7 +320,7 @@ public class AMQConnectionFactory implem * * @return A newly created XATopicConnection * @throws JMSException If creating the XATopicConnection fails due to some internal error. - * @throws JMSSecurityException If client authentication fails due to an invalid user name or password. + * @throws javax.jms.JMSSecurityException If client authentication fails due to an invalid user name or password. */ public XATopicConnection createXATopicConnection() throws JMSException { @@ -351,7 +337,7 @@ public class AMQConnectionFactory implem * @param password the caller's password * @return A newly created XATopicConnection. * @throws JMSException If creating the XATopicConnection fails due to some internal error. - * @throws JMSSecurityException If client authentication fails due to an invalid user name or password. + * @throws javax.jms.JMSSecurityException If client authentication fails due to an invalid user name or password. */ public XATopicConnection createXATopicConnection(String username, String password) throws JMSException { @@ -366,7 +352,7 @@ public class AMQConnectionFactory implem * * @return A newly created XAQueueConnection * @throws JMSException If creating the XAQueueConnection fails due to some internal error. - * @throws JMSSecurityException If client authentication fails due to an invalid user name or password. + * @throws javax.jms.JMSSecurityException If client authentication fails due to an invalid user name or password. */ public XAQueueConnection createXAQueueConnection() throws JMSException { @@ -383,7 +369,7 @@ public class AMQConnectionFactory implem * @param password the caller's password * @return A newly created XAQueueConnection. * @throws JMSException If creating the XAQueueConnection fails due to some internal error. - * @throws JMSSecurityException If client authentication fails due to an invalid user name or password. + * @throws javax.jms.JMSSecurityException If client authentication fails due to an invalid user name or password. */ public XAQueueConnection createXAQueueConnection(String username, String password) throws JMSException {
Modified: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java?rev=1299257&r1=1299256&r2=1299257&view=diff ============================================================================== --- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java (original) +++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java Sat Mar 10 19:22:10 2012 @@ -20,11 +20,6 @@ */ package org.apache.qpid.client; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - import org.apache.qpid.client.url.URLParser; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.jms.BrokerDetails; @@ -32,6 +27,11 @@ import org.apache.qpid.jms.ConnectionURL import org.apache.qpid.url.URLHelper; import org.apache.qpid.url.URLSyntaxException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + public class AMQConnectionURL implements ConnectionURL { private String _url; @@ -50,7 +50,10 @@ public class AMQConnectionURL implements public AMQConnectionURL(String fullURL) throws URLSyntaxException { - if (fullURL == null) throw new IllegalArgumentException("URL cannot be null"); + if (fullURL == null) + { + throw new IllegalArgumentException("URL cannot be null"); + } _url = fullURL; _options = new HashMap<String, String>(); _brokers = new LinkedList<BrokerDetails>(); @@ -273,7 +276,8 @@ public class AMQConnectionURL implements if (_failoverMethod != null) { sb.append(URLHelper.DEFAULT_OPTION_SEPERATOR); - sb.append(OPTIONS_FAILOVER + "='"); + sb.append(OPTIONS_FAILOVER); + sb.append("='"); sb.append(_failoverMethod); sb.append(URLHelper.printOptions(_failoverOptions)); sb.append("'"); Modified: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java?rev=1299257&r1=1299256&r2=1299257&view=diff ============================================================================== --- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java (original) +++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java Sat Mar 10 19:22:10 2012 @@ -20,15 +20,8 @@ */ package org.apache.qpid.client; -import java.net.URISyntaxException; -import java.util.Map; -import java.util.concurrent.atomic.AtomicLong; - -import javax.jms.Destination; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.Referenceable; -import javax.naming.StringRefAddr; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.qpid.client.messaging.address.AddressHelper; import org.apache.qpid.client.messaging.address.Link; @@ -40,23 +33,30 @@ import org.apache.qpid.messaging.Address import org.apache.qpid.url.AMQBindingURL; import org.apache.qpid.url.BindingURL; import org.apache.qpid.url.URLHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import javax.jms.Destination; +import javax.naming.NamingException; +import javax.naming.Reference; +import javax.naming.Referenceable; +import javax.naming.StringRefAddr; +import java.net.URISyntaxException; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; public abstract class AMQDestination implements Destination, Referenceable { private static final Logger _logger = LoggerFactory.getLogger(AMQDestination.class); - protected AMQShortString _exchangeName; + private AMQShortString _exchangeName; - protected AMQShortString _exchangeClass; + private AMQShortString _exchangeClass; - protected boolean _isDurable; + private boolean _isDurable; - protected boolean _isExclusive; + private boolean _isExclusive; - protected boolean _isAutoDelete; + private boolean _isAutoDelete; private boolean _browseOnly; @@ -81,6 +81,41 @@ public abstract class AMQDestination imp public static final int TOPIC_TYPE = 2; public static final int UNKNOWN_TYPE = 3; + protected void setExclusive(boolean exclusive) + { + _isExclusive = exclusive; + } + + protected AddressHelper getAddrHelper() + { + return _addrHelper; + } + + protected void setAddrHelper(AddressHelper addrHelper) + { + _addrHelper = addrHelper; + } + + protected String getName() + { + return _name; + } + + protected void setName(String name) + { + _name = name; + } + + protected Link getTargetLink() + { + return _targetLink; + } + + protected void setTargetLink(Link targetLink) + { + _targetLink = targetLink; + } + // ----- Fields required to support new address syntax ------- public enum DestSyntax { @@ -109,31 +144,46 @@ public abstract class AMQDestination imp public static AddressOption getOption(String str) { - if ("always".equals(str)) return ALWAYS; - else if ("never".equals(str)) return NEVER; - else if ("sender".equals(str)) return SENDER; - else if ("receiver".equals(str)) return RECEIVER; - else throw new IllegalArgumentException(str + " is not an allowed value"); + if ("always".equals(str)) + { + return ALWAYS; + } + else if ("never".equals(str)) + { + return NEVER; + } + else if ("sender".equals(str)) + { + return SENDER; + } + else if ("receiver".equals(str)) + { + return RECEIVER; + } + else + { + throw new IllegalArgumentException(str + " is not an allowed value"); + } } } - protected final static DestSyntax defaultDestSyntax; + private final static DestSyntax defaultDestSyntax; - protected DestSyntax _destSyntax = DestSyntax.ADDR; + private DestSyntax _destSyntax = DestSyntax.ADDR; - protected AddressHelper _addrHelper; - protected Address _address; - protected int _addressType = AMQDestination.UNKNOWN_TYPE; - protected String _name; - protected String _subject; - protected AddressOption _create = AddressOption.NEVER; - protected AddressOption _assert = AddressOption.NEVER; - protected AddressOption _delete = AddressOption.NEVER; - - protected Node _targetNode; - protected Node _sourceNode; - protected Link _targetLink; - protected Link _link; + private AddressHelper _addrHelper; + private Address _address; + private int _addressType = AMQDestination.UNKNOWN_TYPE; + private String _name; + private String _subject; + private AddressOption _create = AddressOption.NEVER; + private AddressOption _assert = AddressOption.NEVER; + private AddressOption _delete = AddressOption.NEVER; + + private Node _targetNode; + private Node _sourceNode; + private Link _targetLink; + private Link _link; // ----- / Fields required to support new address syntax ------- @@ -543,7 +593,7 @@ public abstract class AMQDestination imp { return true; } - if (o == null || getClass() != o.getClass()) + if (!(o instanceof AMQDestination)) { return false; } @@ -572,7 +622,6 @@ public abstract class AMQDestination imp int result; result = _exchangeName == null ? "".hashCode() : _exchangeName.hashCode(); result = 29 * result + (_exchangeClass == null ? "".hashCode() :_exchangeClass.hashCode()); - //result = 29 * result + _destinationName.hashCode(); if (_queueName != null) { result = 29 * result + _queueName.hashCode(); @@ -631,10 +680,10 @@ public abstract class AMQDestination imp public static class Binding { - String exchange; - String bindingKey; - String queue; - Map<String,Object> args; + private String exchange; + private String bindingKey; + private String queue; + private Map<String,Object> args; public Binding(String exchange, String queue, @@ -887,4 +936,5 @@ public abstract class AMQDestination imp return _rejectBehaviour; } + } Modified: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueue.java URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueue.java?rev=1299257&r1=1299256&r2=1299257&view=diff ============================================================================== --- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueue.java (original) +++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueue.java Sat Mar 10 19:22:10 2012 @@ -20,14 +20,13 @@ */ package org.apache.qpid.client; -import java.net.URISyntaxException; - -import javax.jms.Queue; - import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.url.BindingURL; +import javax.jms.Queue; +import java.net.URISyntaxException; + public class AMQQueue extends AMQDestination implements Queue { protected AMQQueue() @@ -156,7 +155,6 @@ public class AMQQueue extends AMQDestina public AMQShortString getRoutingKey() { - //return getAMQQueueName(); if (getAMQQueueName() != null && getAMQQueueName().equals(super.getRoutingKey())) { return getAMQQueueName(); @@ -173,4 +171,10 @@ public class AMQQueue extends AMQDestina //remain valid if we failover (see BLZ-24) return getQueueName() == null; } + + @Override + public boolean equals(Object o) + { + return super.equals(o) && o instanceof Queue; + } } Modified: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java?rev=1299257&r1=1299256&r2=1299257&view=diff ============================================================================== --- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java (original) +++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java Sat Mar 10 19:22:10 2012 @@ -20,6 +20,12 @@ */ package org.apache.qpid.client; +import javax.jms.InvalidDestinationException; +import javax.jms.InvalidSelectorException; +import org.apache.qpid.AMQException; +import org.apache.qpid.AMQInternalException; +import org.apache.qpid.client.filter.JMSSelectorFilter; +import org.apache.qpid.protocol.AMQConstant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,21 +45,59 @@ public class AMQQueueBrowser implements private AtomicBoolean _isClosed = new AtomicBoolean(); private final AMQSession _session; - private final AMQQueue _queue; + private final Queue _queue; private final ArrayList<BasicMessageConsumer> _consumers = new ArrayList<BasicMessageConsumer>(); private final String _messageSelector; - AMQQueueBrowser(AMQSession session, AMQQueue queue, String messageSelector) throws JMSException + AMQQueueBrowser(AMQSession session, Queue queue, String messageSelector) throws JMSException { _session = session; _queue = queue; _messageSelector = ((messageSelector == null) || (messageSelector.trim().length() == 0)) ? null : messageSelector; - // Create Consumer to verify message selector. - BasicMessageConsumer consumer = - (BasicMessageConsumer) _session.createBrowserConsumer(_queue, _messageSelector, false); - // Close this consumer as we are not looking to consume only to establish that, at least for now, - // the QB can be created - consumer.close(); + + + validateQueue((AMQDestination) queue); + + if(_messageSelector != null) + { + validateSelector(_messageSelector); + } + } + + private void validateSelector(String messageSelector) throws InvalidSelectorException + { + try + { + new JMSSelectorFilter(messageSelector); + } + catch (AMQInternalException e) + { + throw new InvalidSelectorException(e.getMessage()); + } + } + + private void validateQueue(AMQDestination queue) throws JMSException + { + try + { + // Essentially just test the connection/session is still active + _session.sync(); + // TODO - should really validate queue exists, but we often rely on creating the consumer to create the queue :( + // _session.declareQueuePassive( queue ); + } + catch (AMQException e) + { + if(e.getErrorCode() == AMQConstant.NOT_FOUND) + { + throw new InvalidDestinationException(e.getMessage()); + } + else + { + final JMSException jmsException = new JMSException(e.getMessage(), String.valueOf(e.getErrorCode().getCode())); + jmsException.setLinkedException(e); + throw jmsException; + } + } } public Queue getQueue() throws JMSException @@ -88,6 +132,10 @@ public class AMQQueueBrowser implements public Enumeration getEnumeration() throws JMSException { checkState(); + if(!_session.getAMQConnection().started()) + { + throw new IllegalStateException("Cannot enumerate message on the queue while the Connection is stopped"); + } final BasicMessageConsumer consumer = (BasicMessageConsumer) _session.createBrowserConsumer(_queue, _messageSelector, false); @@ -108,7 +156,7 @@ public class AMQQueueBrowser implements private class QueueBrowserEnumeration implements Enumeration { - Message _nextMessage; + private Message _nextMessage; private BasicMessageConsumer _consumer; public QueueBrowserEnumeration(BasicMessageConsumer consumer) throws JMSException @@ -118,12 +166,12 @@ public class AMQQueueBrowser implements _consumer = consumer; prefetchMessage(); } - _logger.info("QB:created with first element:" + _nextMessage); + _logger.debug("QB:created with first element:" + _nextMessage); } public boolean hasMoreElements() { - _logger.info("QB:hasMoreElements:" + (_nextMessage != null)); + _logger.debug("QB:hasMoreElements:" + (_nextMessage != null)); return (_nextMessage != null); } @@ -136,9 +184,9 @@ public class AMQQueueBrowser implements } try { - _logger.info("QB:nextElement about to receive"); + _logger.debug("QB:nextElement about to receive"); prefetchMessage(); - _logger.info("QB:nextElement received:" + _nextMessage); + _logger.debug("QB:nextElement received:" + _nextMessage); } catch (JMSException e) { Modified: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueSessionAdaptor.java URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueSessionAdaptor.java?rev=1299257&r1=1299256&r2=1299257&view=diff ============================================================================== --- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueSessionAdaptor.java (original) +++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueSessionAdaptor.java Sat Mar 10 19:22:10 2012 @@ -20,185 +20,64 @@ */ package org.apache.qpid.client; -import java.io.Serializable; - -import javax.jms.BytesMessage; -import javax.jms.Destination; +import javax.jms.*; import javax.jms.IllegalStateException; -import javax.jms.JMSException; -import javax.jms.MapMessage; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.ObjectMessage; -import javax.jms.Queue; -import javax.jms.QueueBrowser; -import javax.jms.QueueReceiver; -import javax.jms.QueueSender; -import javax.jms.QueueSession; -import javax.jms.Session; -import javax.jms.StreamMessage; -import javax.jms.TemporaryQueue; -import javax.jms.TemporaryTopic; -import javax.jms.TextMessage; -import javax.jms.Topic; -import javax.jms.TopicSubscriber; /** * Need this adaptor class to conform to JMS spec and throw IllegalStateException * from createDurableSubscriber, unsubscribe, createTopic & createTemporaryTopic */ -public class AMQQueueSessionAdaptor implements QueueSession, AMQSessionAdapter +class AMQQueueSessionAdaptor extends AMQSessionAdapter<QueueSession> implements QueueSession { - //holds a session for delegation - protected final AMQSession _session; - /** * Construct an adaptor with a session to wrap * @param session */ - public AMQQueueSessionAdaptor(Session session) + protected AMQQueueSessionAdaptor(QueueSession session) { - _session = (AMQSession) session; - } - - public TemporaryQueue createTemporaryQueue() throws JMSException { - return _session.createTemporaryQueue(); - } - - public Queue createQueue(String string) throws JMSException { - return _session.createQueue(string); - } - - public QueueReceiver createReceiver(Queue queue) throws JMSException { - return _session.createReceiver(queue); - } - - public QueueReceiver createReceiver(Queue queue, String string) throws JMSException { - return _session.createReceiver(queue, string); - } - - public QueueSender createSender(Queue queue) throws JMSException { - return _session.createSender(queue); - } - - public QueueBrowser createBrowser(Queue queue) throws JMSException { - return _session.createBrowser(queue); - } - - public QueueBrowser createBrowser(Queue queue, String string) throws JMSException { - return _session.createBrowser(queue, string); - } - - public BytesMessage createBytesMessage() throws JMSException { - return _session.createBytesMessage(); - } - - public MapMessage createMapMessage() throws JMSException { - return _session.createMapMessage(); - } - - public Message createMessage() throws JMSException { - return _session.createMessage(); - } - - public ObjectMessage createObjectMessage() throws JMSException { - return _session.createObjectMessage(); - } - - public ObjectMessage createObjectMessage(Serializable serializable) throws JMSException { - return _session.createObjectMessage(serializable); - } - - public StreamMessage createStreamMessage() throws JMSException { - return _session.createStreamMessage(); - } - - public TextMessage createTextMessage() throws JMSException { - return _session.createTextMessage(); - } - - public TextMessage createTextMessage(String string) throws JMSException { - return _session.createTextMessage(string); - } - - public boolean getTransacted() throws JMSException { - return _session.getTransacted(); - } - - public int getAcknowledgeMode() throws JMSException { - return _session.getAcknowledgeMode(); - } - - public void commit() throws JMSException { - _session.commit(); - } - - public void rollback() throws JMSException { - _session.rollback(); - } - - public void close() throws JMSException { - _session.close(); - } - - public void recover() throws JMSException { - _session.recover(); - } - - public MessageListener getMessageListener() throws JMSException { - return _session.getMessageListener(); + super(session); } - public void setMessageListener(MessageListener messageListener) throws JMSException { - _session.setMessageListener(messageListener); - } - - public void run() { - _session.run(); - } - - public MessageProducer createProducer(Destination destination) throws JMSException { - return _session.createProducer(destination); - } - - public MessageConsumer createConsumer(Destination destination) throws JMSException { - return _session.createConsumer(destination); + public QueueReceiver createReceiver(Queue queue) throws JMSException + { + return getSession().createReceiver(queue); } - public MessageConsumer createConsumer(Destination destination, String string) throws JMSException { - return _session.createConsumer(destination,string); + public QueueReceiver createReceiver(Queue queue, String string) throws JMSException + { + return getSession().createReceiver(queue, string); } - public MessageConsumer createConsumer(Destination destination, String string, boolean b) throws JMSException { - return _session.createConsumer(destination,string,b); + public QueueSender createSender(Queue queue) throws JMSException + { + return getSession().createSender(queue); } //The following methods cannot be called from a QueueSession as per JMS spec - public Topic createTopic(String string) throws JMSException { + public Topic createTopic(String string) throws JMSException + { throw new IllegalStateException("Cannot call createTopic from QueueSession"); } - public TopicSubscriber createDurableSubscriber(Topic topic, String string) throws JMSException { + public TopicSubscriber createDurableSubscriber(Topic topic, String string) throws JMSException + { throw new IllegalStateException("Cannot call createDurableSubscriber from QueueSession"); } - public TopicSubscriber createDurableSubscriber(Topic topic, String string, String string1, boolean b) throws JMSException { + public TopicSubscriber createDurableSubscriber(Topic topic, String string, String string1, boolean b) throws JMSException + { throw new IllegalStateException("Cannot call createDurableSubscriber from QueueSession"); } - public TemporaryTopic createTemporaryTopic() throws JMSException { + public TemporaryTopic createTemporaryTopic() throws JMSException + { throw new IllegalStateException("Cannot call createTemporaryTopic from QueueSession"); } - public void unsubscribe(String string) throws JMSException { + public void unsubscribe(String string) throws JMSException + { throw new IllegalStateException("Cannot call unsubscribe from QueueSession"); } - public AMQSession getSession() - { - return _session; - } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org