summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorArnaud Simon <arnaudsimon@apache.org>2007-07-25 14:30:19 +0000
committerArnaud Simon <arnaudsimon@apache.org>2007-07-25 14:30:19 +0000
commit39c89ffb3b0ba9b13d96d215c5a248e2fb6730c1 (patch)
treea7370b22c6afbccae92d749bad6a9156b64cbcde /java
parent2b9470fc26a7b58b75e54727d45959c877b5aaff (diff)
downloadqpid-python-39c89ffb3b0ba9b13d96d215c5a248e2fb6730c1.tar.gz
first implementation
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@559476 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/jms/ConnectionImpl.java410
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/jms/ConnectionMetaDataImpl.java186
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/jms/CustomJMSXProperty.java47
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/jms/ExceptionHelper.java45
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/jms/QpidExceptionListenerImpl.java54
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/jms/SessionImpl.java27
6 files changed, 769 insertions, 0 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/jms/ConnectionImpl.java b/java/client/src/main/java/org/apache/qpid/nclient/jms/ConnectionImpl.java
new file mode 100644
index 0000000000..0c03960edc
--- /dev/null
+++ b/java/client/src/main/java/org/apache/qpid/nclient/jms/ConnectionImpl.java
@@ -0,0 +1,410 @@
+/* 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.nclient.jms;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.qpid.nclient.exception.QpidException;
+import org.apache.qpid.nclient.api.QueueSessionImpl;
+
+import javax.jms.*;
+import javax.jms.IllegalStateException;
+import javax.jms.Session;
+import javax.jms.ExceptionListener;
+import java.util.Vector;
+
+
+/**
+ * Created by Arnaud Simon
+ * Date: 25-Jul-2007
+ * Time: 09:47:17
+ */
+public class ConnectionImpl implements Connection, QueueConnection, TopicConnection
+{
+ /**
+ * This class's logger
+ */
+ private static final Logger _logger = LoggerFactory.getLogger(ConnectionImpl.class);
+
+ /**
+ * Maps from session id (Integer) to SessionImpl instance
+ */
+ private final Vector<SessionImpl> _sessions = new Vector<SessionImpl>();
+
+ /**
+ * This is the clientID
+ */
+ private String _clientID;
+
+ /**
+ * The user name to use for authentication
+ */
+ private String _username;
+
+ /**
+ * The password to use for authentication
+ */
+ private String _password;
+
+ /**
+ * The Exception listenr get informed when a serious problem is detected
+ */
+ private ExceptionListener _exceptionListener;
+
+ /**
+ * Whether this connection is started, i.e. whether messages are flowing to consumers.
+ * It has no meaning for message publication.
+ */
+ private boolean _started;
+
+ /**
+ * set to true if this Connection has been closed.
+ * <p/>
+ * A closed Connection cannot accept invocations to any of its methods with the exception
+ * of close(). All other methods should throw javax.jms.IllegalStateExceptions if the
+ * Connection has been closed.
+ * <p/>
+ * A Connection is open after creation, but not started. Once it has been closed, a Connection
+ * cannot be reused any more.
+ */
+ private boolean _isClosed = false;
+
+
+ /**
+ * The QpidConeection instance that is mapped with thie JMS connection
+ */
+ org.apache.qpid.nclient.api.Connection _qpidConnection;
+
+ /**
+ * This is the exception listener for this qpid connection.
+ * The jms exception listener is registered with this listener.
+ */
+ QpidExceptionListenerImpl _qpidExceptionListener;
+
+ //------ Constructors ---//
+ /**
+ * TODO define the parameters
+ */
+ public ConnectionImpl()
+ {
+ }
+
+ //---- Interface javax.jms.Connection ---//
+
+ public Session createSession(boolean b, int i)
+ throws
+ JMSException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ /**
+ * Gets the client identifier for this connection.
+ * <P>It is either preconfigured as a JNDI property or assigned dynamically by the application
+ * by calling the <code>setClientID</code> method.
+ * <p/>
+ * TODO: Make sure that the client identifier can be set on the <CODE>ConnectionFactory</CODE>
+ *
+ * @return The unique client identifier.
+ * @throws JMSException If this connection is closed.
+ */
+ public String getClientID()
+ throws
+ JMSException
+ {
+ checkNotClosed();
+
+ return _clientID;
+ }
+
+ /**
+ * Sets the client identifier for this connection.
+ * <p/>
+ * <P>The preferred way to assign a JMS client's client identifier is for
+ * it to be configured in a client-specific <CODE>ConnectionFactory</CODE>
+ * object and transparently assigned to the <CODE>Connection</CODE> object
+ * it creates.
+ * <p> In AMQP it is not possible to change the client ID. If one is not specified
+ * upon connection construction, an id is generated automatically. Therefore
+ * we can always throw an exception.
+ * TODO: Make sure that the client identifier can be set on the <CODE>ConnectionFactory</CODE>
+ *
+ * @param clientID the unique client identifier
+ * @throws JMSException Always as clientID is always set at construction time.
+ */
+ public void setClientID(String clientID)
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ throw new IllegalStateException("Client name cannot be changed after being set");
+ }
+
+ /**
+ * Gets the metadata for this connection.
+ *
+ * @return The connection metadata
+ * @throws JMSException If there ie a problem getting the connection metadata for this connection.
+ * @see javax.jms.ConnectionMetaData
+ */
+ public ConnectionMetaData getMetaData()
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ return ConnectionMetaDataImpl.getInstance();
+ }
+
+ /**
+ * Gets the <CODE>ExceptionListener</CODE> object for this connection.
+ *
+ * @return the <CODE>ExceptionListener</CODE> for this connection
+ * @throws JMSException In case of unforeseen problem
+ */
+ public ExceptionListener getExceptionListener()
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ return _exceptionListener;
+ }
+
+ /**
+ * Sets an exception listener for this connection.
+ * <p/>
+ * <p> The JMS specification says:
+ * <P>If a JMS provider detects a serious problem with a connection, it
+ * informs the connection's <CODE>ExceptionListener</CODE>, if one has been
+ * registered. It does this by calling the listener's
+ * <CODE>onException</CODE> method, passing it a <CODE>JMSException</CODE>
+ * object describing the problem.
+ * <p/>
+ * <P>A connection serializes execution of its
+ * <CODE>ExceptionListener</CODE>.
+ * <p/>
+ * <P>A JMS provider should attempt to resolve connection problems
+ * itself before it notifies the client of them.
+ *
+ * @param exceptionListener The connection listener.
+ * @throws JMSException If the connection is closed.
+ */
+ public void setExceptionListener(ExceptionListener exceptionListener)
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ _exceptionListener = exceptionListener;
+ _qpidExceptionListener.setJMSExceptionListner(_exceptionListener);
+ }
+
+ /**
+ * Starts (or restarts) a connection's delivery of incoming messages.
+ * A call to start on a connection that has already been
+ * started is ignored.
+ *
+ * @throws JMSException In case of a problem due to some internal error.
+ */
+ public void start()
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ if (!_started)
+ {
+ // start all the sessions
+ for (SessionImpl session : _sessions)
+ {
+ //TODO session.start();
+ //TODO Exception handling
+ }
+ _started = true;
+ }
+ }
+
+ /**
+ * Temporarily stops a connection's delivery of incoming messages.
+ * <p> The JMS specification says:
+ * <p> Delivery can be restarted using the connection's <CODE>start</CODE>
+ * method. When the connection is stopped, delivery to all the connection's message consumers is inhibited:
+ * synchronous receives block, and messages are not delivered to message listeners.
+ * <P>This call blocks until receives and/or message listeners in progress have completed.
+ *
+ * @throws JMSException In case of a problem due to some internal error.
+ */
+ public void stop()
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ if (_started)
+ {
+ // start all the sessions
+ for (SessionImpl session : _sessions)
+ {
+ //TODO session.stop();
+ //TODO Exception handling
+ }
+ _started = false;
+ }
+ }
+
+ /**
+ * Closes the connection.
+ * <p/>
+ * <p> The JMS specification says:
+ * <P>Since a provider typically allocates significant resources outside
+ * the JVM on behalf of a connection, clients should close these resources
+ * when they are not needed. Relying on garbage collection to eventually
+ * reclaim these resources may not be timely enough.
+ * <P>There is no need to close the sessions, producers, and consumers of a closed connection.
+ * <P>Closing a connection causes all temporary destinations to be deleted.
+ * <P>When this method is invoked, it should not return until message
+ * processing has been shut down in an orderly fashion.
+ *
+ * @throws JMSException In case of a problem due to some internal error.
+ */
+ public void close()
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ if (!_isClosed)
+ {
+ _isClosed = true;
+ _started = false;
+ // close all the sessions
+ for (SessionImpl session : _sessions)
+ {
+ //TODO session.close();
+ //TODO Exception handling
+ }
+ // close the underlaying Qpid connection
+ try
+ {
+ _qpidConnection.close();
+ }
+ catch (QpidException e)
+ {
+ throw ExceptionHelper.convertQpidExceptionToJMSException(e);
+ }
+ }
+ }
+
+ /**
+ * Creates a connection consumer for this connection (optional operation).
+ * This is an expert facility for App server integration.
+ *
+ * @param destination The destination to access.
+ * @param messageSelector Only messages with properties matching the message selector expression are delivered.
+ * @param sessionPool The session pool to associate with this connection consumer.
+ * @param maxMessages The maximum number of messages that can be assigned to a server session at one time.
+ * @return Null for the moment.
+ * @throws JMSException In case of a problem due to some internal error.
+ */
+ public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector,
+ ServerSessionPool sessionPool, int maxMessages)
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ return null;
+ }
+
+ /**
+ * Create a durable connection consumer for this connection (optional operation).
+ *
+ * @param topic The topic to access.
+ * @param subscriptionName Durable subscription name.
+ * @param messageSelector Only messages with properties matching the message selector expression are delivered.
+ * @param sessionPool The server session pool to associate with this durable connection consumer.
+ * @param maxMessages The maximum number of messages that can be assigned to a server session at one time.
+ * @return Null for the moment.
+ * @throws JMSException In case of a problem due to some internal error.
+ */
+ public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName,
+ String messageSelector, ServerSessionPool sessionPool,
+ int maxMessages)
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ return null;
+ }
+
+ //-------------- QueueConnection API
+
+ public QueueSession createQueueSession(boolean b, int i)
+ throws
+ JMSException
+ {
+ checkNotClosed();
+ //TODO: create a queue session
+ QueueSessionImpl queueSession = null;
+ _sessions.add(queueSession);
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public ConnectionConsumer createConnectionConsumer(Queue queue, String string, ServerSessionPool serverSessionPool, int i)
+ throws
+ JMSException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ //-------------- TopicConnection API
+
+ public TopicSession createTopicSession(boolean b, int i)
+ throws
+ JMSException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public ConnectionConsumer createConnectionConsumer(Topic topic, String string, ServerSessionPool serverSessionPool, int i)
+ throws
+ JMSException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ //-------------- protected and private methods
+
+ /**
+ * Validate that the Connection is not closed.
+ * <p/>
+ * If the Connection has been closed, throw a javax.jms.IllegalStateException. This behaviour is
+ * required by the JMS specification.
+ *
+ * @throws javax.jms.IllegalStateException
+ * If the session is closed.
+ */
+ protected synchronized void checkNotClosed()
+ throws
+ IllegalStateException
+ {
+ if (_isClosed)
+ {
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Connection has been closed. Cannot invoke any further operations.");
+ }
+ throw new javax.jms.IllegalStateException("Connection has been closed. Cannot invoke any further operations.");
+ }
+ }
+
+}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/jms/ConnectionMetaDataImpl.java b/java/client/src/main/java/org/apache/qpid/nclient/jms/ConnectionMetaDataImpl.java
new file mode 100644
index 0000000000..05c759fc2d
--- /dev/null
+++ b/java/client/src/main/java/org/apache/qpid/nclient/jms/ConnectionMetaDataImpl.java
@@ -0,0 +1,186 @@
+/* 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.nclient.jms;
+
+import org.apache.qpid.common.QpidProperties;
+
+import javax.jms.ConnectionMetaData;
+import javax.jms.JMSException;
+import java.util.Enumeration;
+
+/**
+ * A <CODE>ConnectionMetaDataImpl</CODE> object provides information describing the
+ * JMS <CODE>Connection</CODE>.
+ * <p/>
+ * Created by Arnaud Simon
+ * Date: 25-Jul-2007
+ * Time: 10:47:20
+ */
+public class ConnectionMetaDataImpl implements ConnectionMetaData
+{
+
+ /**
+ * A singleton instance.
+ */
+ static ConnectionMetaDataImpl _singleton = new ConnectionMetaDataImpl();
+
+ // ------------------------ The metadata
+ // JMS major version
+ private static final int JMS_MAJOR_VERSION = 1;
+ // JMS minor version
+ private static final int JMS_MINOR_VERSION = 1;
+ // JMS version
+ private static final String JMS_VERSION = "1.1";
+ // Provider name
+ private static final String PROVIDER_NAME = "Apache " + QpidProperties.getProductName();
+ // Provider major version
+ private static final int PROVIDER_MAJOR_VERSION = 0;
+ // Provider minor version
+ private static final int PROVIDER_MINOR_VERSION = 10;
+ // Provider version
+ private static final String PROVIDER_VERSION = QpidProperties.getProductName() + " (Client: ["
+ + QpidProperties.getBuildVersion() + "] ; Protocol: [ 0.10 ] )";
+
+ /**
+ * Prevent instantiation.
+ */
+ private ConnectionMetaDataImpl()
+ {
+ }
+
+ /**
+ * Get the singleton instance of ConnectionMetaDataImpl.
+ *
+ * @return the singleton instance of ConnectionMetaDataImpl.
+ */
+ public static ConnectionMetaDataImpl getInstance()
+ {
+ return _singleton;
+ }
+
+ //-- Connection MetaData API
+
+ /**
+ * Gets the JMS API version.
+ *
+ * @return the JMS API version
+ * @throws JMSException Never
+ */
+ public String getJMSVersion()
+ throws
+ JMSException
+ {
+ return JMS_VERSION;
+ }
+
+
+ /**
+ * Gets the JMS major version number.
+ *
+ * @return the JMS API major version number
+ * @throws JMSException Never
+ */
+ public int getJMSMajorVersion()
+ throws
+ JMSException
+ {
+ return JMS_MAJOR_VERSION;
+ }
+
+
+ /**
+ * Gets the JMS minor version number.
+ *
+ * @return the JMS API minor version number
+ * @throws JMSException Never
+ */
+ public int getJMSMinorVersion()
+ throws
+ JMSException
+ {
+ return JMS_MINOR_VERSION;
+ }
+
+
+ /**
+ * Gets Qpid name.
+ *
+ * @return Qpid name
+ * @throws JMSException Never
+ */
+ public String getJMSProviderName()
+ throws
+ JMSException
+ {
+ return PROVIDER_NAME;
+ }
+
+ /**
+ * Gets Qpid version.
+ *
+ * @return Qpid version
+ * @throws JMSException Never
+ */
+ public String getProviderVersion()
+ throws
+ JMSException
+ {
+ return PROVIDER_VERSION;
+ // TODO: We certainly can dynamically get the server version.
+ }
+
+ /**
+ * Gets Qpid major version number.
+ *
+ * @return Qpid major version number
+ * @throws JMSException Never
+ */
+ public int getProviderMajorVersion()
+ throws
+ JMSException
+ {
+ return PROVIDER_MAJOR_VERSION;
+ }
+
+ /**
+ * Gets Qpid minor version number.
+ *
+ * @return Qpid minor version number
+ * @throws JMSException Never
+ */
+ public int getProviderMinorVersion()
+ throws
+ JMSException
+ {
+ return PROVIDER_MINOR_VERSION;
+ }
+
+ /**
+ * Gets an enumeration of the JMSX property names.
+ *
+ * @return an Enumeration of JMSX property names
+ * @throws JMSException if cannot retrieve metadata due to some internal error.
+ */
+ public Enumeration getJMSXPropertyNames()
+ throws
+ JMSException
+ {
+ return CustomJMSXProperty.asEnumeration();
+ }
+
+}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/jms/CustomJMSXProperty.java b/java/client/src/main/java/org/apache/qpid/nclient/jms/CustomJMSXProperty.java
new file mode 100644
index 0000000000..19dfc3a0b5
--- /dev/null
+++ b/java/client/src/main/java/org/apache/qpid/nclient/jms/CustomJMSXProperty.java
@@ -0,0 +1,47 @@
+/* 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.nclient.jms;
+
+import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Collections;
+
+public enum CustomJMSXProperty
+{
+ JMS_AMQP_NULL,
+ JMS_QPID_DESTTYPE,
+ JMSXGroupID,
+ JMSXGroupSeq;
+
+ private static Enumeration _names;
+
+ public static synchronized Enumeration asEnumeration()
+ {
+ if(_names == null)
+ {
+ CustomJMSXProperty[] properties = values();
+ ArrayList<String> nameList = new ArrayList<String>(properties.length);
+ for(CustomJMSXProperty property : properties)
+ {
+ nameList.add(property.toString());
+ }
+ _names = Collections.enumeration(nameList);
+ }
+ return _names;
+ }
+}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/jms/ExceptionHelper.java b/java/client/src/main/java/org/apache/qpid/nclient/jms/ExceptionHelper.java
new file mode 100644
index 0000000000..9e649c2d3c
--- /dev/null
+++ b/java/client/src/main/java/org/apache/qpid/nclient/jms/ExceptionHelper.java
@@ -0,0 +1,45 @@
+/* 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.nclient.jms;
+
+import org.apache.qpid.nclient.exception.QpidException;
+
+import javax.jms.JMSException;
+
+/**
+ * Created by Arnaud Simon
+ * Date: 25-Jul-2007
+ * Time: 12:54:00
+ */
+public class ExceptionHelper
+{
+ static public JMSException convertQpidExceptionToJMSException(Exception exception)
+ {
+ JMSException jmsException = null;
+ if (exception instanceof QpidException)
+ {
+ jmsException = new JMSException(exception.getMessage(), ((QpidException) exception).getErrorCode());
+ }
+ else
+ {
+ jmsException = new JMSException(exception.getMessage());
+ }
+ jmsException.setLinkedException(exception);
+ return jmsException;
+ }
+}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/jms/QpidExceptionListenerImpl.java b/java/client/src/main/java/org/apache/qpid/nclient/jms/QpidExceptionListenerImpl.java
new file mode 100644
index 0000000000..3e81b81ba7
--- /dev/null
+++ b/java/client/src/main/java/org/apache/qpid/nclient/jms/QpidExceptionListenerImpl.java
@@ -0,0 +1,54 @@
+/* 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.nclient.jms;
+
+import org.apache.qpid.nclient.api.ExceptionListener;
+import org.apache.qpid.nclient.exception.QpidException;
+
+import javax.jms.JMSException;
+
+/**
+ * Created by Arnaud Simon
+ * Date: 25-Jul-2007
+ * Time: 12:08:47
+ */
+public class QpidExceptionListenerImpl implements ExceptionListener
+{
+ private javax.jms.ExceptionListener _jmsExceptionListener;
+
+ public QpidExceptionListenerImpl()
+ {
+ }
+
+ void setJMSExceptionListner(javax.jms.ExceptionListener jmsExceptionListener)
+ {
+ _jmsExceptionListener = jmsExceptionListener;
+ }
+ //----- ExceptionListener API
+
+ public void onException(QpidException exception)
+ {
+ // convert this exception in a JMS exception
+ JMSException jmsException = ExceptionHelper.convertQpidExceptionToJMSException(exception);
+ // propagate to the jms exception listener
+ if( _jmsExceptionListener != null )
+ {
+ _jmsExceptionListener.onException(jmsException);
+ }
+ }
+}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/jms/SessionImpl.java b/java/client/src/main/java/org/apache/qpid/nclient/jms/SessionImpl.java
new file mode 100644
index 0000000000..7050ea32a9
--- /dev/null
+++ b/java/client/src/main/java/org/apache/qpid/nclient/jms/SessionImpl.java
@@ -0,0 +1,27 @@
+/* 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.nclient.jms;
+
+/**
+ * Created by Arnaud Simon
+ * Date: 25-Jul-2007
+ * Time: 12:35:36
+ */
+public class SessionImpl
+{
+}