You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2011/08/14 19:15:08 UTC

svn commit: r1157566 [4/23] - in /qpid: branches/rg-amqp-1-0-sandbox/qpid/java/ branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/ branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/ branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/s...

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueReceiver.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueReceiver.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueReceiver.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueReceiver.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+public interface QueueReceiver extends MessageConsumer, javax.jms.QueueReceiver
+{
+    Queue getQueue() throws JMSException;
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSender.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSender.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSender.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSender.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+public interface QueueSender extends MessageProducer, javax.jms.QueueSender
+{
+    Queue getQueue() throws JMSException;
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSession.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSession.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSession.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSession.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+
+public interface QueueSession extends Session, javax.jms.QueueSession
+{
+    Queue createQueue(String s) throws JMSException;
+
+    QueueReceiver createReceiver(javax.jms.Queue queue) throws JMSException;
+
+    QueueReceiver createReceiver(javax.jms.Queue queue, String s) throws JMSException;
+
+    QueueSender createSender(javax.jms.Queue queue) throws JMSException;
+
+    QueueBrowser createBrowser(javax.jms.Queue queue) throws JMSException;
+
+    QueueBrowser createBrowser(javax.jms.Queue queue, String s) throws JMSException;
+
+    TemporaryQueue createTemporaryQueue() throws JMSException;
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/Session.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/Session.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/Session.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/Session.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.Topic;
+
+
+import java.io.Serializable;
+
+public interface Session extends javax.jms.Session
+{
+    static final int NO_ACKNOWLEDGE = 4;
+
+    static enum AcknowledgeMode { SESSION_TRANSACTED, AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE };
+
+    BytesMessage createBytesMessage() throws JMSException;
+
+    MapMessage createMapMessage() throws JMSException;
+
+    Message createMessage() throws JMSException;
+
+    ObjectMessage createObjectMessage() throws JMSException;
+
+    ObjectMessage createObjectMessage(Serializable serializable) throws JMSException;
+
+    StreamMessage createStreamMessage() throws JMSException;
+
+    TextMessage createTextMessage() throws JMSException;
+
+    TextMessage createTextMessage(String s) throws JMSException;
+
+    AmqpMessage createAmqpMessage() throws JMSException;
+
+    MessageProducer createProducer(Destination destination) throws JMSException;
+
+    MessageConsumer createConsumer(Destination destination) throws JMSException;
+
+    MessageConsumer createConsumer(Destination destination, String s) throws JMSException;
+
+    MessageConsumer createConsumer(Destination destination, String s, boolean b) throws JMSException;
+
+    TopicSubscriber createDurableSubscriber(Topic topic, String s) throws JMSException;
+
+    TopicSubscriber createDurableSubscriber(Topic topic, String s, String s1, boolean b)
+            throws JMSException;
+
+    QueueBrowser createBrowser(Queue queue) throws JMSException;
+
+    QueueBrowser createBrowser(Queue queue, String s) throws JMSException;
+
+    TemporaryQueue createTemporaryQueue() throws JMSException;
+
+    TemporaryTopic createTemporaryTopic() throws JMSException;
+
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/StreamMessage.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/StreamMessage.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/StreamMessage.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/StreamMessage.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+public interface StreamMessage extends Message, javax.jms.StreamMessage
+{
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryQueue.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryQueue.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryQueue.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryQueue.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+public interface TemporaryQueue extends Queue, javax.jms.TemporaryQueue
+{
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryTopic.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryTopic.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryTopic.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryTopic.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+public interface TemporaryTopic extends Topic, javax.jms.TemporaryTopic
+{
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TextMessage.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TextMessage.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TextMessage.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TextMessage.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+public interface TextMessage extends Message, javax.jms.TextMessage
+{
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/Topic.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/Topic.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/Topic.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/Topic.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+public interface Topic extends Destination, javax.jms.Topic
+{
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicConnection.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicConnection.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicConnection.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicConnection.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+public interface TopicConnection extends Connection, javax.jms.TopicConnection
+{
+    TopicSession createTopicSession(boolean b, int i) throws JMSException;
+
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicPublisher.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicPublisher.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicPublisher.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicPublisher.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+public interface TopicPublisher extends MessageProducer, javax.jms.TopicPublisher
+{
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSession.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSession.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSession.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSession.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+
+public interface TopicSession extends Session,javax.jms.TopicSession
+{
+    Topic createTopic(String s) throws JMSException;
+
+    TopicSubscriber createSubscriber(javax.jms.Topic topic) throws JMSException;
+
+    TopicSubscriber createSubscriber(javax.jms.Topic topic, String s, boolean b) throws JMSException;
+
+    TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, String s) throws JMSException;
+
+    TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, String s, String s1, boolean b)
+            throws JMSException;
+
+    TopicPublisher createPublisher(javax.jms.Topic topic) throws JMSException;
+
+    TemporaryTopic createTemporaryTopic() throws JMSException;
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSubscriber.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSubscriber.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSubscriber.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSubscriber.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+public interface TopicSubscriber extends MessageConsumer, javax.jms.TopicSubscriber
+{
+    Topic getTopic() throws JMSException;
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/AmqpMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/AmqpMessageImpl.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/AmqpMessageImpl.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/AmqpMessageImpl.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,73 @@
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.AmqpMessage;
+import org.apache.qpid.amqp_1_0.type.Section;
+import org.apache.qpid.amqp_1_0.type.messaging.ApplicationProperties;
+import org.apache.qpid.amqp_1_0.type.messaging.Footer;
+import org.apache.qpid.amqp_1_0.type.messaging.Header;
+import org.apache.qpid.amqp_1_0.type.messaging.Properties;
+
+import java.util.*;
+
+public class AmqpMessageImpl extends MessageImpl implements AmqpMessage
+{
+    private List<Section> _sections;
+
+    protected AmqpMessageImpl(Header header, Properties properties, ApplicationProperties appProperties, List<Section> sections,
+                              Footer footer, SessionImpl session)
+    {
+        super(header, properties, appProperties, footer, session);
+        _sections = sections;
+    }
+
+    protected AmqpMessageImpl(final SessionImpl session)
+    {
+        super(new Header(), new Properties(), new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
+              session);
+        _sections = new ArrayList<Section>();
+    }
+
+    public int getSectionCount()
+    {
+        return _sections.size();
+    }
+
+    public Section getSection(final int position)
+    {
+        return _sections.get(position);
+    }
+
+    public ListIterator<Section> sectionIterator()
+    {
+        return _sections.listIterator();
+    }
+
+    @Override Collection<Section> getSections()
+    {
+        List<Section> sections = new ArrayList<Section>();
+        sections.add(getHeader());
+        sections.add(getProperties());
+        sections.add(getApplicationProperties());
+        sections.addAll(_sections);
+        sections.add(getFooter());
+        return sections;
+    }
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/BytesMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/BytesMessageImpl.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/BytesMessageImpl.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/BytesMessageImpl.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,484 @@
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.BytesMessage;
+import org.apache.qpid.amqp_1_0.type.Binary;
+import org.apache.qpid.amqp_1_0.type.Section;
+import org.apache.qpid.amqp_1_0.type.messaging.*;
+import org.apache.qpid.amqp_1_0.type.messaging.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.MessageEOFException;
+import javax.jms.MessageFormatException;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.util.*;
+
+public class BytesMessageImpl extends MessageImpl implements BytesMessage
+{
+    private Data _data;
+    private DataInputStream _dataAsInput;
+    private DataOutputStream _dataAsOutput;
+
+    // message created for reading
+    protected BytesMessageImpl(Header header, Properties properties, ApplicationProperties appProperties, Data data,
+                               Footer footer, SessionImpl session)
+    {
+        super(header, properties, appProperties, footer, session);
+        _data = data;
+    }
+
+    // message created to be sent
+    protected BytesMessageImpl(final SessionImpl session)
+    {
+        super(new Header(), new Properties(), new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
+              session);
+        _data = new Data(new Binary(new byte[0]));
+        _dataAsOutput = null;
+    }
+
+    public long getBodyLength() throws JMSException
+    {
+        checkReadable();
+        return _data.getValue().getLength();
+    }
+
+    public boolean readBoolean() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readBoolean();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+
+    public byte readByte() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readByte();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public int readUnsignedByte() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readUnsignedByte();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public short readShort() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readShort();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public int readUnsignedShort() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readUnsignedShort();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public char readChar() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readChar();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public int readInt() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readInt();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public long readLong() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readLong();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public float readFloat() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readFloat();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public double readDouble() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readDouble();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public String readUTF() throws JMSException
+    {
+        checkReadable();
+        try
+        {
+            return _dataAsInput.readUTF();
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public int readBytes(byte[] bytes) throws JMSException
+    {
+
+        return readBytes(bytes, bytes.length);
+    }
+
+    public int readBytes(byte[] bytes, int length) throws JMSException
+    {
+        checkReadable();
+
+        try
+        {
+            int offset = 0;
+            while(offset < length)
+            {
+                int read = _dataAsInput.read(bytes, offset, length - offset);
+                if(read < 0)
+                {
+                    break;
+                }
+                offset += read;
+            }
+
+            if(offset == 0 && length != 0)
+            {
+                return -1;
+            }
+            else
+            {
+                return offset;
+            }
+        }
+        catch (IOException e)
+        {
+            throw handleInputException(e);
+        }
+    }
+
+    public void writeBoolean(boolean b) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeBoolean(b);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+
+    }
+
+    public void writeByte(byte b) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeByte(b);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeShort(short i) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeShort(i);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeChar(char c) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeChar(c);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeInt(int i) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeInt(i);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeLong(long l) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeLong(l);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeFloat(float v) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeFloat(v);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeDouble(double v) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeDouble(v);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeUTF(String s) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.writeUTF(s);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeBytes(byte[] bytes) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.write(bytes);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeBytes(byte[] bytes, int off, int len) throws JMSException
+    {
+        checkWritable();
+        try
+        {
+            _dataAsOutput.write(bytes, off, len);
+        }
+        catch (IOException e)
+        {
+            throw handleOutputException(e);
+        }
+    }
+
+    public void writeObject(Object o) throws JMSException
+    {
+        checkWritable();
+        if(o == null)
+        {
+            throw new NullPointerException("Value passed to BytesMessage.writeObject() must be non null");
+        }
+        else if (o instanceof Boolean)
+        {
+            writeBoolean((Boolean)o);
+        }
+        else if (o instanceof Byte)
+        {
+            writeByte((Byte)o);
+        }
+        else if (o instanceof Short)
+        {
+            writeShort((Short)o);
+        }
+        else if (o instanceof Character)
+        {
+            writeChar((Character)o);
+        }
+        else if (o instanceof Integer)
+        {
+            writeInt((Integer)o);
+        }
+        else if(o instanceof Long)
+        {
+            writeLong((Long)o);
+        }
+        else if(o instanceof Float)
+        {
+            writeFloat((Float) o);
+        }
+        else if(o instanceof Double)
+        {
+            writeDouble((Double) o);
+        }
+        else if(o instanceof String)
+        {
+            writeUTF((String) o);
+        }
+        else if(o instanceof byte[])
+        {
+            writeBytes((byte[])o);
+        }
+        else
+        {
+            throw new MessageFormatException("Value passed to BytesMessage.writeObject() must be of primitive type.  Type passed was " + o.getClass().getName());
+        }
+    }
+
+    public void reset() throws JMSException
+    {
+        //TODO
+    }
+
+    private JMSException handleInputException(final IOException e)
+    {
+        JMSException ex;
+        if(e instanceof EOFException)
+        {
+            ex = new MessageEOFException(e.getMessage());
+        }
+        else
+        {
+            ex = new MessageFormatException(e.getMessage());
+        }
+        ex.initCause(e);
+        ex.setLinkedException(e);
+        return ex;
+    }
+
+    private JMSException handleOutputException(final IOException e)
+    {
+        JMSException ex = new JMSException(e.getMessage());
+        ex.initCause(e);
+        ex.setLinkedException(e);
+        return ex;
+    }
+
+    @Override Collection<Section> getSections()
+    {
+        List<Section> sections = new ArrayList<Section>();
+        sections.add(getHeader());
+        sections.add(getProperties());
+        sections.add(getApplicationProperties());
+        sections.add(_data);
+        sections.add(getFooter());
+        return sections;
+    }
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,222 @@
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.Connection;
+import org.apache.qpid.amqp_1_0.jms.ConnectionMetaData;
+import org.apache.qpid.amqp_1_0.jms.Session;
+
+import javax.jms.ConnectionConsumer;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.ServerSessionPool;
+import javax.jms.Topic;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ConnectionImpl implements Connection
+{
+
+    private ConnectionMetaData _connectionMetaData;
+    private volatile ExceptionListener _exceptionListener;
+
+    private final List<SessionImpl> _sessions = new ArrayList<SessionImpl>();
+
+    private final Object _lock = new Object();
+
+    private org.apache.qpid.amqp_1_0.client.Connection _conn;
+
+
+    private static enum State
+    {
+        STOPPED,
+        STARTED,
+        CLOSED
+    }
+
+    private volatile State _state = State.STOPPED;
+
+    public ConnectionImpl(String host, int port, String username, String password, String clientId) throws JMSException
+    {
+        // TODO - authentication, containerId, clientId, ssl?, etc
+        try
+        {
+            _conn = new org.apache.qpid.amqp_1_0.client.Connection(host, port, username, password);
+            // TODO - retrieve negotiated AMQP version
+            _connectionMetaData = new ConnectionMetaDataImpl(1,0,0);
+        }
+        catch (org.apache.qpid.amqp_1_0.client.Connection.ConnectionException e)
+        {
+            JMSException jmsEx = new JMSException(e.getMessage());
+            jmsEx.setLinkedException(e);
+            jmsEx.initCause(e);
+            throw jmsEx;
+        }
+    }
+
+    public SessionImpl createSession(final boolean transacted, final int acknowledgeMode) throws JMSException
+    {
+        Session.AcknowledgeMode ackMode;
+
+        try
+        {
+            ackMode = transacted ? Session.AcknowledgeMode.SESSION_TRANSACTED
+                                 : Session.AcknowledgeMode.values()[acknowledgeMode];
+        }
+        catch (IndexOutOfBoundsException e)
+        {
+            JMSException jmsEx = new JMSException("Unknown acknowledgement mode " + acknowledgeMode);
+            jmsEx.setLinkedException(e);
+            jmsEx.initCause(e);
+            throw jmsEx;
+        }
+
+        return createSession(ackMode);
+    }
+
+    public SessionImpl createSession(final Session.AcknowledgeMode acknowledgeMode) throws JMSException
+    {
+        synchronized(_lock)
+        {
+            if(_state == State.CLOSED)
+            {
+                throw new JMSException("Cannot create a session on a closed connection");
+            }
+
+            SessionImpl session = new SessionImpl(this, acknowledgeMode);
+
+            _sessions.add(session);
+
+            return session;
+        }
+
+    }
+
+    public String getClientID() throws JMSException
+    {
+        return null;  //TODO
+    }
+
+    public void setClientID(final String s) throws JMSException
+    {
+        throw new IllegalStateException("Cannot set client-id to \""
+                                        + s
+                                        + "\"; client-id must be set on connection creation");
+    }
+
+    public ConnectionMetaData getMetaData() throws JMSException
+    {
+        return _connectionMetaData;
+    }
+
+    public ExceptionListener getExceptionListener() throws JMSException
+    {
+        return _exceptionListener;
+    }
+
+    public void setExceptionListener(final ExceptionListener exceptionListener) throws JMSException
+    {
+        _exceptionListener = exceptionListener;
+    }
+
+    public void start() throws JMSException
+    {
+        synchronized(_lock)
+        {
+
+            if(_state == State.STOPPED)
+            {
+                // TODO
+
+                _state = State.STARTED;
+
+                for(SessionImpl session : _sessions)
+                {
+                    session.start();
+                }
+
+            }
+            _lock.notifyAll();
+        }
+
+    }
+
+    public void stop() throws JMSException
+    {
+        synchronized(_lock)
+        {
+            switch(_state)
+            {
+                case STARTED:
+                    for(SessionImpl session : _sessions)
+                    {
+                        session.stop();
+                    }
+                    _state = State.STOPPED;
+                    break;
+                case CLOSED:
+                    //TODO
+            }
+
+            _lock.notifyAll();
+        }
+    }
+
+    public void close() throws JMSException
+    {
+        synchronized(_lock)
+        {
+            if(_state != State.CLOSED)
+            {
+                stop();
+                for(SessionImpl session : _sessions)
+                {
+                    session.close();
+                }
+                // TODO - close underlying
+                _state = State.CLOSED;
+            }
+
+            _lock.notifyAll();
+        }
+    }
+
+    public ConnectionConsumer createConnectionConsumer(final Destination destination,
+                                                       final String s,
+                                                       final ServerSessionPool serverSessionPool,
+                                                       final int i) throws JMSException
+    {
+        return null;  //TODO
+    }
+
+    public ConnectionConsumer createDurableConnectionConsumer(final Topic topic,
+                                                              final String s,
+                                                              final String s1,
+                                                              final ServerSessionPool serverSessionPool,
+                                                              final int i) throws JMSException
+    {
+        return null;  //TODO
+    }
+
+    protected org.apache.qpid.amqp_1_0.client.Connection getClientConnection()
+    {
+        return _conn;
+    }
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionMetaDataImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionMetaDataImpl.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionMetaDataImpl.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionMetaDataImpl.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,100 @@
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.ConnectionMetaData;
+
+import javax.jms.JMSException;
+import java.util.Enumeration;
+
+public class ConnectionMetaDataImpl implements ConnectionMetaData
+{
+    private static final int JMS_MAJOR_VERSION = 1;
+    private static final int JMS_MINOR_VERSION = 1;
+
+    private static final int PROVIDER_MAJOR_VERSION = 1;
+    private static final int PROVIDER_MINOR_VERSION = 0;
+
+
+    private final int _amqpMajorVersion;
+    private final int _amqpMinorVersion;
+    private final int _amqpRevisionVersion;
+
+    public ConnectionMetaDataImpl(final int amqpMajorVersion, final int amqpMinorVersion, final int amqpRevisionVersion)
+    {
+        _amqpMajorVersion = amqpMajorVersion;
+        _amqpMinorVersion = amqpMinorVersion;
+        _amqpRevisionVersion = amqpRevisionVersion;
+    }
+
+    public String getJMSVersion() throws JMSException
+    {
+        return getJMSMajorVersion() + "." + getJMSMinorVersion();
+    }
+
+    public int getJMSMajorVersion() throws JMSException
+    {
+        return JMS_MAJOR_VERSION;
+    }
+
+    public int getJMSMinorVersion() throws JMSException
+    {
+        return JMS_MINOR_VERSION;
+    }
+
+    public String getJMSProviderName() throws JMSException
+    {
+        return "AMQP.ORG";
+    }
+
+    public String getProviderVersion() throws JMSException
+    {
+        return getProviderMajorVersion() + "." + getProviderMinorVersion();
+    }
+
+    public int getProviderMajorVersion() throws JMSException
+    {
+        return PROVIDER_MAJOR_VERSION;
+    }
+
+    public int getProviderMinorVersion() throws JMSException
+    {
+        return PROVIDER_MINOR_VERSION;
+    }
+
+    public Enumeration getJMSXPropertyNames() throws JMSException
+    {
+        return null;  //TODO
+    }
+
+    public int getAMQPMajorVersion()
+    {
+        return _amqpMajorVersion;
+    }
+
+    public int getAMQPMinorVersion()
+    {
+        return _amqpMinorVersion;
+    }
+
+    public int getAMQPRevisionVersion()
+    {
+        return _amqpRevisionVersion;
+    }
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DestinationImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DestinationImpl.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DestinationImpl.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DestinationImpl.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,42 @@
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.Destination;
+
+public class DestinationImpl implements Destination
+{
+    private final String _address;
+
+    public DestinationImpl(String address)
+    {
+        _address = address;
+    }
+
+    public String getAddress()
+    {
+        return _address;
+    }
+
+    public static DestinationImpl valueOf(String address)
+    {
+        return address == null ? null : new DestinationImpl(address);
+    }
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MapMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MapMessageImpl.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MapMessageImpl.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MapMessageImpl.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,426 @@
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.jms.MapMessage;
+import org.apache.qpid.amqp_1_0.type.Section;
+import org.apache.qpid.amqp_1_0.type.messaging.*;
+import org.apache.qpid.amqp_1_0.type.messaging.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.MessageFormatException;
+import java.util.*;
+
+public class MapMessageImpl extends MessageImpl implements MapMessage
+{
+    private Map _map;
+
+    public MapMessageImpl(Header header, Properties properties, ApplicationProperties appProperties, Map map,
+                          Footer footer,
+                          SessionImpl session)
+    {
+        super(header, properties, appProperties, footer, session);
+        _map = map;
+    }
+
+    MapMessageImpl(final SessionImpl session)
+    {
+        super(new Header(), new Properties(), new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
+              session);
+        _map = new HashMap();
+    }
+
+    public boolean getBoolean(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (value instanceof Boolean)
+        {
+            return ((Boolean) value).booleanValue();
+        }
+        else if ((value instanceof String) || (value == null))
+        {
+            return Boolean.valueOf((String) value);
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to boolean.");
+        }
+    }
+
+    public byte getByte(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (value instanceof Byte)
+        {
+            return ((Byte) value).byteValue();
+        }
+        else if ((value instanceof String) || (value == null))
+        {
+            return Byte.valueOf((String) value).byteValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to byte.");
+        }    }
+
+    public short getShort(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (value instanceof Short)
+        {
+            return ((Short) value).shortValue();
+        }
+        else if (value instanceof Byte)
+        {
+            return ((Byte) value).shortValue();
+        }
+        else if ((value instanceof String) || (value == null))
+        {
+            return Short.valueOf((String) value).shortValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to short.");
+        }    }
+
+    public char getChar(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (!itemExists(name))
+        {
+            throw new MessageFormatException("Property " + name + " not present");
+        }
+        else if (value instanceof Character)
+        {
+            return ((Character) value).charValue();
+        }
+        else if (value == null)
+        {
+            throw new NullPointerException("Property " + name + " has null value and therefore cannot "
+                + "be converted to char.");
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to boolan.");
+        }    }
+
+    public int getInt(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (value instanceof Integer)
+        {
+            return ((Integer) value).intValue();
+        }
+        else if (value instanceof Short)
+        {
+            return ((Short) value).intValue();
+        }
+        else if (value instanceof Byte)
+        {
+            return ((Byte) value).intValue();
+        }
+        else if ((value instanceof String) || (value == null))
+        {
+            return Integer.valueOf((String) value).intValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to int.");
+        }
+    }
+
+    public long getLong(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (value instanceof Long)
+        {
+            return ((Long) value).longValue();
+        }
+        else if (value instanceof Integer)
+        {
+            return ((Integer) value).longValue();
+        }
+
+        if (value instanceof Short)
+        {
+            return ((Short) value).longValue();
+        }
+
+        if (value instanceof Byte)
+        {
+            return ((Byte) value).longValue();
+        }
+        else if ((value instanceof String) || (value == null))
+        {
+            return Long.valueOf((String) value).longValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to long.");
+        }
+    }
+
+    public float getFloat(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (value instanceof Float)
+        {
+            return ((Float) value).floatValue();
+        }
+        else if ((value instanceof String) || (value == null))
+        {
+            return Float.valueOf((String) value).floatValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to float.");
+        }
+    }
+
+    public double getDouble(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (value instanceof Double)
+        {
+            return ((Double) value).doubleValue();
+        }
+        else if (value instanceof Float)
+        {
+            return ((Float) value).doubleValue();
+        }
+        else if ((value instanceof String) || (value == null))
+        {
+            return Double.valueOf((String) value).doubleValue();
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to double.");
+        }
+    }
+
+    public String getString(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if ((value instanceof String) || (value == null))
+        {
+            return (String) value;
+        }
+        else if (value instanceof byte[])
+        {
+            throw new MessageFormatException("Property " + name + " of type byte[] " + "cannot be converted to String.");
+        }
+        else
+        {
+            return value.toString();
+        }
+    }
+
+    public byte[] getBytes(String name) throws JMSException
+    {
+        Object value = get(name);
+
+        if (!itemExists(name))
+        {
+            throw new MessageFormatException("Property " + name + " not present");
+        }
+        else if ((value instanceof byte[]) || (value == null))
+        {
+            return (byte[]) value;
+        }
+        else
+        {
+            throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
+                + " cannot be converted to byte[].");
+        }    }
+
+    public Object getObject(String s) throws JMSException
+    {
+        return get(s);
+    }
+
+    public Enumeration getMapNames() throws JMSException
+    {
+        return Collections.enumeration(keySet());
+    }
+
+    public void setBoolean(String name, boolean val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setByte(String name, byte val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setShort(String name, short val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setChar(String name, char val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setInt(String name, int val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setLong(String name, long val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setFloat(String name, float val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setDouble(String name, double val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setString(String name, String val) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        put(name, val);
+    }
+
+    public void setBytes(String name, byte[] val) throws JMSException
+    {
+        setBytes(name, val, 0, val == null ? 0 : val.length);
+    }
+
+    public void setBytes(String name, byte[] bytes, int offset, int length) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        byte[] val;
+
+        if(bytes == null)
+        {
+            val = null;
+        }
+        else
+        {
+            val = new byte[length];
+            System.arraycopy(bytes,offset,val,0,length);
+        }
+
+        put(name, val);
+    }
+
+    public void setObject(String name, Object value) throws JMSException
+    {
+        checkWritable();
+        checkPropertyName(name);
+        if ((value instanceof Boolean) || (value instanceof Byte) || (value instanceof Short) || (value instanceof Integer)
+                || (value instanceof Long) || (value instanceof Character) || (value instanceof Float)
+                || (value instanceof Double) || (value instanceof String) || (value instanceof byte[]) || (value == null))
+        {
+            put(name, value);
+        }
+        else
+        {
+            throw new MessageFormatException("Cannot set property " + name + " to value " + value + "of type "
+                + value.getClass().getName() + ".");
+        }    }
+
+    public boolean itemExists(String s)
+    {
+        return _map.containsKey(s);
+    }
+
+    public Object get(final Object key)
+    {
+        return _map.get(key);
+    }
+
+    public Object put(final Object key, final Object val)
+    {
+        return _map.put(key, val);
+    }
+
+    public boolean itemExists(final Object key)
+    {
+        return _map.containsKey(key);
+    }
+
+    public Set<Object> keySet()
+    {
+        return _map.keySet();
+    }
+
+    private void checkPropertyName(String propName)
+    {
+        if ((propName == null) || propName.equals(""))
+        {
+            throw new IllegalArgumentException("Property name cannot be null, or the empty String.");
+        }
+    }
+
+    @Override Collection<Section> getSections()
+    {
+        List<Section> sections = new ArrayList<Section>();
+        sections.add(getHeader());
+        sections.add(getProperties());
+        sections.add(getApplicationProperties());
+        sections.add(new AmqpValue(_map));
+        sections.add(getFooter());
+        return sections;
+    }
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,174 @@
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.client.Receiver;
+import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
+import org.apache.qpid.amqp_1_0.type.Binary;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+
+public class MessageConsumerImpl implements MessageConsumer
+{
+    private String _selector;
+    private boolean _noLocal;
+    private DestinationImpl _destination;
+    private SessionImpl _session;
+    private Receiver _receiver;
+    private Binary _lastUnackedMessage;
+
+    MessageConsumerImpl(final Destination destination,
+                        final SessionImpl session,
+                        final String selector,
+                        final boolean noLocal) throws JMSException
+    {
+        _selector = selector;
+        _noLocal = noLocal;
+        if(destination instanceof DestinationImpl)
+        {
+            _destination = (DestinationImpl) destination;
+        }
+        else if(destination != null)
+        {
+            // TODO - throw appropriate exception
+        }
+        _session = session;
+
+        _receiver = createClientReceiver();
+
+    }
+
+    protected Receiver createClientReceiver()
+    {
+        return _session.getClientSession().createReceiver(_destination.getAddress());
+    }
+
+    public String getMessageSelector() throws JMSException
+    {
+        return _selector;
+    }
+
+    public MessageListener getMessageListener() throws JMSException
+    {
+        return null;  //TODO
+    }
+
+    public void setMessageListener(final MessageListener messageListener) throws JMSException
+    {
+        //TODO
+    }
+
+    public MessageImpl receive() throws JMSException
+    {
+        return receiveImpl(-1L);
+    }
+
+    public MessageImpl receive(final long timeout) throws JMSException
+    {
+        // TODO - validate timeout > 0
+
+        return receiveImpl(timeout);
+    }
+
+    public MessageImpl receiveNoWait() throws JMSException
+    {
+        return receiveImpl(0L);
+    }
+
+    private MessageImpl receiveImpl(long timeout)
+    {
+        org.apache.qpid.amqp_1_0.client.Message msg = _receiver.receive(timeout);
+        if(msg != null)
+        {
+            preReceiveAction(msg);
+        }
+        return createJMSMessage(msg);
+    }
+
+
+    void acknowledge(final org.apache.qpid.amqp_1_0.client.Message msg)
+    {
+        _receiver.acknowledge(msg.getDeliveryTag());
+    }
+
+    private MessageImpl createJMSMessage(final org.apache.qpid.amqp_1_0.client.Message msg)
+    {
+        if(msg != null)
+        {
+            MessageFactory factory = _session.getMessageFactory();
+            return factory.createMessage(_destination, msg);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void close() throws JMSException
+    {
+        //TODO
+    }
+
+    void setLastUnackedMessage(final Binary deliveryTag)
+    {
+        _lastUnackedMessage = deliveryTag;
+    }
+
+    void preReceiveAction(final org.apache.qpid.amqp_1_0.client.Message msg)
+    {
+        final int acknowledgeMode = _session.getAcknowledgeMode();
+
+        if(acknowledgeMode == Session.AUTO_ACKNOWLEDGE || acknowledgeMode == Session.DUPS_OK_ACKNOWLEDGE)
+        {
+            acknowledge(msg);
+        }
+        else if(acknowledgeMode == Session.CLIENT_ACKNOWLEDGE)
+        {
+            setLastUnackedMessage(msg.getDeliveryTag());
+        }
+    }
+
+    void acknowledgeAll()
+    {
+        if(_lastUnackedMessage != null)
+        {
+            _receiver.acknowledgeAll(_lastUnackedMessage);
+            _lastUnackedMessage = null;
+        }
+    }
+
+    public DestinationImpl getDestination()
+    {
+        return _destination;
+    }
+
+
+    public SessionImpl getSession()
+    {
+        return _session;
+    }
+
+    public boolean getNoLocal()
+    {
+        return _noLocal;
+    }
+}

Added: qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageFactory.java?rev=1157566&view=auto
==============================================================================
--- qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageFactory.java (added)
+++ qpid/branches/rg-amqp-1-0-sandbox/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageFactory.java Sun Aug 14 17:14:51 2011
@@ -0,0 +1,147 @@
+/*
+ * 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.amqp_1_0.jms.impl;
+
+import org.apache.qpid.amqp_1_0.client.Message;
+import org.apache.qpid.amqp_1_0.type.Section;
+import org.apache.qpid.amqp_1_0.type.messaging.*;
+import org.apache.qpid.amqp_1_0.type.messaging.Properties;
+
+import java.util.*;
+
+class MessageFactory
+{
+    private final SessionImpl _session;
+
+
+    MessageFactory(final SessionImpl session)
+    {
+        _session = session;
+    }
+
+    public MessageImpl createMessage(final DestinationImpl destination, final Message msg)
+    {
+        MessageImpl message;
+        List<Section> payload = msg.getPayload();
+        Header header = null;
+        Properties properties = null;
+        ApplicationProperties appProperties = null;
+        Footer footer;
+
+        Iterator<Section> iter = payload.iterator();
+        List<Section> body = new ArrayList<Section>();
+
+        Section section = iter.hasNext() ? iter.next() : null;
+
+        if(section instanceof Header)
+        {
+            header = (Header) section;
+            section = iter.hasNext() ? iter.next() : null;
+        }
+
+        if(section instanceof Properties)
+        {
+            properties = (Properties) section;
+            section = iter.hasNext() ? iter.next() : null;
+        }
+
+        if(section instanceof ApplicationProperties)
+        {
+            appProperties = (ApplicationProperties) section;
+            section = iter.hasNext() ? iter.next() : null;
+        }
+
+        while(iter.hasNext() || !(section instanceof Footer))
+        {
+            body.add(section);
+            section = iter.hasNext() ? iter.next() : null;
+        }
+
+        footer = (Footer) section;
+
+        if(body.size() == 1)
+        {
+            Section bodySection = body.get(0);
+            if(bodySection instanceof AmqpValue && ((AmqpValue)bodySection).getValue() instanceof Map)
+            {
+                message = new MapMessageImpl(header, properties, appProperties, (Map) ((AmqpValue)bodySection).getValue(), footer, _session);
+            }
+            else if(bodySection instanceof AmqpValue && ((AmqpValue)bodySection).getValue() instanceof Map)
+            {
+                message = new StreamMessageImpl(header, properties, appProperties,
+                                                (List) ((AmqpValue)bodySection).getValue(), footer, _session);
+            }
+            else if(bodySection instanceof Data)
+            {
+                message = new BytesMessageImpl(header, properties, appProperties, (Data) bodySection, footer, _session);
+            }
+            /*else if(bodySection instanceof AmqpDataSection)
+            {
+                AmqpDataSection dataSection = (AmqpDataSection) bodySection;
+
+                List<Object> data = new ArrayList<Object>();
+
+                ListIterator<Object> dataIter = dataSection.iterator();
+
+                while(dataIter.hasNext())
+                {
+                    data.add(dataIter.next());
+                }
+
+                if(data.size() == 1)
+                {
+                    final Object obj = data.get(0);
+                    if( obj instanceof String)
+                    {
+                        message = new TextMessageImpl(header,properties,appProperties,(String) data.get(0),footer, _session);
+                    }
+                    else if(obj instanceof JavaSerializable)
+                    {
+                        // TODO - ObjectMessage
+                        message = new AmqpMessageImpl(header,properties,appProperties,body,footer, _session);
+                    }
+                    else if(obj instanceof Serializable)
+                    {
+                        message = new ObjectMessageImpl(header,properties,footer,appProperties,(Serializable)obj, _session);
+                    }
+                    else
+                    {
+                        message = new AmqpMessageImpl(header,properties,appProperties,body,footer, _session);
+                    }
+                }
+                else
+                {
+                    // not a text message
+                    message = new AmqpMessageImpl(header,properties,appProperties,body,footer, _session);
+                }
+            }*/
+            else
+            {
+                message = new AmqpMessageImpl(header,properties,appProperties,body,footer, _session);
+            }
+        }
+        else
+        {
+            message = new AmqpMessageImpl(header,properties,appProperties,body,footer, _session);
+        }
+
+        return message;
+    }
+}



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org