summaryrefslogtreecommitdiff
path: root/qpid/java/amqp-1-0-client-jms
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2015-04-15 09:47:28 +0000
committerAlex Rudyy <orudyy@apache.org>2015-04-15 09:47:28 +0000
commit0a0baee45ebcff44635907d457c4ff6810b09c87 (patch)
tree8bfb0f9eddbc23cff88af69be80ab3ce7d47011c /qpid/java/amqp-1-0-client-jms
parent54aa3d7070da16ce55c28ccad3f7d0871479e461 (diff)
downloadqpid-python-0a0baee45ebcff44635907d457c4ff6810b09c87.tar.gz
QPID-6481: Move java source tree to top level
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1673693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/amqp-1-0-client-jms')
-rw-r--r--qpid/java/amqp-1-0-client-jms/README.txt12
-rw-r--r--qpid/java/amqp-1-0-client-jms/example/README.txt19
-rw-r--r--qpid/java/amqp-1-0-client-jms/example/pom.xml60
-rw-r--r--qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java121
-rw-r--r--qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/hello.properties28
-rw-r--r--qpid/java/amqp-1-0-client-jms/pom.xml80
-rw-r--r--qpid/java/amqp-1-0-client-jms/resources/LICENSE204
-rw-r--r--qpid/java/amqp-1-0-client-jms/resources/NOTICE5
-rw-r--r--qpid/java/amqp-1-0-client-jms/resources/README.txt7
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/assembly/LICENSE202
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/assembly/NOTICE10
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/assembly/README.txt3
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE34
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/assembly/qpid-amqp-1-0-client-jms-bin.xml69
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/AmqpMessage.java32
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/BytesMessage.java26
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Connection.java37
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ConnectionFactory.java31
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ConnectionMetaData.java28
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Destination.java28
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java25
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/JavaSerializable.java24
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MapMessage.java37
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Message.java170
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumer.java36
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java47
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducer.java27
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java47
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java34
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ObjectMessage.java27
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Queue.java26
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueBrowser.java30
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueConnection.java30
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueReceiver.java29
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSender.java29
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSession.java42
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Session.java75
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java35
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/StreamMessage.java26
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryDestination.java33
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryQueue.java26
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryTopic.java26
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TextMessage.java26
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Topic.java26
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicConnection.java30
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicPublisher.java26
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSession.java43
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSubscriber.java29
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/AmqpMessageImpl.java99
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/BytesMessageImpl.java563
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java800
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java718
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionMetaDataImpl.java105
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DecodedDestination.java47
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DestinationImpl.java108
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MapMessageImpl.java466
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java536
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageFactory.java351
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageImpl.java1486
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java543
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ObjectMessageImpl.java176
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueBrowserImpl.java215
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueConnectionImpl.java48
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueImpl.java68
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueReceiverImpl.java62
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueSenderImpl.java36
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueSessionImpl.java57
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java1066
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java475
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java107
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java112
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java108
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java48
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java68
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java36
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java56
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java143
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/AnnotationDecoder.java395
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/AnnotationEncoder.java175
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/JsonDecoder.java379
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/JsonEncoder.java140
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/NameParserImpl.java37
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/PropertiesFileInitialContextFactory.java238
-rw-r--r--qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/ReadOnlyContext.java522
84 files changed, 0 insertions, 12686 deletions
diff --git a/qpid/java/amqp-1-0-client-jms/README.txt b/qpid/java/amqp-1-0-client-jms/README.txt
deleted file mode 100644
index eac8344aac..0000000000
--- a/qpid/java/amqp-1-0-client-jms/README.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Documentation
-=============
-
-You can access documentation for the client via our website at:
-http://qpid.apache.org/documentation
-
-and via our wiki at:
-http://cwiki.apache.org/confluence/display/qpid/Qpid+Java+Documentation
-
-The client uses the Java Message Service (JMS) 1.1 API, information on which is
-widely available using your favoured search engine.
-
diff --git a/qpid/java/amqp-1-0-client-jms/example/README.txt b/qpid/java/amqp-1-0-client-jms/example/README.txt
deleted file mode 100644
index 592e747cde..0000000000
--- a/qpid/java/amqp-1-0-client-jms/example/README.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-===========================
-Running the client examples
-===========================
-
-Use maven to build the module, and additionally copy the dependencies
-alongside their output:
-
- mvn clean package dependency:copy-dependencies -DincludeScope=runtime -DskipTests
-
-Now you can run the examples using commands of the format:
-
- java -cp "target/classes/:target/dependency/*" org.apache.qpid.amqp_1_0.jms.example.Hello
-
-NOTE: This example requires that you first create a queue named "queue" on your broker.
-
-
-NOTE: The earlier build command will cause Maven to resolve the client artifact
-dependencies against its local and remote repositories. If you wish to use a
-locally-built client, ensure to install it in your local maven repo first.
diff --git a/qpid/java/amqp-1-0-client-jms/example/pom.xml b/qpid/java/amqp-1-0-client-jms/example/pom.xml
deleted file mode 100644
index f4aad83be2..0000000000
--- a/qpid/java/amqp-1-0-client-jms/example/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-java-build</artifactId>
- <version>0.32-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <artifactId>qpid-amqp-1-0-client-jms-examples</artifactId>
- <name>Qpid AMQP 1.0 JMS Client Examples</name>
- <description>JMS client examples.</description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-amqp-1-0-client-jms</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>${geronimo-jms-1-1-version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <directory>src/main/java</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-
-</project>
diff --git a/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java b/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java
deleted file mode 100644
index 670f358a26..0000000000
--- a/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * 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.example;
-
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-public class Hello
-{
- public Hello()
- {
- }
-
- public static void main(String[] args)
- {
- Hello hello = new Hello();
- hello.runExample();
- }
-
- private void runExample()
- {
- try(InputStream propertiesStream = getClass().getResourceAsStream("hello.properties"))
- {
- Properties properties = new Properties();
- // Read the hello.properties JNDI properties file and use contents to create the InitialContext.
- properties.load(propertiesStream);
- Context context = new InitialContext(properties);
- // Alternatively, JNDI information can be supplied by setting the "java.naming.factory.initial"
- // system property to value "org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory"
- // and setting the "java.naming.provider.url" system property as a URL to a properties file.
-
- ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("localhost");
- Connection connection = connectionFactory.createConnection();
-
- Session producersession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Queue queue = (Queue) context.lookup("queue");
-
- Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer messageConsumer = consumerSession.createConsumer(queue);
-
- final CountDownLatch latch = new CountDownLatch(1);
- messageConsumer.setMessageListener(new MessageListener()
- {
- public void onMessage(final Message message)
- {
- try
- {
- if(message instanceof TextMessage)
- {
- System.out.println(((TextMessage) message).getText());
- }
- else
- {
- System.out.println("Received enexpected message type: " + message.getClass().getName());
- }
-
- latch.countDown();
- }
- catch (JMSException e)
- {
- System.out.println("Caught exception in onMessage(): " + e.getMessage());
- }
- }
- });
-
- connection.start();
-
- MessageProducer messageProducer = producersession.createProducer(queue);
- TextMessage message = producersession.createTextMessage("Hello world!");
-
- messageProducer.send(message);
-
- int delay = 5;
- if(!latch.await(delay, TimeUnit.SECONDS))
- {
- System.out.println("Waited " + delay + "sec but no message recieved.");
- }
-
- connection.close();
- context.close();
- }
- catch (Exception exp)
- {
- System.out.println("Caught exception: " + exp.getMessage());
- exp.printStackTrace();
- }
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/hello.properties b/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/hello.properties
deleted file mode 100644
index 2b99523a90..0000000000
--- a/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/hello.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# 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.
-#
-java.naming.factory.initial = org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory
-
-# register some connection factories
-# connectionfactory.[jndiname] = [ConnectionURL]
-connectionfactory.localhost = amqp://guest:guest@localhost:5672?clientid=test-client&remote-host=default
-# Remove the remote-host option to make the AMQP open-frame hostname field simply match the URL hostname
-
-# Register an AMQP destination in JNDI
-# destination.[jniName] = [Address Format]
-queue.queue = queue
diff --git a/qpid/java/amqp-1-0-client-jms/pom.xml b/qpid/java/amqp-1-0-client-jms/pom.xml
deleted file mode 100644
index d261bf1f19..0000000000
--- a/qpid/java/amqp-1-0-client-jms/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-java-build</artifactId>
- <version>0.32-SNAPSHOT</version>
- </parent>
-
- <artifactId>qpid-amqp-1-0-client-jms</artifactId>
- <name>Qpid AMQP 1.0 Client JMS</name>
- <description>AMQP 1.0 compliant JMS module</description>
-
- <properties>
- <dependency-change-verification>true</dependency-change-verification>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-amqp-1-0-client</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-amqp-1-0-common</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>${geronimo-jms-1-1-version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <!--version specified in parent pluginManagement -->
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/qpid-amqp-1-0-client-jms-bin.xml</descriptor>
- </descriptors>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/qpid/java/amqp-1-0-client-jms/resources/LICENSE b/qpid/java/amqp-1-0-client-jms/resources/LICENSE
deleted file mode 100644
index de4b130f35..0000000000
--- a/qpid/java/amqp-1-0-client-jms/resources/LICENSE
+++ /dev/null
@@ -1,204 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
-
diff --git a/qpid/java/amqp-1-0-client-jms/resources/NOTICE b/qpid/java/amqp-1-0-client-jms/resources/NOTICE
deleted file mode 100644
index 8d1c3f3122..0000000000
--- a/qpid/java/amqp-1-0-client-jms/resources/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Qpid
-Copyright 2006-2012 Apache Software Foundation
-This product includes software developed at
-Apache Software Foundation (http://www.apache.org/)
-
diff --git a/qpid/java/amqp-1-0-client-jms/resources/README.txt b/qpid/java/amqp-1-0-client-jms/resources/README.txt
deleted file mode 100644
index 35d25050fe..0000000000
--- a/qpid/java/amqp-1-0-client-jms/resources/README.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
-Documentation
---------------
-All of our user documentation can be accessed at:
-
-http://qpid.apache.org/documentation.html
-
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/assembly/LICENSE b/qpid/java/amqp-1-0-client-jms/src/main/assembly/LICENSE
deleted file mode 100644
index 7a4a3ea242..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/assembly/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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. \ No newline at end of file
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/assembly/NOTICE b/qpid/java/amqp-1-0-client-jms/src/main/assembly/NOTICE
deleted file mode 100644
index c4f26d1b6b..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/assembly/NOTICE
+++ /dev/null
@@ -1,10 +0,0 @@
-Qpid AMQP 1.0 JMS Client
-Copyright 2006-2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-###############################################
-
-Apache Geronimo JMS 1.1 Spec
-Copyright 2003-2008 The Apache Software Foundation \ No newline at end of file
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/assembly/README.txt b/qpid/java/amqp-1-0-client-jms/src/main/assembly/README.txt
deleted file mode 100644
index eec46a52f0..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/assembly/README.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Documentation for the Qpid components can be accessed on our website at:
-
-http://qpid.apache.org/documentation.html
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE b/qpid/java/amqp-1-0-client-jms/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE
deleted file mode 100644
index d911ef629d..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# 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.
-#
-
-#// ------------------------------------------------------------------
-# TRIMMED 3RD PARTY DEPENDENCY INFORMATION FOR MODIFICATION CHECKS
-#// ------------------------------------------------------------------
-
-
-
-From: 'The Apache Software Foundation' (http://www.apache.org/)
- - Qpid AMQP 1.0 Client (http://qpid.apache.org/qpid-java-build/qpid-amqp-1-0-client) org.apache.qpid:qpid-amqp-1-0-client:jar
- License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
- - Qpid AMQP 1.0 Common (http://qpid.apache.org/qpid-java-build/qpid-amqp-1-0-common) org.apache.qpid:qpid-amqp-1-0-common:jar
- License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
-
-
-
-
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/assembly/qpid-amqp-1-0-client-jms-bin.xml b/qpid/java/amqp-1-0-client-jms/src/main/assembly/qpid-amqp-1-0-client-jms-bin.xml
deleted file mode 100644
index 0608c9f478..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/assembly/qpid-amqp-1-0-client-jms-bin.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- 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.
-
--->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>bin</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <baseDirectory>qpid-amqp-1-0-client-jms/${project.version}</baseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}/src/main/assembly/</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>README.txt</include>
- <include>NOTICE</include>
- <include>LICENSE</include>
- </includes>
- <fileMode>0644</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- <fileSet>
- <directory>${basedir}/example</directory>
- <outputDirectory>example</outputDirectory>
- <includes>
- <include>src/**</include>
- <include>pom.xml</include>
- <include>README.txt</include>
- </includes>
- <fileMode>0644</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/lib</outputDirectory>
- <useProjectArtifact>true</useProjectArtifact>
- </dependencySet>
- <dependencySet>
- <outputDirectory>/lib</outputDirectory>
- <useProjectArtifact>false</useProjectArtifact>
- <scope>provided</scope>
- <includes>
- <include>org.apache.geronimo.specs:geronimo-jms_1.1_spec</include>
- </includes>
- </dependencySet>
- </dependencySets>
-</assembly>
-
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/AmqpMessage.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/AmqpMessage.java
deleted file mode 100644
index 4c8ff9d998..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/AmqpMessage.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 org.apache.qpid.amqp_1_0.type.Section;
-
-import java.util.ListIterator;
-
-public interface AmqpMessage extends Message
-{
- int getSectionCount();
-
- Section getSection(int position);
-
- ListIterator<Section> sectionIterator();
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/BytesMessage.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/BytesMessage.java
deleted file mode 100644
index 5ae4c2695a..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/BytesMessage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * 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 BytesMessage extends Message, javax.jms.BytesMessage
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Connection.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Connection.java
deleted file mode 100644
index 08e3c4673e..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Connection.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * 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 Connection extends javax.jms.Connection
-{
-
- ConnectionMetaData getMetaData() throws JMSException;
-
- Session createSession(boolean transacted, int acknowledgeMode) throws JMSException;
-
- Session createSession(Session.AcknowledgeMode acknowledgeMode) throws JMSException;
-
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ConnectionFactory.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ConnectionFactory.java
deleted file mode 100644
index 752993b229..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ConnectionFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * 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 ConnectionFactory extends javax.jms.ConnectionFactory
-{
- Connection createConnection() throws JMSException;
-
- Connection createConnection(String username, String password) throws JMSException;
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ConnectionMetaData.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ConnectionMetaData.java
deleted file mode 100644
index 425d7f9795..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ConnectionMetaData.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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 ConnectionMetaData extends javax.jms.ConnectionMetaData
-{
- int getAMQPMajorVersion();
-
- int getAMQPMinorVersion();
-
- int getAMQPRevisionVersion();
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Destination.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Destination.java
deleted file mode 100644
index a7f37eea14..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Destination.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *
- * 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 Destination extends javax.jms.Destination
-{
- public String getAddress();
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java
deleted file mode 100644
index e362befc67..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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 ErrorCodes
-{
- public static final String CHANNELS_EXHAUSTED = "org.apache:channels-exhausted";
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/JavaSerializable.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/JavaSerializable.java
deleted file mode 100644
index 0202ac80a7..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/JavaSerializable.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 JavaSerializable
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MapMessage.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MapMessage.java
deleted file mode 100644
index a758d04237..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MapMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * 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;
-import java.util.Set;
-
-public interface MapMessage extends Message, javax.jms.MapMessage
-{
- public Object get(Object key) throws JMSException;
-
- public Object put(Object key, Object val) throws JMSException;
-
- public boolean itemExists(Object key) throws JMSException;
-
- Set<Object> keySet() throws JMSException;
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Message.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Message.java
deleted file mode 100644
index f640dc55f5..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Message.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- *
- * 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 java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.jms.JMSException;
-
-import org.apache.qpid.amqp_1_0.type.Binary;
-import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.UnsignedByte;
-import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-import org.apache.qpid.amqp_1_0.type.UnsignedLong;
-import org.apache.qpid.amqp_1_0.type.UnsignedShort;
-
-
-public interface Message extends javax.jms.Message
-{
-
- Destination getJMSReplyTo() throws JMSException;
-
- Destination getJMSDestination() throws JMSException;
-
- // properties can be keyed by any valid apache.qpid.amqp_1_0 datatype, not just strings
-
- boolean propertyExists(Object name) throws JMSException;
-
- boolean getBooleanProperty(Object name) throws JMSException;
-
- byte getByteProperty(Object name) throws JMSException;
-
- short getShortProperty(Object name) throws JMSException;
-
- int getIntProperty(Object name) throws JMSException;
-
- long getLongProperty(Object name) throws JMSException;
-
- float getFloatProperty(Object name) throws JMSException;
-
- double getDoubleProperty(Object name) throws JMSException;
-
- String getStringProperty(Object name) throws JMSException;
-
- Object getObjectProperty(Object name) throws JMSException;
-
- // apache.qpid.amqp_1_0 allows for lists, maps, and unsigned integral data types
-
- List<Object> getListProperty(Object name) throws JMSException;
-
- Map<Object,Object> getMapProperty(Object name) throws JMSException;
-
- UnsignedByte getUnsignedByteProperty(Object name) throws JMSException;
-
- UnsignedShort getUnsignedShortProperty(Object name) throws JMSException;
-
- UnsignedInteger getUnsignedIntProperty(Object name) throws JMSException;
-
- UnsignedLong getUnsignedLongProperty(Object name) throws JMSException;
-
- // properties can be keyed by any valid apache.qpid.amqp_1_0 datatype, not just strings
-
- void setBooleanProperty(Object name, boolean b) throws JMSException;
-
- void setByteProperty(Object name, byte b) throws JMSException;
-
- void setShortProperty(Object name, short i) throws JMSException;
-
- void setIntProperty(Object name, int i) throws JMSException;
-
- void setLongProperty(Object name, long l) throws JMSException;
-
- void setFloatProperty(Object name, float v) throws JMSException;
-
- void setDoubleProperty(Object name, double v) throws JMSException;
-
- void setStringProperty(Object name, String s1) throws JMSException;
-
- void setObjectProperty(Object name, Object o) throws JMSException;
-
- // apache.qpid.amqp_1_0 allows for lists, maps, and unsigned integral data types
-
- void setListProperty(Object name, List<Object> list) throws JMSException;
-
- void setMapProperty(Object name, Map<Object,Object> map) throws JMSException;
-
- void setUnsignedByteProperty(Object name, UnsignedByte b) throws JMSException;
-
- void setUnsignedShortProperty(Object name, UnsignedShort s) throws JMSException;
-
- void setUnsignedIntProperty(Object name, UnsignedInteger i) throws JMSException;
-
- void setUnsignedLongProperty(Object name, UnsignedLong l) throws JMSException;
-
- // delegation accessors for Header section
-
- UnsignedInteger getDeliveryFailures();
-
- void setDeliveryFailures(UnsignedInteger failures);
-
- Boolean getDurable();
-
- void setDurable(Boolean durable);
-
- UnsignedByte getPriority();
-
- void setPriority(UnsignedByte priority);
-
- Date getTransmitTime();
-
- void setTransmitTime(Date transmitTime);
-
- UnsignedInteger getTtl();
-
- void setTtl(UnsignedInteger ttl);
-
- UnsignedInteger getFormerAcquirers();
-
- void setFormerAcquirers(UnsignedInteger formerAcquirers);
-
- // delegation accessors for Properties section
-
- Object getMessageId();
-
- void setMessageId(Object messageId);
-
- Binary getUserId();
-
- void setUserId(Binary userId);
-
- String getTo();
-
- void setTo(String to);
-
- String getSubject();
-
- void setSubject(String subject);
-
- String getReplyTo();
-
- void setReplyTo(String replyTo);
-
- Object getCorrelationId();
-
- void setCorrelationId(Binary correlationId);
-
- Symbol getContentType();
-
- void setContentType(Symbol contentType);
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumer.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumer.java
deleted file mode 100644
index 7c28a7ef7e..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * 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 MessageConsumer extends javax.jms.MessageConsumer
-{
-
- Message receive() throws JMSException;
-
- Message receive(long l) throws JMSException;
-
- Message receiveNoWait() throws JMSException;
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java
deleted file mode 100644
index 3fad24f61c..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 class MessageConsumerException extends JMSException
-{
- private String _destinationName = null;
-
- public MessageConsumerException(String reason)
- {
- super(reason);
- }
-
- public MessageConsumerException(String reason, String errorCode)
- {
- super(reason, errorCode);
- }
-
- public MessageConsumerException(String reason, String errorCode, String destinationName)
- {
- super(reason, errorCode);
- _destinationName = destinationName;
- }
-
- public String getDestinationName()
- {
- return _destinationName;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducer.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducer.java
deleted file mode 100644
index 19090e713c..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * 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 MessageProducer extends javax.jms.MessageProducer
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java
deleted file mode 100644
index 45ea4662ac..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 class MessageProducerException extends JMSException
-{
- private String _destinationName = null;
-
- public MessageProducerException(String reason)
- {
- super(reason);
- }
-
- public MessageProducerException(String reason, String errorCode)
- {
- super(reason, errorCode);
- }
-
- public MessageProducerException(String reason, String errorCode, String destinationName)
- {
- super(reason, errorCode);
- _destinationName = destinationName;
- }
-
- public String getDestinationName()
- {
- return _destinationName;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java
deleted file mode 100644
index fa559e060f..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 class MessageRejectedException extends JMSException
-{
- public MessageRejectedException(String reason)
- {
- super(reason);
- }
-
- public MessageRejectedException(java.lang.String reason, java.lang.String errorCode)
- {
- super(reason, errorCode);
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ObjectMessage.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ObjectMessage.java
deleted file mode 100644
index 4dcd96d1ec..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ObjectMessage.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * 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 ObjectMessage extends Message, javax.jms.ObjectMessage
-{
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Queue.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Queue.java
deleted file mode 100644
index 880eadea9b..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Queue.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * 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 Queue extends Destination, javax.jms.Queue
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueBrowser.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueBrowser.java
deleted file mode 100644
index b6d20cbdd5..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueBrowser.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * 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 QueueBrowser extends javax.jms.QueueBrowser
-{
- Queue getQueue() throws JMSException;
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueConnection.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueConnection.java
deleted file mode 100644
index 5404fbeb56..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueConnection.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * 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 QueueConnection extends javax.jms.QueueConnection, Connection
-{
- QueueSession createQueueSession(boolean b, int i) throws JMSException;
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueReceiver.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueReceiver.java
deleted file mode 100644
index 3b2fcb7b45..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueReceiver.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * 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;
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSender.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSender.java
deleted file mode 100644
index 27116463d1..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSender.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * 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;
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSession.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSession.java
deleted file mode 100644
index 4ccd5d96a6..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/QueueSession.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * 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;
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Session.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Session.java
deleted file mode 100644
index 387bfeddb1..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Session.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * 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 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;
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java
deleted file mode 100644
index 73be5513c3..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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 class SessionException extends JMSException
-{
- public SessionException(String reason)
- {
- super(reason);
- }
-
- public SessionException(String reason, String errorCode)
- {
- super(reason, errorCode);
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/StreamMessage.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/StreamMessage.java
deleted file mode 100644
index 6fc728f4bb..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/StreamMessage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * 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
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryDestination.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryDestination.java
deleted file mode 100644
index 025a1af806..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryDestination.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * 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 TemporaryDestination
-{
- Session getSession();
-
- boolean isDeleted();
-
- void addConsumer(MessageConsumer consumer);
-
- void removeConsumer(MessageConsumer consumer);
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryQueue.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryQueue.java
deleted file mode 100644
index e08e4b5996..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryQueue.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * 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, TemporaryDestination, javax.jms.TemporaryQueue
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryTopic.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryTopic.java
deleted file mode 100644
index a9ceabdc2a..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TemporaryTopic.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * 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, TemporaryDestination, javax.jms.TemporaryTopic
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TextMessage.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TextMessage.java
deleted file mode 100644
index d6911e2357..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TextMessage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * 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
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Topic.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Topic.java
deleted file mode 100644
index c401081176..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/Topic.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * 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
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicConnection.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicConnection.java
deleted file mode 100644
index 8334a186f5..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicConnection.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * 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;
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicPublisher.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicPublisher.java
deleted file mode 100644
index 66aa69b518..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicPublisher.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * 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
-{
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSession.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSession.java
deleted file mode 100644
index 764d00380b..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSession.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * 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;
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSubscriber.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSubscriber.java
deleted file mode 100644
index c0546b8a75..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/TopicSubscriber.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * 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;
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/AmqpMessageImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/AmqpMessageImpl.java
deleted file mode 100644
index 0afbb5c56f..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/AmqpMessageImpl.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-
-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.AmqpValue;
-import org.apache.qpid.amqp_1_0.type.messaging.ApplicationProperties;
-import org.apache.qpid.amqp_1_0.type.messaging.DeliveryAnnotations;
-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.MessageAnnotations;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-public class AmqpMessageImpl extends MessageImpl implements AmqpMessage
-{
- private static final List<Section> EMPTY_MESSAGE =
- Collections.<Section>singletonList(new AmqpValue(null));
- private List<Section> _sections;
-
- protected AmqpMessageImpl(Header header,
- DeliveryAnnotations deliveryAnnotations,
- MessageAnnotations messageAnnotations,
- Properties properties,
- ApplicationProperties appProperties,
- List<Section> sections,
- Footer footer,
- SessionImpl session)
- {
- super(header, deliveryAnnotations, messageAnnotations, properties, appProperties, footer, session);
- _sections = sections;
- }
-
- protected AmqpMessageImpl(final SessionImpl session)
- {
- super(new Header(),
- new DeliveryAnnotations(new HashMap()),
- new MessageAnnotations(new HashMap()), new Properties(), new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
- session);
- _sections = EMPTY_MESSAGE;
- }
-
- 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());
- if(getDeliveryAnnotations() != null && getDeliveryAnnotations().getValue() != null && !getDeliveryAnnotations().getValue().isEmpty())
- {
- sections.add(getDeliveryAnnotations());
- }
- if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
- {
- sections.add(getMessageAnnotations());
- }
- sections.add(getProperties());
- sections.add(getApplicationProperties());
- sections.addAll(_sections);
- sections.add(getFooter());
- return sections;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/BytesMessageImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/BytesMessageImpl.java
deleted file mode 100644
index 4fb9c511bf..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/BytesMessageImpl.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
- * 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 java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.jms.JMSException;
-import javax.jms.MessageEOFException;
-import javax.jms.MessageFormatException;
-
-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.ApplicationProperties;
-import org.apache.qpid.amqp_1_0.type.messaging.Data;
-import org.apache.qpid.amqp_1_0.type.messaging.DeliveryAnnotations;
-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.MessageAnnotations;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-public class BytesMessageImpl extends MessageImpl implements BytesMessage
-{
- private DataInputStream _dataAsInput;
- private DataOutputStream _dataAsOutput;
- private ByteArrayOutputStream _bytesOut;
- private Data _dataIn;
-
- // message created for reading
- protected BytesMessageImpl(Header header,
- DeliveryAnnotations deliveryAnnotations,
- MessageAnnotations messageAnnotations,
- Properties properties,
- ApplicationProperties appProperties,
- Data data,
- Footer footer,
- SessionImpl session)
- {
- super(header, deliveryAnnotations, messageAnnotations, properties, appProperties, footer, session);
- _dataIn = data;
- final Binary dataBuffer = data.getValue();
- _dataAsInput = new DataInputStream(new ByteArrayInputStream(dataBuffer.getArray(),dataBuffer.getArrayOffset(),dataBuffer.getLength()));
-
- }
-
- // message created to be sent
- protected BytesMessageImpl(final SessionImpl session)
- {
- super(new Header(),
- new DeliveryAnnotations(new HashMap()), new MessageAnnotations(new HashMap()),
- new Properties(),
- new ApplicationProperties(new HashMap()),
- new Footer(Collections.EMPTY_MAP),
- session);
-
- _bytesOut = new ByteArrayOutputStream();
- _dataAsOutput = new DataOutputStream(_bytesOut);
- }
-
-
- private Data getDataSection()
- {
- if(_bytesOut != null)
- {
- return new Data(new Binary(_bytesOut.toByteArray()));
- }
- else
- {
- return _dataIn;
- }
- }
-
- @Override
- protected boolean isReadOnly()
- {
- return _dataIn != null;
- }
-
- public long getBodyLength() throws JMSException
- {
- checkReadable();
- return getDataSection().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
- {
- if(_bytesOut != null)
- {
- byte[] data = _bytesOut.toByteArray();
- _dataIn = new Data(new Binary(data));
- _dataAsInput = new DataInputStream(new ByteArrayInputStream(data));
- _dataAsOutput = null;
- _bytesOut = null;
- }
- else
- {
-
- final Binary dataBuffer = _dataIn.getValue();
- _dataAsInput = new DataInputStream(new ByteArrayInputStream(dataBuffer.getArray(),dataBuffer.getArrayOffset(),dataBuffer.getLength()));
-
- }
- }
-
- 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
- public void clearBody() throws JMSException
- {
- super.clearBody();
- _bytesOut = new ByteArrayOutputStream();
- _dataAsOutput = new DataOutputStream(_bytesOut);
- _dataAsInput = null;
- _dataIn = null;
- }
-
- @Override Collection<Section> getSections()
- {
- List<Section> sections = new ArrayList<Section>();
- sections.add(getHeader());
- if(getDeliveryAnnotations() != null && getDeliveryAnnotations().getValue() != null && !getDeliveryAnnotations().getValue().isEmpty())
- {
- sections.add(getDeliveryAnnotations());
- }
- if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
- {
- sections.add(getMessageAnnotations());
- }
- sections.add(getProperties());
- sections.add(getApplicationProperties());
- sections.add(getDataSection());
- sections.add(getFooter());
- return sections;
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java
deleted file mode 100644
index e92cd15ce5..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- *
- * 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 java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLDecoder;
-import java.net.URLStreamHandler;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.cert.X509Certificate;
-import java.util.HashMap;
-import java.util.Map;
-import javax.jms.JMSException;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManagerFactory;
-
-import org.apache.qpid.amqp_1_0.client.SSLOptions;
-import org.apache.qpid.amqp_1_0.client.SSLUtil;
-import org.apache.qpid.amqp_1_0.jms.ConnectionFactory;
-
-
-public class ConnectionFactoryImpl implements ConnectionFactory, TopicConnectionFactory, QueueConnectionFactory
-{
- private final String _protocol;
- private String _host;
- private int _port;
- private String _username;
- private String _password;
- private String _clientId;
- private String _remoteHost;
- private boolean _ssl;
-
- private String _queuePrefix;
- private String _topicPrefix;
- private boolean _useBinaryMessageId = Boolean.parseBoolean(System.getProperty("qpid.use_binary_message_id", "true"));
- private Boolean _syncPublish;
- private int _maxSessions = Integer.getInteger("qpid.max_sessions", 0);
- private int _maxPrefetch;
- private String _keyStorePath;
- private String _keyStorePassword;
- private String _keyStoreCertAlias;
- private String _trustStorePath;
- private String _trustStorePassword;
- private String _sslContextProtocol;
- private String _sslContextProvider;
- private String _sslEnabledProtocols;
- private String _sslDisabledProtocols;
-
-
-
- private SSLContext _sslContext;
- private SSLOptions _sslOptions;
-
-
- public ConnectionFactoryImpl(final String host,
- final int port,
- final String username,
- final String password)
- {
- this(host,port,username,password,null,false);
- }
-
- public ConnectionFactoryImpl(final String host,
- final int port,
- final String username,
- final String password,
- final String clientId)
- {
- this(host,port,username,password,clientId,false);
- }
-
- public ConnectionFactoryImpl(final String host,
- final int port,
- final String username,
- final String password,
- final String clientId,
- final boolean ssl)
- {
- this(host,port,username,password,clientId,null,ssl);
- }
-
- public ConnectionFactoryImpl(final String host,
- final int port,
- final String username,
- final String password,
- final String clientId,
- final String remoteHost,
- final boolean ssl)
- {
- this(host, port, username, password, clientId, remoteHost, ssl,0);
- }
-
- public ConnectionFactoryImpl(final String host,
- final int port,
- final String username,
- final String password,
- final String clientId,
- final String remoteHost,
- final boolean ssl,
- final int maxSessions)
- {
- this(ssl?"amqps":"amqp",host,port,username,password,clientId,remoteHost,ssl,maxSessions);
- }
-
- public ConnectionFactoryImpl(final String protocol,
- final String host,
- final int port,
- final String username,
- final String password,
- final String clientId,
- final String remoteHost,
- final boolean ssl,
- final int maxSessions)
- {
- _protocol = protocol;
- _host = host;
- _port = port;
- _username = username;
- _password = password;
- _clientId = clientId;
- _remoteHost = remoteHost;
- _ssl = ssl;
- _maxSessions = maxSessions;
- if(System.getProperties().containsKey("qpid.sync_publish"))
- {
- _syncPublish = Boolean.getBoolean("qpid.sync_publish");
- }
- }
-
- public ConnectionImpl createConnection() throws JMSException
- {
- return createConnection(_username, _password);
- }
-
- public ConnectionImpl createConnection(String username, final String password) throws JMSException
- {
- synchronized (this)
- {
- if(_ssl && _sslContext == null)
- {
- try
- {
- _sslContext = SSLUtil.buildSslContext(_keyStoreCertAlias,_keyStorePath,
- KeyStore.getDefaultType(),
- _keyStorePassword,
- KeyManagerFactory.getDefaultAlgorithm(),
- _trustStorePath,_trustStorePassword,
- KeyStore.getDefaultType(),
- TrustManagerFactory.getDefaultAlgorithm(),
- _sslContextProtocol,
- _sslContextProvider
- );
- if(username == null && _keyStoreCertAlias != null)
- {
- X509Certificate[] certs = SSLUtil.getClientCertificates(_keyStoreCertAlias,
- _keyStorePath,
- _keyStorePassword,
- KeyStore.getDefaultType(),
- KeyManagerFactory.getDefaultAlgorithm());
- if(certs != null && certs.length != 0)
- {
- username = certs[0].getSubjectDN().getName();
- }
- }
-
- }
- catch (GeneralSecurityException e)
- {
- final JMSException jmsException = new JMSException("Unable to create SSL context");
- jmsException.setLinkedException(e);
- jmsException.initCause(e);
- throw jmsException;
- }
- catch (IOException e)
- {
- final JMSException jmsException = new JMSException("Unable to create SSL context");
- jmsException.setLinkedException(e);
- jmsException.initCause(e);
- throw jmsException; }
- }
- }
- ConnectionImpl connection = new ConnectionImpl(_protocol,_host, _port, username, password, _clientId, _remoteHost, _sslContext, _maxSessions);
- connection.setQueuePrefix(_queuePrefix);
- connection.setTopicPrefix(_topicPrefix);
- connection.setUseBinaryMessageId(_useBinaryMessageId);
- connection.setSyncPublish(_syncPublish);
- connection.setSslOptions(_sslOptions);
- if(_maxPrefetch != 0)
- {
- connection.setMaxPrefetch(_maxPrefetch);
- }
- return connection;
- }
-
- public void setMaxPrefetch(final int maxPrefetch)
- {
- _maxPrefetch = maxPrefetch;
- }
-
- public void setKeyStorePath(final String keyStorePath)
- {
- _keyStorePath = keyStorePath;
- }
-
- public void setKeyStorePassword(final String keyStorePassword)
- {
- _keyStorePassword = keyStorePassword;
- }
-
- public void setSslContextProtocol(final String sslContextProtocol)
- {
- _sslContextProtocol = sslContextProtocol;
- }
-
- public void setSslContextProvider(final String sslContextProvider)
- {
- _sslContextProvider = sslContextProvider;
- }
-
- public void setKeyStoreCertAlias(final String keyStoreCertAlias)
- {
- _keyStoreCertAlias = keyStoreCertAlias;
- }
-
- public void setTrustStorePath(final String trustStorePath)
- {
- _trustStorePath = trustStorePath;
- }
-
- public void setTrustStorePassword(final String trustStorePassword)
- {
- _trustStorePassword = trustStorePassword;
- }
-
- private static class ConnectionOptions
- {
- String username;
- String password;
- String clientId;
- String remoteHost;
-
- boolean binaryMessageId = true;
- Boolean syncPublish;
- int maxSessions;
- public boolean ssl;
- public int maxPrefetch;
- public String trustStorePath;
- public String trustStorePassword;
- public String keyStorePath;
- public String keyStorePassword;
- public String keyStoreCertAlias;
- public String sslContextProvider;
- public String sslContextProtocol;
- public String sslEnabledProtocols;
- public String sslDisabledProtocols;
- }
-
-
-
- private static abstract class OptionSetter
- {
-
- private static final Map<String, OptionSetter> OPTION_SETTER_MAP = new HashMap<String, OptionSetter>();
- private final String _name;
- private final String _description;
-
- public OptionSetter(String name, String description)
- {
- OPTION_SETTER_MAP.put(name.toLowerCase(), this);
- _name = name;
- _description = description;
- }
-
- public abstract void setOption(ConnectionOptions options, String value) throws MalformedURLException;
-
- public static void parseOptions(URL url, ConnectionOptions options) throws MalformedURLException
- {
- String query = url.getQuery();
- if(query != null)
- {
- for(String param : query.split("&"))
- {
-
- String[] keyValuePair = param.split("=",2);
- OptionSetter setter = OPTION_SETTER_MAP.get(keyValuePair[0]);
- if(setter != null)
- {
- setter.setOption(options, keyValuePair[1]);
- }
- else
- {
- throw new MalformedURLException("Unknown URL option: '"+keyValuePair[0]+"' in connection URL");
- }
-
- }
- }
- }
- }
-
- private static final OptionSetter[] _options =
- {
- new OptionSetter("clientid", "JMS client id / AMQP container id")
- {
- public void setOption(ConnectionOptions options, String value)
- {
- options.clientId = value;
- }
- },
- new OptionSetter("ssl", "Set to \"true\" to use SSL encryption")
- {
- public void setOption(ConnectionOptions options, String value)
- {
- options.ssl = Boolean.valueOf(value);
- }
- },
- new OptionSetter("remote-host", "AMQP remote host")
- {
- public void setOption(ConnectionOptions options, String value)
- {
- options.remoteHost = value;
- }
- },
- new OptionSetter("binary-messageid", "Use binary (rather than String) message ids")
- {
- public void setOption(ConnectionOptions options, String value)
- {
- options.binaryMessageId = Boolean.parseBoolean(value);
- }
- },
- new OptionSetter("sync-publish", "Wait for acknowledge when sending messages")
- {
- public void setOption(ConnectionOptions options, String value)
- {
- if("".equals(value) || "default".equals(value))
- {
- options.syncPublish = null;
- }
- else
- {
- options.syncPublish = Boolean.parseBoolean(value);
- }
- }
- },
- new OptionSetter("max-sessions", "set maximum number of sessions allowed")
- {
- public void setOption(ConnectionOptions options, String value)
- {
- options.maxSessions = Integer.parseInt(value);
- }
- },
- new OptionSetter("max-prefetch", "set maximum number of messages prefetched on a link")
- {
- public void setOption(ConnectionOptions options, String value)
- {
- options.maxPrefetch = Integer.parseInt(value);
- }
- },
- new OptionSetter("trust-store","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.trustStorePath = value;
- }
- },
- new OptionSetter("trust-store-password","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.trustStorePassword = value;
- }
- },
- new OptionSetter("key-store","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.keyStorePath = value;
- }
- },
- new OptionSetter("key-store-password","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.keyStorePassword = value;
- }
- },
- new OptionSetter("ssl-cert-alias","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.keyStoreCertAlias = value;
- }
- },
- new OptionSetter("ssl-context-provider","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.sslContextProvider = value;
- }
- },
- new OptionSetter("ssl-context-protocol","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.sslContextProtocol = value;
- }
- },
- new OptionSetter("ssl-enabled-protocols","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.sslEnabledProtocols = value;
- }
- },
- new OptionSetter("ssl-disabled-protocols","")
- {
- public void setOption(final ConnectionOptions options, final String value) throws MalformedURLException
- {
- options.sslDisabledProtocols = value;
- }
- }
-
- };
-
- public static ConnectionFactoryImpl createFromURL(final String urlString) throws MalformedURLException
- {
- URL url = new URL(null, urlString, new URLStreamHandler()
- {
- @Override
- protected URLConnection openConnection(URL u) throws IOException
- {
- throw new UnsupportedOperationException();
- }
- });
- String protocol = url.getProtocol();
- if (protocol == null || "".equals(protocol))
- {
- protocol = "amqp";
- }
- String host = url.getHost();
- int port = url.getPort();
-
- final ConnectionOptions options = new ConnectionOptions();
- if (port == -1)
- {
- if ("amqps".equals(protocol))
- {
- port = 5671;
- options.ssl = true;
- }
- else if("amqp".equals(protocol))
- {
- port = 5672;
- }
- else if("ws".equals(protocol))
- {
- port = 80;
- }
- else if("wss".equals(protocol))
- {
- port = 443;
- }
- }
- else if ("amqps".equals(protocol) || "wss".equals(protocol))
- {
- options.ssl = true;
- }
-
-
- String userInfo = url.getUserInfo();
-
- if (userInfo != null)
- {
- String[] components = userInfo.split(":", 2);
- options.username = URLDecoder.decode(components[0]);
- if (components.length == 2)
- {
- options.password = URLDecoder.decode(components[1]);
- }
- }
-
- if(System.getProperties().containsKey("qpid.sync_publish"))
- {
- options.syncPublish = Boolean.getBoolean("qpid.sync_publish");
- }
-
- OptionSetter.parseOptions(url, options);
-
- if (options.remoteHost == null)
- {
- options.remoteHost = host;
- }
-
- ConnectionFactoryImpl connectionFactory =
- new ConnectionFactoryImpl(protocol,
- host,
- port,
- options.username,
- options.password,
- options.clientId,
- options.remoteHost,
- options.ssl,
- options.maxSessions);
- connectionFactory.setUseBinaryMessageId(options.binaryMessageId);
- connectionFactory.setSyncPublish(options.syncPublish);
- if (options.maxPrefetch != 0)
- {
- connectionFactory.setMaxPrefetch(options.maxPrefetch);
- }
- if (options.keyStorePath != null)
- {
- connectionFactory.setKeyStorePath(options.keyStorePath);
- }
- if (options.keyStorePassword != null)
- {
- connectionFactory.setKeyStorePassword(options.keyStorePassword);
- }
- if (options.keyStoreCertAlias != null)
- {
- connectionFactory.setKeyStoreCertAlias(options.keyStoreCertAlias);
- }
- if (options.trustStorePath != null)
- {
- connectionFactory.setTrustStorePath(options.trustStorePath);
- }
- if (options.trustStorePassword != null)
- {
- connectionFactory.setTrustStorePassword(options.trustStorePassword);
- }
- if (options.sslContextProvider != null)
- {
- connectionFactory.setSslContextProvider(options.sslContextProvider);
- }
- if (options.sslContextProtocol != null)
- {
- connectionFactory.setSslContextProtocol(options.sslContextProtocol);
- }
- if (options.sslEnabledProtocols != null)
- {
- connectionFactory.setSslEnabledProtocols(options.sslEnabledProtocols);
- }
- if (options.sslDisabledProtocols != null)
- {
- connectionFactory.setSslDisabledProtocols(options.sslDisabledProtocols);
- }
-
- return connectionFactory;
-
- }
-
- public QueueConnection createQueueConnection() throws JMSException
- {
- final ConnectionImpl connection = createConnection();
- connection.setQueueConnection(true);
- return connection;
- }
-
- public QueueConnection createQueueConnection(final String username, final String password) throws JMSException
- {
- final ConnectionImpl connection = createConnection(username, password);
- connection.setQueueConnection(true);
- return connection;
- }
-
- public TopicConnection createTopicConnection() throws JMSException
- {
- final ConnectionImpl connection = createConnection();
- connection.setTopicConnection(true);
- return connection;
- }
-
- public TopicConnection createTopicConnection(final String username, final String password) throws JMSException
- {
- final ConnectionImpl connection = createConnection(username, password);
- connection.setTopicConnection(true);
- return connection;
- }
-
- public String getTopicPrefix()
- {
- return _topicPrefix;
- }
-
- public void setTopicPrefix(String topicPrefix)
- {
- _topicPrefix = topicPrefix;
- }
-
- public String getQueuePrefix()
- {
- return _queuePrefix;
- }
-
- public void setQueuePrefix(String queuePrefix)
- {
- _queuePrefix = queuePrefix;
- }
-
- public void setUseBinaryMessageId(boolean useBinaryMessageId)
- {
- _useBinaryMessageId = useBinaryMessageId;
- }
-
- public void setSyncPublish(Boolean syncPublish)
- {
- _syncPublish = syncPublish;
- }
-
- public String getSslContextProvider()
- {
- return _sslContextProvider;
- }
-
- public String getSslContextProtocol()
- {
- return _sslContextProtocol;
- }
-
- public String getTrustStorePassword()
- {
- return _trustStorePassword;
- }
-
- public String getTrustStorePath()
- {
- return _trustStorePath;
- }
-
- public String getKeyStoreCertAlias()
- {
- return _keyStoreCertAlias;
- }
-
- public String getKeyStorePassword()
- {
- return _keyStorePassword;
- }
-
- public String getKeyStorePath()
- {
- return _keyStorePath;
- }
-
- public int getMaxPrefetch()
- {
- return _maxPrefetch;
- }
-
- public int getMaxSessions()
- {
- return _maxSessions;
- }
-
- public Boolean getSyncPublish()
- {
- return _syncPublish;
- }
-
- public boolean isUseBinaryMessageId()
- {
- return _useBinaryMessageId;
- }
-
- public boolean isSsl()
- {
- return _ssl;
- }
-
- public String getRemoteHost()
- {
- return _remoteHost;
- }
-
- public String getClientId()
- {
- return _clientId;
- }
-
- public String getPassword()
- {
- return _password;
- }
-
- public String getUsername()
- {
- return _username;
- }
-
- public int getPort()
- {
- return _port;
- }
-
- public String getHost()
- {
- return _host;
- }
-
- public String getProtocol()
- {
- return _protocol;
- }
-
- public void setHost(final String host)
- {
- _host = host;
- }
-
- public void setPort(final int port)
- {
- _port = port;
- }
-
- public void setUsername(final String username)
- {
- _username = username;
- }
-
- public void setPassword(final String password)
- {
- _password = password;
- }
-
- public void setClientId(final String clientId)
- {
- _clientId = clientId;
- }
-
- public void setRemoteHost(final String remoteHost)
- {
- _remoteHost = remoteHost;
- }
-
- public void setSsl(final boolean ssl)
- {
- _ssl = ssl;
- }
-
- public void setMaxSessions(final int maxSessions)
- {
- _maxSessions = maxSessions;
- }
-
- public String getSslEnabledProtocols()
- {
- return _sslEnabledProtocols;
- }
-
- public SSLContext getSslContext()
- {
- return _sslContext;
- }
-
- public void setSslContext(final SSLContext sslContext)
- {
- _sslContext = sslContext;
- }
-
- public void setSslEnabledProtocols(final String sslEnabledProtocols)
- {
- _sslEnabledProtocols = sslEnabledProtocols;
- _sslOptions = new SSLOptions(_sslEnabledProtocols, _sslDisabledProtocols);
- }
-
- public String getSslDisabledProtocols()
- {
- return _sslDisabledProtocols;
- }
-
- public void setSslDisabledProtocols(final String sslDisabledProtocols)
- {
- _sslDisabledProtocols = sslDisabledProtocols;
- _sslOptions = new SSLOptions(_sslEnabledProtocols, _sslDisabledProtocols);
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java
deleted file mode 100644
index ca3d3dfbcd..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java
+++ /dev/null
@@ -1,718 +0,0 @@
-/*
- * 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 java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import javax.jms.ConnectionConsumer;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import javax.jms.JMSSecurityException;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueSession;
-import javax.jms.ServerSessionPool;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicSession;
-import javax.net.ssl.SSLContext;
-
-import org.apache.qpid.amqp_1_0.client.ConnectionErrorException;
-import org.apache.qpid.amqp_1_0.client.ConnectionException;
-import org.apache.qpid.amqp_1_0.client.SSLOptions;
-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 org.apache.qpid.amqp_1_0.transport.Container;
-import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
-import org.apache.qpid.amqp_1_0.type.transport.Error;
-
-public class ConnectionImpl implements Connection, QueueConnection, TopicConnection
-{
-
- private final String _protocol;
- private final SSLContext _sslContext;
- 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 boolean _isQueueConnection;
- private boolean _isTopicConnection;
- private final Collection<CloseTask> _closeTasks = new ArrayList<CloseTask>();
- private String _host;
- private int _port;
- private final String _username;
- private final String _password;
- private String _remoteHost;
- private String _clientId;
- private String _queuePrefix;
- private String _topicPrefix;
- private boolean _useBinaryMessageId = Boolean.parseBoolean(System.getProperty("qpid.use_binary_message_id", "true"));
- private Boolean _syncPublish;
- private int _maxSessions;
- private int _maxPrefetch;
- private SSLOptions _sslOptions;
-
- private static enum State
- {
- UNCONNECTED,
- STOPPED,
- STARTED,
- CLOSED
- }
-
- private volatile State _state = State.UNCONNECTED;
-
- public ConnectionImpl(String host, int port, String username, String password, String clientId) throws JMSException
- {
- this(host,port,username,password,clientId,false);
- }
-
- public ConnectionImpl(String host, int port, String username, String password, String clientId, boolean ssl) throws JMSException
- {
- this(host,port,username,password,clientId,null,ssl);
- }
-
- public ConnectionImpl(String host, int port, String username, String password, String clientId, String remoteHost, boolean ssl) throws JMSException
- {
- this(host, port, username, password, clientId, remoteHost, ssl,0);
- }
-
-
- public ConnectionImpl(String host, int port, String username, String password, String clientId, String remoteHost, boolean ssl, int maxSessions) throws JMSException
- {
- this(ssl?"amqps":"amqp",host,port,username,password,clientId,remoteHost,ssl,maxSessions);
- }
-
- public ConnectionImpl(String protocol, String host, int port, String username, String password, String clientId, String remoteHost, boolean ssl, int maxSessions) throws JMSException
- {
- this(protocol,
- host,
- port,
- username,
- password,
- clientId,
- remoteHost,
- ssl ? getDefaultSSLContext() : null,
- maxSessions);
- }
-
- private static SSLContext getDefaultSSLContext() throws JMSException
- {
- try
- {
- return SSLContext.getDefault();
- }
- catch (NoSuchAlgorithmException e)
- {
- JMSException jmsException = new JMSException(e.getMessage());
- jmsException.setLinkedException(e);
- jmsException.initCause(e);
- throw jmsException;
- }
- }
-
- public ConnectionImpl(String protocol, String host, int port, String username, String password, String clientId, String remoteHost, SSLContext sslContext, int maxSessions) throws JMSException
- {
- _protocol = protocol;
- _host = host;
- _port = port;
- _username = username;
- _password = password;
- _clientId = clientId;
- _remoteHost = remoteHost;
- _sslContext = sslContext;
- _maxSessions = maxSessions;
-
- if(! "".equals(System.getProperty("qpid.sync_publish","")))
- {
- _syncPublish = Boolean.getBoolean("qpid.sync_publish");
- }
- }
-
- private void connect() throws JMSException
- {
- synchronized(_lock)
- {
- // already connected?
- if( _state == State.UNCONNECTED )
- {
- _state = State.STOPPED;
-
- Container container = _clientId == null ? new Container() : new Container(_clientId);
-
- try
- {
- _conn = new org.apache.qpid.amqp_1_0.client.Connection(_protocol, _host,
- _port, _username, _password, container, _remoteHost, _sslContext,
- _sslOptions,
- _maxSessions - 1);
- _conn.setConnectionErrorTask(new ConnectionErrorTask());
- // TODO - retrieve negotiated AMQP version
- _connectionMetaData = new ConnectionMetaDataImpl(1,0,0);
- Error connectionError = _conn.getConnectionError();
- if(connectionError != null)
- {
- throw new JMSException(connectionError.getDescription(),
- connectionError.getCondition().toString());
- }
- else if(_conn.getEndpoint().requiresSASL() && !_conn.getEndpoint().isAuthenticated())
- {
- throw new JMSSecurityException("Failed to authenticate user[" + _username + "].");
- }
- }
- catch (ConnectionException e)
- {
- JMSException jmsEx = new JMSException(e.getMessage());
- jmsEx.setLinkedException(e);
- jmsEx.initCause(e);
- throw jmsEx;
- }
- finally
- {
- if(_conn == null)
- {
- _state = State.UNCONNECTED;
- }
- }
-
- }
- }
- }
-
- private void checkNotConnected(String msg) throws IllegalStateException
- {
- synchronized(_lock)
- {
- if( _state != State.UNCONNECTED )
- {
- throw new IllegalStateException(msg);
- }
- }
- }
-
- 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
- {
- boolean started = false;
- synchronized(_lock)
- {
- if(_state == State.CLOSED)
- {
- throw new IllegalStateException("Cannot create a session on a closed connection");
- }
- else if(_state == State.UNCONNECTED)
- {
- connect();
- started = true;
- }
- }
-
- try
- {
- SessionImpl session = new SessionImpl(this, acknowledgeMode);
- session.setQueueSession(_isQueueConnection);
- session.setTopicSession(_isTopicConnection);
- if(_maxPrefetch != 0)
- {
- session.setMaxPrefetch(_maxPrefetch);
- }
-
- boolean connectionStarted = false;
- synchronized(_lock)
- {
- checkClosed();
- _sessions.add(session);
- connectionStarted = _state == State.STARTED;
- }
-
- if(connectionStarted)
- {
- session.start();
- }
-
- return session;
- }
- catch(JMSException e)
- {
- Error remoteError;
- if(started
- && e.getLinkedException() instanceof ConnectionErrorException
- && (remoteError = ((ConnectionErrorException)e.getLinkedException()).getRemoteError()).getCondition() == ConnectionError.REDIRECT)
- {
- String networkHost = (String) remoteError.getInfo().get(Symbol.valueOf("network-host"));
- int port = (Integer) remoteError.getInfo().get(Symbol.valueOf("port"));
- String hostName = (String) remoteError.getInfo().get(Symbol.valueOf("hostname"));
- reconnect(networkHost,port,hostName);
- return createSession(acknowledgeMode);
-
- }
- else
- {
- throw e;
- }
- }
- }
-
- void removeSession(SessionImpl session)
- {
- synchronized (_lock)
- {
- _sessions.remove(session);
- }
- }
-
- private void reconnect(String networkHost, int port, String hostName)
- {
- synchronized(_lock)
- {
- _state = State.UNCONNECTED;
- _host = networkHost;
- _port = port;
- _remoteHost = hostName;
- _conn = null;
- }
- }
-
- public String getClientID() throws JMSException
- {
- checkClosed();
- return _clientId;
- }
-
- public void setClientID(final String value) throws JMSException
- {
- checkNotConnected("Cannot set client-id to \""
- + value
- + "\"; client-id must be set before the connection is used");
- if( _clientId !=null )
- {
- throw new IllegalStateException("client-id has already been set");
- }
- _clientId = value;
- }
-
- public ConnectionMetaData getMetaData() throws JMSException
- {
- checkClosed();
- return _connectionMetaData;
- }
-
- public ExceptionListener getExceptionListener() throws JMSException
- {
- checkClosed();
- return _exceptionListener;
- }
-
- public void setExceptionListener(final ExceptionListener exceptionListener) throws JMSException
- {
- checkClosed();
- _exceptionListener = exceptionListener;
- }
-
- public void start() throws JMSException
- {
- List<SessionImpl> stoppedSessions = null;
- synchronized(_lock)
- {
- checkClosed();
- connect();
- if(_state == State.STOPPED)
- {
- // TODO
-
- _state = State.STARTED;
- stoppedSessions = new ArrayList<SessionImpl>(_sessions);
- }
-
- _lock.notifyAll();
- }
-
- if (stoppedSessions != null)
- {
- for(SessionImpl session : stoppedSessions)
- {
- session.start();
- }
- }
- }
-
- public void stop() throws JMSException
- {
- List<SessionImpl> startedSessions = null;
- synchronized(_lock)
- {
- switch(_state)
- {
- case STARTED:
- startedSessions = new ArrayList<SessionImpl>(_sessions);
- case UNCONNECTED:
- _state = State.STOPPED;
- break;
- case CLOSED:
- throw new javax.jms.IllegalStateException("Closed");
- }
-
- _lock.notifyAll();
- }
-
- if (startedSessions != null)
- {
- for(SessionImpl session : startedSessions)
- {
- session.stop();
- }
- }
- }
-
-
- static interface CloseTask
- {
- public void onClose() throws JMSException;
- }
-
- void addOnCloseTask(CloseTask task)
- {
- synchronized (_lock)
- {
- _closeTasks.add(task);
- }
- }
-
-
- void removeOnCloseTask(CloseTask task)
- {
- synchronized (_lock)
- {
- _closeTasks.remove(task);
- }
- }
-
- public void close() throws JMSException
- {
- List<SessionImpl> sessions = null;
- List<CloseTask> closeTasks = null;
- boolean closeConnection = false;
- synchronized(_lock)
- {
- if(_state != State.CLOSED)
- {
- _state = State.CLOSED;
- sessions = new ArrayList<SessionImpl>(_sessions);
- closeTasks = new ArrayList<CloseTask>(_closeTasks);
- closeConnection = _conn != null && _state != State.UNCONNECTED;
- }
-
- _lock.notifyAll();
- }
-
- List<JMSException> errors = new ArrayList<JMSException>();
-
- if (sessions != null)
- {
- for(SessionImpl session : sessions)
- {
- try
- {
- session.close();
- }
- catch(JMSException e)
- {
- errors.add(e);
- }
- }
- for(CloseTask task : closeTasks)
- {
- task.onClose();
- }
- if(closeConnection)
- {
- try
- {
- _conn.close();
- }
- catch (ConnectionErrorException e)
- {
- final JMSException jmsException = new JMSException("Error while closing connection: " + e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- }
- }
-
- if(!errors.isEmpty())
- {
- final JMSException jmsException = new JMSException("Error while closing connection: " + errors.get(0).getMessage());
- jmsException.setLinkedException(errors.get(0));
- throw jmsException;
- }
- }
-
- private void checkClosed() throws IllegalStateException
- {
- if(_state == State.CLOSED)
- throw new IllegalStateException("Closed");
- }
-
- public ConnectionConsumer createConnectionConsumer(final Destination destination,
- final String s,
- final ServerSessionPool serverSessionPool,
- final int i) throws JMSException
- {
- checkClosed();
- return null; //TODO
- }
-
- public TopicSession createTopicSession(final boolean transacted, final int acknowledgeMode) throws JMSException
- {
- checkClosed();
- SessionImpl session = createSession(transacted, acknowledgeMode);
- session.setTopicSession(true);
- return session;
- }
-
- public ConnectionConsumer createConnectionConsumer(final Topic topic,
- final String s,
- final ServerSessionPool serverSessionPool,
- final int i) throws JMSException
- {
- checkClosed();
- return null; //TODO
- }
-
- public ConnectionConsumer createDurableConnectionConsumer(final Topic topic,
- final String s,
- final String s1,
- final ServerSessionPool serverSessionPool,
- final int i) throws JMSException
- {
- checkClosed();
- if (_isQueueConnection)
- {
- throw new IllegalStateException("QueueConnection cannot be used to create Pub/Sub based resources.");
- }
- return null; //TODO
- }
-
- public QueueSession createQueueSession(final boolean transacted, final int acknowledgeMode) throws JMSException
- {
- checkClosed();
- SessionImpl session = createSession(transacted, acknowledgeMode);
- session.setQueueSession(true);
- return session;
- }
-
- public ConnectionConsumer createConnectionConsumer(final Queue queue,
- final String s,
- final ServerSessionPool serverSessionPool,
- final int i) throws JMSException
- {
- checkClosed();
- return null; //TODO
- }
-
-
-
- protected org.apache.qpid.amqp_1_0.client.Connection getClientConnection()
- {
- return _conn;
- }
-
- public boolean isStarted()
- {
- return _state == State.STARTED;
- }
-
- void setQueueConnection(final boolean queueConnection)
- {
- _isQueueConnection = queueConnection;
- }
-
- void setTopicConnection(final boolean topicConnection)
- {
- _isTopicConnection = topicConnection;
- }
-
- public String getTopicPrefix()
- {
- return _topicPrefix;
- }
-
- public void setTopicPrefix(String topicPrefix)
- {
- _topicPrefix = topicPrefix;
- }
-
- public String getQueuePrefix()
- {
- return _queuePrefix;
- }
-
- public void setQueuePrefix(String queueprefix)
- {
- _queuePrefix = queueprefix;
- }
-
- DecodedDestination toDecodedDestination(DestinationImpl dest)
- {
- String address = dest.getAddress();
- Set<String> kind = null;
- Class clazz = dest.getClass();
- if( clazz==QueueImpl.class )
- {
- kind = MessageImpl.JMS_QUEUE_ATTRIBUTES;
- if( _queuePrefix!=null )
- {
- // Avoid double prefixing..
- if( !address.startsWith(_queuePrefix) )
- {
- address = _queuePrefix+address;
- }
- }
- }
- else if( clazz==TopicImpl.class )
- {
- kind = MessageImpl.JMS_TOPIC_ATTRIBUTES;
- if( _topicPrefix!=null )
- {
- // Avoid double prefixing..
- if( !address.startsWith(_topicPrefix) )
- {
- address = _topicPrefix+address;
- }
- }
- }
- else if( clazz==TemporaryQueueImpl.class )
- {
- kind = MessageImpl.JMS_TEMP_QUEUE_ATTRIBUTES;
- }
- else if( clazz==TemporaryTopicImpl.class )
- {
- kind = MessageImpl.JMS_TEMP_TOPIC_ATTRIBUTES;
- }
- return new DecodedDestination(address, kind);
- }
-
- DecodedDestination toDecodedDestination(String address, Set<String> kind)
- {
- if( (kind == null || kind.equals(MessageImpl.JMS_QUEUE_ATTRIBUTES)) && _queuePrefix!=null && address.startsWith(_queuePrefix))
- {
- return new DecodedDestination(address.substring(_queuePrefix.length()), MessageImpl.JMS_QUEUE_ATTRIBUTES);
- }
- if( (kind == null || kind.equals(MessageImpl.JMS_TOPIC_ATTRIBUTES)) && _topicPrefix!=null && address.startsWith(_topicPrefix))
- {
- return new DecodedDestination(address.substring(_topicPrefix.length()), MessageImpl.JMS_TOPIC_ATTRIBUTES);
- }
- return new DecodedDestination(address, kind);
- }
-
- void setUseBinaryMessageId(boolean useBinaryMessageId)
- {
- _useBinaryMessageId = useBinaryMessageId;
- }
-
- boolean useBinaryMessageId()
- {
- return _useBinaryMessageId;
- }
-
- void setSyncPublish(Boolean syncPublish)
- {
- _syncPublish = syncPublish;
- }
-
- Boolean syncPublish()
- {
- return _syncPublish;
- }
-
- public void setMaxPrefetch(final int maxPrefetch)
- {
- _maxPrefetch = maxPrefetch;
- }
-
- public void setSslOptions(final SSLOptions sslOptions)
- {
- _sslOptions = sslOptions;
- }
-
- public SSLOptions getSslOptions()
- {
- return _sslOptions;
- }
-
- private class ConnectionErrorTask implements Runnable
- {
-
- @Override
- public void run()
- {
-
- try
- {
- final ExceptionListener exceptionListener = getExceptionListener();
-
- if(exceptionListener != null)
- {
- final org.apache.qpid.amqp_1_0.type.transport.Error connectionError = _conn.getConnectionError();
- if(connectionError != null)
- {
- exceptionListener.onException(new JMSException(connectionError.getDescription(),
- connectionError.getCondition().toString()));
- }
- }
- }
- catch (JMSException ignored)
- {
- // ignored
- }
- }
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionMetaDataImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionMetaDataImpl.java
deleted file mode 100644
index 64f7c065a7..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionMetaDataImpl.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-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;
- private static final Collection<String> _jmsxProperties = Arrays.asList("JMSXGroupID", "JMSXGroupSeq");
-
- 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 Collections.enumeration(_jmsxProperties);
- }
-
- public int getAMQPMajorVersion()
- {
- return _amqpMajorVersion;
- }
-
- public int getAMQPMinorVersion()
- {
- return _amqpMinorVersion;
- }
-
- public int getAMQPRevisionVersion()
- {
- return _amqpRevisionVersion;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DecodedDestination.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DecodedDestination.java
deleted file mode 100644
index 74e98c2163..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DecodedDestination.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 java.util.Set;
-
-/**
-* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
-*/
-class DecodedDestination
-{
- private final String _address;
- private final Set<String> _attributes;
-
- DecodedDestination(String address, Set<String> kind)
- {
- _address = address;
- _attributes = kind;
- }
-
- public String getAddress()
- {
- return _address;
- }
-
- public Set<String> getAttributes()
- {
- return _attributes;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DestinationImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DestinationImpl.java
deleted file mode 100644
index 526c1a290d..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/DestinationImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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;
-import org.apache.qpid.amqp_1_0.jms.Queue;
-import org.apache.qpid.amqp_1_0.jms.Topic;
-
-import javax.jms.JMSException;
-import java.util.UUID;
-import java.util.WeakHashMap;
-
-public class DestinationImpl implements Destination
-{
- private static final WeakHashMap<String, DestinationImpl> DESTINATION_CACHE =
- new WeakHashMap<String, DestinationImpl>();
-
- private final String _address;
- private String _localTerminus;
-
- protected DestinationImpl(String address)
- {
- _address = address;
- }
-
- public String getAddress()
- {
- return _address;
- }
-
- public static DestinationImpl valueOf(String address)
- {
- return address == null ? null : createDestination(address);
- }
-
- @Override
- public int hashCode()
- {
- return _address.hashCode();
- }
-
- @Override
- public boolean equals(final Object obj)
- {
- return obj != null
- && obj.getClass() == getClass()
- && _address.equals(((DestinationImpl)obj)._address);
- }
-
- public static synchronized DestinationImpl createDestination(String address)
- {
- DestinationImpl destination;
- if (address.endsWith("!!"))
- {
- address = address.substring(0, address.length() - 2);
- String localTerminusName = UUID.randomUUID().toString();
- destination = new DestinationImpl(address);
- destination.setLocalTerminus(localTerminusName);
- }
- else
- {
- destination = DESTINATION_CACHE.get(address);
- if (destination == null)
- {
- destination = new DestinationImpl(address);
- DESTINATION_CACHE.put(address, destination);
- }
- }
- return destination;
- }
-
- public String getQueueName() throws JMSException
- {
- return getAddress();
- }
-
- public String getTopicName() throws JMSException
- {
- return getAddress();
- }
-
- void setLocalTerminus(final String localTerminus)
- {
- _localTerminus = localTerminus;
- }
-
- String getLocalTerminus()
- {
- return _localTerminus;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MapMessageImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MapMessageImpl.java
deleted file mode 100644
index acdfecfeee..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MapMessageImpl.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jms.JMSException;
-import javax.jms.MessageFormatException;
-
-import org.apache.qpid.amqp_1_0.jms.MapMessage;
-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.AmqpValue;
-import org.apache.qpid.amqp_1_0.type.messaging.ApplicationProperties;
-import org.apache.qpid.amqp_1_0.type.messaging.DeliveryAnnotations;
-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.MessageAnnotations;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-public class MapMessageImpl extends MessageImpl implements MapMessage
-{
- private Map _map;
-
- public MapMessageImpl(Header header,
- DeliveryAnnotations deliveryAnnotations,
- MessageAnnotations messageAnnotations,
- Properties properties,
- ApplicationProperties appProperties,
- Map map,
- Footer footer,
- SessionImpl session)
- {
- super(header, deliveryAnnotations, messageAnnotations, properties, appProperties, footer, session);
- _map = map;
- }
-
- MapMessageImpl(final SessionImpl session)
- {
- super(new Header(), new DeliveryAnnotations(new HashMap()), new MessageAnnotations(new HashMap()),
- 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[] || value instanceof Binary)
- {
- 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 if(value instanceof Binary)
- {
- return ((Binary)value).getArray();
- }
- else
- {
- throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
- + " cannot be converted to byte[].");
- } }
-
- public Object getObject(String s) throws JMSException
- {
- Object val = get(s);
- return val instanceof Binary ? ((Binary)val).getArray() : val;
- }
-
- 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, new Binary(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();
- }
-
- @Override
- public void clearBody() throws JMSException
- {
- super.clearBody();
- _map.clear();
- }
-
- 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());
- if(getDeliveryAnnotations() != null && getDeliveryAnnotations().getValue() != null && !getDeliveryAnnotations().getValue().isEmpty())
- {
- sections.add(getDeliveryAnnotations());
- }
- if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
- {
- sections.add(getMessageAnnotations());
- }
- sections.add(getProperties());
- sections.add(getApplicationProperties());
- sections.add(new AmqpValue(_map));
- sections.add(getFooter());
- return sections;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
deleted file mode 100644
index c4638616fa..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.IllegalStateException;
-import javax.jms.InvalidDestinationException;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import javax.jms.MessageListener;
-
-import org.apache.qpid.amqp_1_0.client.AcknowledgeMode;
-import org.apache.qpid.amqp_1_0.client.ConnectionErrorException;
-import org.apache.qpid.amqp_1_0.client.Message;
-import org.apache.qpid.amqp_1_0.client.Receiver;
-import org.apache.qpid.amqp_1_0.client.Transaction;
-import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
-import org.apache.qpid.amqp_1_0.jms.MessageConsumerException;
-import org.apache.qpid.amqp_1_0.jms.Queue;
-import org.apache.qpid.amqp_1_0.jms.QueueReceiver;
-import org.apache.qpid.amqp_1_0.jms.Session;
-import org.apache.qpid.amqp_1_0.jms.TemporaryDestination;
-import org.apache.qpid.amqp_1_0.jms.Topic;
-import org.apache.qpid.amqp_1_0.jms.TopicSubscriber;
-import org.apache.qpid.amqp_1_0.type.Binary;
-import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-import org.apache.qpid.amqp_1_0.type.messaging.Filter;
-import org.apache.qpid.amqp_1_0.type.messaging.JMSSelectorFilter;
-import org.apache.qpid.amqp_1_0.type.messaging.Modified;
-import org.apache.qpid.amqp_1_0.type.messaging.NoLocalFilter;
-import org.apache.qpid.amqp_1_0.type.transport.AmqpError;
-import org.apache.qpid.amqp_1_0.type.transport.Error;
-
-public class MessageConsumerImpl implements MessageConsumer, QueueReceiver, TopicSubscriber
-{
- private static final Symbol NO_LOCAL_FILTER_NAME = Symbol.valueOf("no-local");
- private static final Symbol JMS_SELECTOR_FILTER_NAME = Symbol.valueOf("jms-selector");
- private String _selector;
- private boolean _noLocal;
- private DestinationImpl _destination;
- private SessionImpl _session;
- private Receiver _receiver;
- private Binary _lastUnackedMessage;
- MessageListener _messageListener;
-
- private boolean _isQueueConsumer;
- private boolean _isTopicSubscriber;
-
- private boolean _closed = false;
- private String _linkName;
- private boolean _durable;
- private Collection<Binary> _txnMsgs = Collections.synchronizedCollection(new ArrayList<Binary>());
- private Binary _lastTxnUpdate;
- private final List<Message> _recoverReplayMessages = new ArrayList<Message>();
- private final List<Message> _replaymessages = new ArrayList<Message>();
- private int _maxPrefetch = 100;
-
- MessageConsumerImpl(final Destination destination,
- final SessionImpl session,
- final String selector,
- final boolean noLocal) throws JMSException
- {
- this(destination,session,selector,noLocal,null,false);
- }
-
- MessageConsumerImpl(final Destination destination,
- final SessionImpl session,
- final String selector,
- final boolean noLocal,
- final String linkName,
- final boolean durable) throws JMSException
- {
- _selector = selector;
- _noLocal = noLocal;
- _linkName = linkName;
- _durable = durable;
- if(destination instanceof DestinationImpl)
- {
- _destination = (DestinationImpl) destination;
- if(destination instanceof javax.jms.Queue)
- {
- _isQueueConsumer = true;
- }
- else if(destination instanceof javax.jms.Topic)
- {
- _isTopicSubscriber = true;
- }
- if(destination instanceof TemporaryDestination)
- {
- ((TemporaryDestination)destination).addConsumer(this);
- }
- }
- else
- {
- throw new InvalidDestinationException("Invalid destination class " + destination.getClass().getName());
- }
- _session = session;
- if(session.getMaxPrefetch() != 0)
- {
- _maxPrefetch = session.getMaxPrefetch();
- }
-
- _receiver = createClientReceiver();
- _receiver.setRemoteErrorListener(new Runnable()
- {
- @Override
- public void run()
- {
- try
- {
- final ExceptionListener exceptionListener = _session.getConnection().getExceptionListener();
-
- if(exceptionListener != null)
- {
- final Error receiverError = _receiver.getError();
-
- MessageConsumerException mce = new MessageConsumerException(
- receiverError.getDescription(),
- receiverError.getCondition().getValue().toString(),
- _destination.getAddress());
-
- exceptionListener.onException(mce);
- }
- }
- catch (JMSException e)
- {
-
- }
- }
- });
-
-
- }
-
- protected Receiver createClientReceiver() throws JMSException
- {
- try
- {
- String targetAddr = _destination.getLocalTerminus() != null ? _destination.getLocalTerminus() : UUID.randomUUID().toString();
- return _session.getClientSession().createReceiver(_session.toAddress(_destination), targetAddr, AcknowledgeMode.ALO,
- _linkName, _durable, getFilters(), null);
- }
- catch (ConnectionErrorException e)
- {
- Error error = e.getRemoteError();
- if(AmqpError.INVALID_FIELD.equals(error.getCondition()))
- {
- throw new InvalidSelectorException(e.getMessage());
- }
- else
- {
- JMSException jmsException =
- new JMSException(e.getMessage(), error.getCondition().getValue().toString());
- jmsException.initCause(e);
- throw jmsException;
-
- }
- }
- }
-
- Map<Symbol, Filter> getFilters()
- {
- if(_selector == null || _selector.trim().equals(""))
- {
- if(_noLocal)
- {
- return Collections.singletonMap(NO_LOCAL_FILTER_NAME, (Filter) NoLocalFilter.INSTANCE);
- }
- else
- {
- return null;
-
- }
- }
- else if(_noLocal)
- {
- Map<Symbol, Filter> filters = new HashMap<Symbol, Filter>();
- filters.put(NO_LOCAL_FILTER_NAME, NoLocalFilter.INSTANCE);
- filters.put(JMS_SELECTOR_FILTER_NAME, new JMSSelectorFilter(_selector));
- return filters;
- }
- else
- {
- return Collections.singletonMap(JMS_SELECTOR_FILTER_NAME, (Filter)new JMSSelectorFilter(_selector));
- }
-
-
- }
-
- public String getMessageSelector() throws JMSException
- {
- checkClosed();
- return _selector;
- }
-
- public MessageListener getMessageListener() throws IllegalStateException
- {
- checkClosed();
- return _messageListener;
- }
-
- public void setMessageListener(final MessageListener messageListener) throws JMSException
- {
- checkClosed();
- _messageListener = messageListener;
- _receiver.setMessageArrivalListener(new Receiver.MessageArrivalListener()
- {
-
- public void messageArrived(final Receiver receiver)
- {
- _session.messageArrived(MessageConsumerImpl.this);
- }
- });
- _session.messageListenerSet( this );
-
- }
-
- public MessageImpl receive() throws JMSException
- {
- checkClosed();
- MessageImpl message = receiveImpl(-1L);
- if(message == null)
- {
- throw new JMSException("Message could not be retrieved");
- }
- return message;
- }
-
- public MessageImpl receive(final long timeout) throws JMSException
- {
- checkClosed();
- // TODO - validate timeout > 0
-
- return receiveImpl(timeout);
- }
-
- public MessageImpl receiveNoWait() throws JMSException
- {
- checkClosed();
- return receiveImpl(0L);
- }
-
- private MessageImpl receiveImpl(long timeout) throws JMSException
- {
-
- org.apache.qpid.amqp_1_0.client.Message msg;
- boolean redelivery;
- if(_replaymessages.isEmpty())
- {
- checkReceiverError();
- msg = receive0(timeout);
- redelivery = false;
- }
- else
- {
- msg = _replaymessages.remove(0);
- redelivery = true;
- }
-
- if(msg != null)
- {
- preReceiveAction(msg);
- }
- return createJMSMessage(msg, redelivery);
- }
-
- void checkReceiverError() throws JMSException
- {
- final Error receiverError = _receiver.getError();
- if(receiverError != null)
- {
- JMSException jmsException =
- new JMSException(receiverError.getDescription(), receiverError.getCondition().toString());
-
- throw jmsException;
- }
- }
-
- Message receiveRecoveredMessage()
- {
- return _replaymessages.isEmpty() ? null : _replaymessages.remove(0);
-
- }
-
- Message receive0(final long timeout)
- {
-
- Message message = _receiver.receive(timeout);
- if(_session.getAckModeEnum() == Session.AcknowledgeMode.CLIENT_ACKNOWLEDGE)
- {
- _recoverReplayMessages.add(message);
- }
- return message;
- }
-
-
- void acknowledge(final org.apache.qpid.amqp_1_0.client.Message msg)
- {
- _receiver.acknowledge(msg.getDeliveryTag(), _session.getTxn());
- }
-
- MessageImpl createJMSMessage(final Message msg, boolean redelivery)
- {
- if(msg != null)
- {
- MessageFactory factory = _session.getMessageFactory();
- final MessageImpl message = factory.createMessage(_destination, msg);
- message.setFromQueue(_isQueueConsumer);
- message.setFromTopic(_isTopicSubscriber);
- if(redelivery)
- {
- UnsignedInteger failures = message.getDeliveryFailures();
-
- if(!message.getJMSRedelivered())
- {
- message.setJMSRedelivered(true);
- }
-
- if(failures == null)
- {
- message.setDeliveryFailures(UnsignedInteger.ONE);
- }
- else
- {
- message.setDeliveryFailures(failures.add(UnsignedInteger.ONE));
- }
-
-
- }
-
- return message;
- }
- else
- {
- return null;
- }
- }
-
- public void close() throws JMSException
- {
- if(!_closed)
- {
- _closed = true;
-
- closeUnderlyingReceiver(_receiver);
-
- if(_destination instanceof TemporaryDestination)
- {
- ((TemporaryDestination)_destination).removeConsumer(this);
- }
- }
- }
-
- protected void closeUnderlyingReceiver(Receiver receiver)
- {
- receiver.close();
- }
-
- private void checkClosed() throws IllegalStateException
- {
- if(_closed)
- {
- throw new javax.jms.IllegalStateException("Closed");
- }
- }
-
- void setLastUnackedMessage(final Binary deliveryTag)
- {
- _lastUnackedMessage = deliveryTag;
- }
-
- void preReceiveAction(final org.apache.qpid.amqp_1_0.client.Message msg)
- {
- int acknowledgeMode = _session.getAckModeEnum().ordinal();
-
- if(acknowledgeMode == Session.AUTO_ACKNOWLEDGE
- || acknowledgeMode == Session.DUPS_OK_ACKNOWLEDGE
- || acknowledgeMode == Session.SESSION_TRANSACTED)
- {
- acknowledge(msg);
- if(acknowledgeMode == Session.SESSION_TRANSACTED)
- {
- _txnMsgs.add(msg.getDeliveryTag());
- }
- }
- else if(acknowledgeMode == Session.CLIENT_ACKNOWLEDGE)
- {
- setLastUnackedMessage(msg.getDeliveryTag());
- }
- }
-
- void acknowledgeAll()
- {
- if(_lastUnackedMessage != null)
- {
- Transaction txn = _session.getTxn();
- _receiver.acknowledgeAll(_lastUnackedMessage, txn, null);
- if(txn != null)
- {
- _lastTxnUpdate = _lastUnackedMessage;
- }
- _lastUnackedMessage = null;
-
- }
- _recoverReplayMessages.clear();
- if(!_replaymessages.isEmpty())
- {
- _recoverReplayMessages.addAll(_replaymessages);
- }
- }
-
- void postRollback()
- {
- if(_lastTxnUpdate != null)
- {
- final Modified outcome = new Modified();
- outcome.setDeliveryFailed(true);
- _receiver.updateAll(outcome, _lastTxnUpdate);
- _lastTxnUpdate = null;
- }
- for(Binary tag : _txnMsgs)
- {
- _receiver.modified(tag);
- }
- _txnMsgs.clear();
- }
-
- void postCommit()
- {
- _lastTxnUpdate = null;
- _txnMsgs.clear();
- }
-
- public DestinationImpl getDestination() throws IllegalStateException
- {
- checkClosed();
- return _destination;
- }
-
-
- public SessionImpl getSession() throws IllegalStateException
- {
- checkClosed();
- return _session;
- }
-
- public boolean getNoLocal() throws IllegalStateException
- {
- checkClosed();
- return _noLocal;
- }
-
- public void start()
- {
- _receiver.setCredit(UnsignedInteger.valueOf(getMaxPrefetch()), true);
- }
-
- public Queue getQueue() throws JMSException
- {
- return (Queue) getDestination();
- }
-
- public Topic getTopic() throws JMSException
- {
- return (Topic) getDestination();
- }
-
- void setQueueConsumer(final boolean queueConsumer)
- {
- _isQueueConsumer = queueConsumer;
- }
-
- void setTopicSubscriber(final boolean topicSubscriber)
- {
- _isTopicSubscriber = topicSubscriber;
- }
-
- String getLinkName()
- {
- return _linkName;
- }
-
- boolean isDurable()
- {
- return _durable;
- }
-
- void doRecover()
- {
- _replaymessages.clear();
- if(!_recoverReplayMessages.isEmpty())
- {
- _replaymessages.addAll(_recoverReplayMessages);
- for(Message msg : _replaymessages)
- {
- _session.messageArrived(this);
- }
- }
- }
-
- public int getMaxPrefetch()
- {
- return _maxPrefetch;
- }
-
- public void setMaxPrefetch(final int maxPrefetch)
- {
- _maxPrefetch = maxPrefetch;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageFactory.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageFactory.java
deleted file mode 100644
index ef48e2a8a5..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageFactory.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * 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 java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.qpid.amqp_1_0.client.Message;
-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.Symbol;
-import org.apache.qpid.amqp_1_0.type.messaging.AmqpSequence;
-import org.apache.qpid.amqp_1_0.type.messaging.AmqpValue;
-import org.apache.qpid.amqp_1_0.type.messaging.ApplicationProperties;
-import org.apache.qpid.amqp_1_0.type.messaging.Data;
-import org.apache.qpid.amqp_1_0.type.messaging.DeliveryAnnotations;
-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.MessageAnnotations;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-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;
- MessageAnnotations messageAnnotations = null;
- DeliveryAnnotations deliveryAnnotations = 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 DeliveryAnnotations)
- {
- deliveryAnnotations = (DeliveryAnnotations) section;
- section = iter.hasNext() ? iter.next() : null;
- }
-
- if(section instanceof MessageAnnotations)
- {
- messageAnnotations = (MessageAnnotations) 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(section != null && !(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, deliveryAnnotations, messageAnnotations, properties, appProperties, (Map) ((AmqpValue)bodySection).getValue(), footer, _session);
- }
- else if(bodySection instanceof AmqpValue && ((AmqpValue)bodySection).getValue() instanceof List)
- {
- message = new StreamMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations, properties, appProperties,
- (List) ((AmqpValue)bodySection).getValue(), footer, _session
- );
- }
- else if(bodySection instanceof AmqpValue && ((AmqpValue)bodySection).getValue() instanceof String)
- {
- message = new TextMessageImpl(header, deliveryAnnotations, messageAnnotations, properties, appProperties,
- (String) ((AmqpValue)bodySection).getValue(), footer, _session);
- }
- else if(bodySection instanceof AmqpValue && ((AmqpValue)bodySection).getValue() instanceof Binary)
- {
-
- Binary value = (Binary) ((AmqpValue) bodySection).getValue();
- message = new BytesMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations, properties, appProperties,
- new Data(value), footer, _session);
- }
- else if(bodySection instanceof Data)
- {
- Data dataSection = (Data) bodySection;
-
- Symbol contentType = properties == null ? null : properties.getContentType();
-
- if(ObjectMessageImpl.CONTENT_TYPE.equals(contentType))
- {
-
-
- message = new ObjectMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations, properties, appProperties,
- dataSection,
- footer,
- _session);
- }
- else if(contentType != null)
- {
- ContentType contentTypeObj = parseContentType(contentType.toString());
- // todo : content encoding - e.g. gzip
- String contentTypeType = contentTypeObj.getType();
- String contentTypeSubType = contentTypeObj.getSubType();
- if ("text".equals(contentTypeType)
- || ("application".equals(contentTypeType)
- && contentTypeSubType != null
- && ("xml".equals(contentTypeSubType)
- || "json".equals(contentTypeSubType)
- || "xml-dtd".equals(contentTypeSubType)
- || "javascript".equals(contentTypeSubType)
- || contentTypeSubType.endsWith("+xml")
- || contentTypeSubType.endsWith("+json"))))
- {
- Charset charset;
- if (contentTypeObj.getParameterNames().contains("charset"))
- {
- charset = Charset.forName(contentTypeObj.getParameter("charset").toUpperCase());
- }
- else
- {
- charset = StandardCharsets.US_ASCII;
- }
- Binary binary = dataSection.getValue();
- String data =
- new String(binary.getArray(), binary.getArrayOffset(), binary.getLength(), charset);
- message = new TextMessageImpl(header, deliveryAnnotations, messageAnnotations, properties,
- appProperties, data, footer, _session);
- }
- else
- {
- message = new BytesMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations,
- properties,
- appProperties,
- dataSection,
- footer,
- _session);
- }
- }
- else
- {
- message = new BytesMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations,
- properties,
- appProperties,
- dataSection,
- footer,
- _session);
- }
-
- }
- else if(bodySection instanceof AmqpSequence)
- {
- message = new StreamMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations, properties, appProperties, ((AmqpSequence) bodySection).getValue(), footer, _session
- );
- }
- else
- {
- message = new AmqpMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations, properties,appProperties,body,footer, _session);
- }
- }
- else if(body.size() == 0)
- {
- message = new AmqpMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations, properties,appProperties,
- Collections.<Section>singletonList(new AmqpValue(null)),footer, _session);
- }
- else
- {
- message = new AmqpMessageImpl(header,
- deliveryAnnotations,
- messageAnnotations, properties,appProperties,body,footer, _session);
- }
-
- message.setReadOnly();
-
- return message;
- }
-
-
- static interface ContentType
- {
- String getType();
- String getSubType();
- Set<String> getParameterNames();
- String getParameter(String name);
- }
-
- static ContentType parseContentType(String contentType)
- {
- int subTypeSeparator = contentType.indexOf("/");
- final String type = contentType.substring(0, subTypeSeparator).toLowerCase().trim();
- String subTypePart = contentType.substring(subTypeSeparator +1).toLowerCase().trim();
- if(subTypePart.contains(";"))
- {
- subTypePart = subTypePart.substring(0,subTypePart.indexOf(";")).trim();
- }
- if(subTypePart.contains("("))
- {
- subTypePart = subTypePart.substring(0,subTypePart.indexOf("(")).trim();
- }
- final String subType = subTypePart;
- final Map<String,String> parameters = new HashMap<>();
-
- if(contentType.substring(subTypeSeparator +1).contains(";"))
- {
- parseContentTypeParameters(contentType.substring(contentType.indexOf(";",subTypeSeparator +1)+1), parameters);
- }
- return new ContentType()
- {
- @Override
- public String getType()
- {
- return type;
- }
-
- @Override
- public String getSubType()
- {
- return subType;
- }
-
- @Override
- public Set<String> getParameterNames()
- {
- return Collections.unmodifiableMap(parameters).keySet();
- }
-
- @Override
- public String getParameter(final String name)
- {
- return parameters.get(name);
- }
- };
- }
-
- private static void parseContentTypeParameters(final String parameterString, final Map<String, String> parameters)
- {
- int equalsIndex = parameterString.indexOf("=");
- if(equalsIndex != -1)
- {
- String paramName = parameterString.substring(0,equalsIndex).trim();
- String valuePart = equalsIndex == parameterString.length() - 1 ? "" : parameterString.substring(equalsIndex+1).trim();
- String remainder;
- if(valuePart.startsWith("\""))
- {
- int closeQuoteIndex = valuePart.indexOf("\"", 1);
- if(closeQuoteIndex != -1)
- {
- parameters.put(paramName, valuePart.substring(1, closeQuoteIndex));
- remainder = (closeQuoteIndex == valuePart.length()-1) ? "" : valuePart.substring(closeQuoteIndex+1);
- }
- else
- {
- remainder = "";
- }
- }
- else
- {
- Pattern pattern = Pattern.compile("\\s|;|\\(");
- Matcher matcher = pattern.matcher(valuePart);
- if(matcher.matches())
- {
- parameters.put(paramName, valuePart.substring(0,matcher.start()));
- remainder = valuePart.substring(matcher.start());
- }
- else
- {
- parameters.put(paramName, valuePart);
- remainder = "";
- }
- }
-
- int paramSep = remainder.indexOf(";");
- if(paramSep != -1 && paramSep != remainder.length()-1)
- {
- parseContentTypeParameters(remainder.substring(paramSep+1),parameters);
- }
- }
-
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageImpl.java
deleted file mode 100644
index 5e89f93397..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageImpl.java
+++ /dev/null
@@ -1,1486 +0,0 @@
-/*
- *
- * 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 java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageFormatException;
-import javax.jms.MessageNotReadableException;
-import javax.jms.MessageNotWriteableException;
-
-import org.apache.qpid.amqp_1_0.jms.Message;
-import org.apache.qpid.amqp_1_0.jms.impl.util.AnnotationDecoder;
-import org.apache.qpid.amqp_1_0.jms.impl.util.AnnotationEncoder;
-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.Symbol;
-import org.apache.qpid.amqp_1_0.type.UnsignedByte;
-import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-import org.apache.qpid.amqp_1_0.type.UnsignedLong;
-import org.apache.qpid.amqp_1_0.type.UnsignedShort;
-import org.apache.qpid.amqp_1_0.type.messaging.ApplicationProperties;
-import org.apache.qpid.amqp_1_0.type.messaging.DeliveryAnnotations;
-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.MessageAnnotations;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-public abstract class MessageImpl implements Message
-{
- static final Set<Class> _supportedClasses =
- new HashSet<Class>(Arrays.asList(Boolean.class, Byte.class, Short.class, Integer.class, Long.class,
- Float.class, Double.class, Character.class, String.class, byte[].class));
-
- static final Symbol JMS_TYPE = Symbol.valueOf("x-opt-jms-type");
- static final Symbol TO_TYPE = Symbol.valueOf("x-opt-to-type");
- static final Symbol REPLY_TO_TYPE = Symbol.valueOf("x-opt-reply-type");
-
- static final Collection<Symbol> SYSTEM_MESSAGE_ANNOTATIONS = Arrays.asList(JMS_TYPE, TO_TYPE, REPLY_TO_TYPE);
-
- static final String QUEUE_ATTRIBUTE = "queue";
- static final String TOPIC_ATTRIBUTE = "topic";
- static final String TEMPORARY_ATTRIBUTE = "temporary";
-
- static final Set<String> JMS_QUEUE_ATTRIBUTES = set(QUEUE_ATTRIBUTE);
- static final Set<String> JMS_TOPIC_ATTRIBUTES = set(TOPIC_ATTRIBUTE);
- static final Set<String> JMS_TEMP_QUEUE_ATTRIBUTES = set(QUEUE_ATTRIBUTE, TEMPORARY_ATTRIBUTE);
- static final Set<String> JMS_TEMP_TOPIC_ATTRIBUTES = set(TOPIC_ATTRIBUTE, TEMPORARY_ATTRIBUTE);
-
- private static final String JMSXGROUP_ID = "JMSXGroupID";
- public static final String JMS_AMQP_MESSAGE_ANNOTATIONS = "JMS_AMQP_MESSAGE_ANNOTATIONS";
- public static final String JMS_AMQP_DELIVERY_ANNOTATIONS = "JMS_AMQP_DELIVERY_ANNOTATIONS";
-
- private Header _header;
- private Properties _properties;
- private ApplicationProperties _applicationProperties;
- private Footer _footer;
- private final SessionImpl _sessionImpl;
- private boolean _readOnly;
- private DeliveryAnnotations _deliveryAnnotations;
- private MessageAnnotations _messageAnnotations;
-
- private boolean _isFromQueue;
- private boolean _isFromTopic;
- private long _expiration;
- private DestinationImpl _replyTo;
-
- protected MessageImpl(Header header,
- DeliveryAnnotations deliveryAnnotations,
- MessageAnnotations messageAnnotations,
- Properties properties,
- ApplicationProperties appProperties,
- Footer footer,
- SessionImpl session)
- {
- _header = header == null ? new Header() : header;
- _properties = properties == null ? new Properties() : properties;
- _messageAnnotations = messageAnnotations == null ? new MessageAnnotations(new HashMap()) : messageAnnotations;
- _deliveryAnnotations = deliveryAnnotations == null ? new DeliveryAnnotations(new HashMap()) : deliveryAnnotations;
-
- _footer = footer == null ? new Footer(Collections.EMPTY_MAP) : footer;
- _applicationProperties = appProperties == null ? new ApplicationProperties(new HashMap()) : appProperties;
- _sessionImpl = session;
- }
-
- public String getJMSMessageID() throws JMSException
- {
- Object messageId = getMessageId();
-
- return messageId == null ? null : "ID:"+messageId.toString();
- }
-
- public void setJMSMessageID(String messageId) throws InvalidJMSMEssageIdException
- {
- if(messageId == null)
- {
- setMessageId(null);
- }
- else if(messageId.startsWith("ID:"))
- {
- setMessageId(messageId.substring(3));
- }
- else
- {
- throw new InvalidJMSMEssageIdException(messageId);
- }
- }
-
- public long getJMSTimestamp() throws JMSException
- {
- Date transmitTime = getTransmitTime();
- return transmitTime == null ? 0 : transmitTime.getTime();
- }
-
- public void setJMSTimestamp(long l) throws JMSException
- {
- setTransmitTime(new Date(l));
- if(_expiration != 0l)
- {
- setTtl(UnsignedInteger.valueOf(_expiration-getTransmitTime().getTime()));
- }
- }
-
- public byte[] getJMSCorrelationIDAsBytes() throws JMSException
- {
-
- Object o = getCorrelationId();
- if(o instanceof Binary)
- {
- Binary correlationIdBinary = (Binary) o;
- byte[] correlationId = new byte[correlationIdBinary.getLength()];
- correlationIdBinary.asByteBuffer().get(correlationId);
- return correlationId;
- }
- else
- {
- return o == null ? null : o.toString().getBytes();
- }
-
- }
-
- public void setJMSCorrelationIDAsBytes(byte[] correlationId) throws JMSException
- {
- if(correlationId == null)
- {
- setCorrelationId(null);
- }
- else
- {
- byte[] dup = new byte[correlationId.length];
- System.arraycopy(correlationId,0,dup,0,correlationId.length);
- setCorrelationId(new Binary(dup));
- }
- }
-
- public void setJMSCorrelationID(String s) throws JMSException
- {
- getProperties().setCorrelationId(s);
- }
-
- public String getJMSCorrelationID() throws JMSException
- {
- Object o = getProperties().getCorrelationId();
- if(o instanceof Binary)
- {
- Binary id = (Binary) o;
- return new String(id.getArray(), id.getArrayOffset(), id.getLength());
- }
- else
- {
- return o == null ? null : o.toString();
- }
- }
-
- public DestinationImpl getJMSReplyTo() throws JMSException
- {
- return _replyTo != null ? _replyTo : toDestination(getReplyTo(), splitCommaSeparateSet((String) getMessageAnnotation(REPLY_TO_TYPE)));
- }
-
- public void setJMSReplyTo(Destination destination) throws NonAMQPDestinationException
- {
- _replyTo = (DestinationImpl) destination;
- if( destination==null )
- {
- setReplyTo(null);
- messageAnnotationMap().remove(REPLY_TO_TYPE);
- }
- else
- {
- if(_replyTo.getLocalTerminus() != null)
- {
- setReplyTo(_replyTo.getLocalTerminus());
- }
- else
- {
- DecodedDestination dd = toDecodedDestination(destination);
- setReplyTo(dd.getAddress());
- messageAnnotationMap().put(REPLY_TO_TYPE, join(",", dd.getAttributes()));
- }
- }
- }
-
- public DestinationImpl getJMSDestination() throws JMSException
- {
- Set<String> type = splitCommaSeparateSet((String) getMessageAnnotation(TO_TYPE));
- if( type==null )
- {
- if( _isFromQueue )
- {
- type = JMS_QUEUE_ATTRIBUTES;
- }
- else if( _isFromTopic )
- {
- type = JMS_TOPIC_ATTRIBUTES;
- }
- }
- return toDestination(getTo(), type);
- }
-
- public void setJMSDestination(Destination destination) throws NonAMQPDestinationException
- {
- if( destination==null )
- {
- setTo(null);
- messageAnnotationMap().remove(TO_TYPE);
- }
- else
- {
- DecodedDestination dd = toDecodedDestination(destination);
- setTo(dd.getAddress());
- messageAnnotationMap().put(TO_TYPE, join(",", dd.getAttributes()));
- }
- }
-
- public int getJMSDeliveryMode() throws JMSException
- {
- if(Boolean.FALSE.equals(getDurable()))
- {
- return DeliveryMode.NON_PERSISTENT;
- }
- else
- {
- return DeliveryMode.PERSISTENT;
- }
- }
-
- public void setJMSDeliveryMode(int deliveryMode) throws JMSException
- {
- switch(deliveryMode)
- {
- case DeliveryMode.NON_PERSISTENT:
- setDurable(false);
- break;
- case DeliveryMode.PERSISTENT:
- setDurable(true);
- break;
- default:
- //TODO
- }
- }
-
- public boolean getJMSRedelivered()
- {
- UnsignedInteger failures = getDeliveryFailures();
- return failures != null && (failures.intValue() != 0);
- }
-
- public void setJMSRedelivered(boolean redelivered)
- {
- UnsignedInteger failures = getDeliveryFailures();
- if(redelivered)
- {
- if(failures == null || UnsignedInteger.ZERO.equals(failures))
- {
- setDeliveryFailures(UnsignedInteger.ONE);
- }
- }
- else
- {
- setDeliveryFailures(null);
- }
- }
-
- public String getJMSType() throws JMSException
- {
- final Object attrValue = getMessageAnnotation(JMS_TYPE);
- return attrValue instanceof String ? attrValue.toString() : null;
- }
-
- public void setJMSType(String s) throws JMSException
- {
- messageAnnotationMap().put(JMS_TYPE, s);
- }
-
- public long getJMSExpiration() throws JMSException
- {
- final UnsignedInteger ttl = getTtl();
- return ttl == null || ttl.longValue() == 0 ? 0 : getJMSTimestamp() + ttl.longValue();
- }
-
- public void setJMSExpiration(long l) throws JMSException
- {
- _expiration = l;
- if(l == 0)
- {
- setTtl(UnsignedInteger.ZERO);
- }
- else
- {
- if(getTransmitTime() == null)
- {
- setTransmitTime(new Date());
- }
- setTtl(UnsignedInteger.valueOf(l - getTransmitTime().getTime()));
- }
- }
-
- public int getJMSPriority() throws JMSException
- {
- UnsignedByte priority = getPriority();
- return priority == null ? DEFAULT_PRIORITY : priority.intValue();
- }
-
- public void setJMSPriority(int i) throws InvalidJMSPriorityException
- {
- if(i >= 0 && i <= 255)
- {
- setPriority(UnsignedByte.valueOf((byte)i));
- }
- else
- {
- throw new InvalidJMSPriorityException(i);
- }
- }
-
- public void clearProperties() throws JMSException
- {
- _applicationProperties.getValue().clear();
- }
-
- public boolean propertyExists(final String s) throws JMSException
- {
- return propertyExists((Object) s);
- }
-
- public boolean getBooleanProperty(final String s) throws JMSException
- {
- return getBooleanProperty((Object) s);
- }
-
- public byte getByteProperty(final String s) throws JMSException
- {
- return getByteProperty((Object)s);
- }
-
- public short getShortProperty(final String s) throws JMSException
- {
- return getShortProperty((Object)s);
- }
-
- public int getIntProperty(final String s) throws JMSException
- {
- return getIntProperty((Object)s);
- }
-
- public long getLongProperty(final String s) throws JMSException
- {
- return getLongProperty((Object)s);
- }
-
- public float getFloatProperty(final String s) throws JMSException
- {
- return getFloatProperty((Object)s);
- }
-
- public double getDoubleProperty(final String s) throws JMSException
- {
- return getDoubleProperty((Object)s);
- }
-
- public String getStringProperty(final String s) throws JMSException
- {
- return getStringProperty((Object)s);
- }
-
- public Object getObjectProperty(final String s) throws JMSException
- {
- return getObjectProperty((Object)s);
- }
-
- public boolean propertyExists(Object name) throws JMSException
- {
- return _applicationProperties.getValue().containsKey(name);
- }
-
- public boolean getBooleanProperty(Object name) throws JMSException
- {
-
- Object value = getProperty(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 getByteProperty(Object name) throws JMSException
- {
- Object value = getProperty(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 getShortProperty(Object name) throws JMSException
- {
- Object value = getProperty(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.");
- }
- }
-
- private Object getProperty(final Object name)
- {
- if(JMSXGROUP_ID.equals(name))
- {
- return _properties.getGroupId();
- }
- else if(JMS_AMQP_DELIVERY_ANNOTATIONS.equals(name))
- {
- Map annotationsMap = deliveryAnnotationsMap();
- if(annotationsMap.isEmpty())
- {
- return null;
- }
- else
- {
- try
- {
- return new AnnotationEncoder().encode(annotationsMap);
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException(e);
- }
- }
- }
- else if(JMS_AMQP_MESSAGE_ANNOTATIONS.equals(name))
- {
- Map annotationsMap = new LinkedHashMap(messageAnnotationMap());
- for(Symbol s : SYSTEM_MESSAGE_ANNOTATIONS)
- {
- annotationsMap.remove(s);
- }
-
- if(annotationsMap.isEmpty())
- {
- return null;
- }
- else
- {
- try
- {
- return new AnnotationEncoder().encode(annotationsMap);
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException(e);
- }
- }
- }
- return _applicationProperties.getValue().get(name);
- }
-
- public int getIntProperty(Object name) throws JMSException
- {
- Object value = getProperty(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 getLongProperty(Object name) throws JMSException
- {
- Object value = getProperty(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 getFloatProperty(Object name) throws JMSException
- {
- Object value = getProperty(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 getDoubleProperty(Object name) throws JMSException
- {
- Object value = getProperty(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 getStringProperty(Object name) throws JMSException
- {
- Object value = getProperty(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 Object getObjectProperty(Object name) throws JMSException
- {
- return getProperty(name);
- }
-
- public List<Object> getListProperty(final Object name) throws JMSException
- {
- Object value = getProperty(name);
- if(value instanceof List || value == null)
- {
- return (List<Object>)value;
- }
- else
- {
- throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
- + " cannot be converted to List.");
- }
- }
-
- public Map<Object, Object> getMapProperty(final Object name) throws JMSException
- {
- Object value = getProperty(name);
- if(value instanceof Map || value == null)
- {
- return (Map<Object,Object>)value;
- }
- else
- {
- throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
- + " cannot be converted to Map.");
- }
- }
-
- public UnsignedByte getUnsignedByteProperty(final Object name) throws JMSException
- {
- Object value = getProperty(name);
-
- if (value instanceof UnsignedByte)
- {
- return (UnsignedByte) value;
- }
- else if ((value instanceof String) || (value == null))
- {
- return UnsignedByte.valueOf((String) value);
- }
- else
- {
- throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
- + " cannot be converted to UnsignedByte.");
- }
- }
-
- public UnsignedShort getUnsignedShortProperty(final Object name) throws JMSException
- {
- Object value = getProperty(name);
-
- if (value instanceof UnsignedShort)
- {
- return (UnsignedShort) value;
- }
- else if (value instanceof UnsignedByte)
- {
- return UnsignedShort.valueOf(((UnsignedByte)value).shortValue());
- }
- else if ((value instanceof String) || (value == null))
- {
- return UnsignedShort.valueOf((String) value);
- }
- else
- {
- throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
- + " cannot be converted to UnsignedShort.");
- }
- }
-
- public UnsignedInteger getUnsignedIntProperty(final Object name) throws JMSException
- {
- Object value = getProperty(name);
-
- if (value instanceof UnsignedInteger)
- {
- return (UnsignedInteger) value;
- }
- else if (value instanceof UnsignedByte)
- {
- return UnsignedInteger.valueOf(((UnsignedByte)value).intValue());
- }
- else if (value instanceof UnsignedShort)
- {
- return UnsignedInteger.valueOf(((UnsignedShort)value).intValue());
- }
- else if ((value instanceof String) || (value == null))
- {
- return UnsignedInteger.valueOf((String) value);
- }
- else
- {
- throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
- + " cannot be converted to UnsignedShort.");
- }
- }
-
- public UnsignedLong getUnsignedLongProperty(final Object name) throws JMSException
- {
- Object value = getProperty(name);
-
- if (value instanceof UnsignedLong)
- {
- return (UnsignedLong) value;
- }
- else if (value instanceof UnsignedByte)
- {
- return UnsignedLong.valueOf(((UnsignedByte)value).longValue());
- }
- else if (value instanceof UnsignedShort)
- {
- return UnsignedLong.valueOf(((UnsignedShort)value).longValue());
- }
- else if (value instanceof UnsignedInteger)
- {
- return UnsignedLong.valueOf(((UnsignedInteger)value).longValue());
- }
- else if ((value instanceof String) || (value == null))
- {
- return UnsignedLong.valueOf((String) value);
- }
- else
- {
- throw new MessageFormatException("Property " + name + " of type " + value.getClass().getName()
- + " cannot be converted to UnsignedShort.");
- }
- }
-
- public Enumeration getPropertyNames() throws JMSException
- {
- final Collection<String> names = new ArrayList<String>();
- for(Object key : _applicationProperties.getValue().keySet())
- {
- if(key instanceof String)
- {
- names.add((String)key);
- }
- }
- if(_properties.getGroupId() != null)
- {
- names.add(JMSXGROUP_ID);
- }
- if(!deliveryAnnotationsMap().isEmpty())
- {
- names.add(JMS_AMQP_DELIVERY_ANNOTATIONS);
- }
- if(!messageAnnotationMap().isEmpty())
- {
- boolean nonDefaultAnnotation = false;
- for(Object key : messageAnnotationMap().keySet())
- {
- if(!SYSTEM_MESSAGE_ANNOTATIONS.contains(key))
- {
- nonDefaultAnnotation = true;
- break;
- }
- }
-
- if(nonDefaultAnnotation)
- {
- names.add(JMS_AMQP_MESSAGE_ANNOTATIONS);
- }
- }
- return Collections.enumeration(names);
- }
-
- public void setBooleanProperty(final String s, final boolean b) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
- setBooleanProperty((Object)s, b);
- }
-
- protected void checkPropertyName(CharSequence propertyName)
- {
- if (propertyName == null)
- {
- throw new IllegalArgumentException("Property name must not be null");
- }
- else if (propertyName.length() == 0)
- {
- throw new IllegalArgumentException("Property name must not be the empty string");
- }
-
- checkIdentiferFormat(propertyName);
- }
-
- protected void checkIdentiferFormat(CharSequence propertyName)
- {
-// JMS requirements 3.5.1 Property Names
-// Identifiers:
-// - An identifier is an unlimited-length character sequence that must begin
-// with a Java identifier start character; all following characters must be Java
-// identifier part characters. An identifier start character is any character for
-// which the method Character.isJavaIdentifierStart returns true. This includes
-// '_' and '$'. An identifier part character is any character for which the
-// method Character.isJavaIdentifierPart returns true.
-// - Identifiers cannot be the names NULL, TRUE, or FALSE.
-// Identifiers cannot be NOT, AND, OR, BETWEEN, LIKE, IN, IS, or
-// ESCAPE.
-// Identifiers are either header field references or property references. The
-// type of a property value in a message selector corresponds to the type
-// used to set the property. If a property that does not exist in a message is
-// referenced, its value is NULL. The semantics of evaluating NULL values
-// in a selector are described in Section 3.8.1.2, Null Values.
-// The conversions that apply to the get methods for properties do not
-// apply when a property is used in a message selector expression. For
-// example, suppose you set a property as a string value, as in the
-// following:
-// myMessage.setStringProperty("NumberOfOrders", "2")
-// The following expression in a message selector would evaluate to false,
-// because a string cannot be used in an arithmetic expression:
-// "NumberOfOrders > 1"
-// Identifiers are case sensitive.
-// Message header field references are restricted to JMSDeliveryMode,
-// JMSPriority, JMSMessageID, JMSTimestamp, JMSCorrelationID, and
-// JMSType. JMSMessageID, JMSCorrelationID, and JMSType values may be
-// null and if so are treated as a NULL value.
-
- // JMS start character
- if (!(Character.isJavaIdentifierStart(propertyName.charAt(0))))
- {
- throw new IllegalArgumentException("Identifier '" + propertyName + "' does not start with a valid JMS identifier start character");
- }
-
- // JMS part character
- int length = propertyName.length();
- for (int c = 1; c < length; c++)
- {
- if (!(Character.isJavaIdentifierPart(propertyName.charAt(c))))
- {
- throw new IllegalArgumentException("Identifier '" + propertyName + "' contains an invalid JMS identifier character");
- }
- }
-
- // JMS invalid names
- if ((propertyName.equals("NULL")
- || propertyName.equals("TRUE")
- || propertyName.equals("FALSE")
- || propertyName.equals("NOT")
- || propertyName.equals("AND")
- || propertyName.equals("OR")
- || propertyName.equals("BETWEEN")
- || propertyName.equals("LIKE")
- || propertyName.equals("IN")
- || propertyName.equals("IS")
- || propertyName.equals("ESCAPE")))
- {
- throw new IllegalArgumentException("Identifier '" + propertyName + "' is not allowed in JMS");
- }
-
- }
-
- public void setByteProperty(final String s, final byte b) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
-
- setByteProperty((Object)s, b);
- }
-
- public void setShortProperty(final String s, final short i) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
-
- setShortProperty((Object)s, i);
- }
-
- public void setIntProperty(final String s, final int i) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
-
- setIntProperty((Object)s, i);
- }
-
- public void setLongProperty(final String s, final long l) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
-
- setLongProperty((Object)s, l);
- }
-
- public void setFloatProperty(final String s, final float v) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
-
- setFloatProperty((Object) s, v);
- }
-
- public void setDoubleProperty(final String s, final double v) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
-
- setDoubleProperty((Object)s, v);
- }
-
- public void setStringProperty(final String s, final String s1) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
-
- setStringProperty((Object)s, s1);
- }
-
- public void setObjectProperty(final String s, final Object o) throws JMSException
- {
- checkWritable();
- checkPropertyName(s);
-
- if(o != null && (_supportedClasses.contains(o.getClass())))
- {
- setObjectProperty((Object)s, o);
- }
- else
- {
- throw new MessageFormatException("Cannot call setObjectProperty with a value of " + ((o == null) ? "null" : " class "+o.getClass().getName()) + ".");
- }
- }
-
- public void setBooleanProperty(Object name, boolean b)
- {
- setProperty(name, b);
- }
-
- public void setByteProperty(Object name, byte b)
- {
- setProperty(name, b);
- }
-
- public void setShortProperty(Object name, short i)
- {
- setProperty(name, i);
- }
-
- public void setIntProperty(Object name, int i)
- {
- setProperty(name, i);
- }
-
- public void setLongProperty(Object name, long l)
- {
- setProperty(name, l);
- }
-
- public void setFloatProperty(Object name, float v)
- {
- setProperty(name, v);
- }
-
- public void setDoubleProperty(Object name, double v)
- {
- setProperty(name, v);
- }
-
- public void setStringProperty(Object name, String value)
- {
- setProperty(name, value);
- }
-
- public void setObjectProperty(Object name, Object value)
- {
- setProperty(name, value);
- }
-
- private void setProperty(Object name, Object value)
- {
- if(JMSXGROUP_ID.equals(name))
- {
- _properties.setGroupId(value == null ? null : value.toString());
- }
- else if(JMS_AMQP_MESSAGE_ANNOTATIONS.equals(name))
- {
- try
- {
- Map<Symbol, Object> annotationMap = new AnnotationDecoder().decode((String) value);
- Map messageAnnotations = messageAnnotationMap();
- Map tmp = new LinkedHashMap();
- for(Symbol key : SYSTEM_MESSAGE_ANNOTATIONS)
- {
- if(messageAnnotations.containsKey(key))
- {
- tmp.put(key, messageAnnotations.get(key));
- }
- }
- messageAnnotations.clear();
- messageAnnotations.putAll(annotationMap);
- messageAnnotations.putAll(tmp);
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException(e);
- }
-
- }
- else if(JMS_AMQP_DELIVERY_ANNOTATIONS.equals(name))
- {
- try
- {
- Map<Symbol, Object> annotationMap = new AnnotationDecoder().decode((String) value);
- Map deliveryAnnotations = deliveryAnnotationsMap();
- deliveryAnnotations.clear();
- deliveryAnnotations.putAll(annotationMap);
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException(e);
- }
- }
- else
- {
- _applicationProperties.getValue().put(name, value);
- }
- }
-
- public void setListProperty(final Object name, final List<Object> list)
- {
- setProperty(name, list);
- }
-
- public void setMapProperty(final Object name, final Map<Object, Object> map)
- {
- setProperty(name, map);
- }
-
- public void setUnsignedByteProperty(final Object name, final UnsignedByte b)
- {
- setProperty(name, b);
- }
-
- public void setUnsignedShortProperty(final Object name, final UnsignedShort s)
- {
- setProperty(name, s);
- }
-
- public void setUnsignedIntProperty(final Object name, final UnsignedInteger i)
- {
- setProperty(name, i);
- }
-
- public void setUnsignedLongProperty(final Object name, final UnsignedLong l)
- {
- setProperty(name, l);
- }
-
- public UnsignedInteger getDeliveryFailures()
- {
- return _header.getDeliveryCount();
- }
-
- public void setDeliveryFailures(UnsignedInteger failures)
- {
- _header.setDeliveryCount(failures);
- }
-
- public Boolean getDurable()
- {
- return _header.getDurable();
- }
-
- public void setDurable(final Boolean durable)
- {
- _header.setDurable(durable);
- }
-
- public UnsignedByte getPriority()
- {
- return _header.getPriority();
- }
-
- public void setPriority(final UnsignedByte priority)
- {
- _header.setPriority(priority);
- }
-
- public Date getTransmitTime()
- {
- return _properties.getCreationTime();
- }
-
- public void setTransmitTime(final Date transmitTime)
- {
- _properties.setCreationTime(transmitTime);
- }
-
- public UnsignedInteger getTtl()
- {
- return _header.getTtl();
- }
-
- public void setTtl(final UnsignedInteger ttl)
- {
- _header.setTtl(ttl);
- }
-
- public UnsignedInteger getFormerAcquirers()
- {
- return _header.getDeliveryCount();
- }
-
- public void setFormerAcquirers(final UnsignedInteger formerAcquirers)
- {
- _header.setDeliveryCount(formerAcquirers);
- }
-
- public Object getMessageId()
- {
- return _properties.getMessageId();
- }
-
- public void setMessageId(final Object messageId)
- {
- _properties.setMessageId(messageId);
- }
-
- public Binary getUserId()
- {
- return _properties.getUserId();
- }
-
- public void setUserId(final Binary userId)
- {
- _properties.setUserId(userId);
- }
-
- public String getTo()
- {
- return _properties.getTo();
- }
-
- public void setTo(final String to)
- {
- _properties.setTo(to);
- }
-
- public String getSubject()
- {
- return _properties.getSubject();
- }
-
- public void setSubject(final String subject)
- {
- _properties.setSubject(subject);
- }
-
- public String getReplyTo()
- {
- return _properties.getReplyTo();
- }
-
- public void setReplyTo(final String replyTo)
- {
- _properties.setReplyTo(replyTo);
- }
-
- public Object getCorrelationId()
- {
- return _properties.getCorrelationId();
- }
-
- public void setCorrelationId(final Binary correlationId)
- {
- _properties.setCorrelationId(correlationId);
- }
-
- public Symbol getContentType()
- {
- return _properties.getContentType();
- }
-
- public void setContentType(final Symbol contentType)
- {
- _properties.setContentType(contentType);
- }
-
- public void acknowledge() throws JMSException
- {
- _sessionImpl.acknowledgeAll();
- }
-
- public void clearBody() throws JMSException
- {
- _readOnly = false;
- }
-
- protected boolean isReadOnly()
- {
- return _readOnly;
- }
-
- protected void checkReadable() throws MessageNotReadableException
- {
- if (!isReadOnly())
- {
- throw new MessageNotReadableException("You need to call reset() to make the message readable");
- }
- }
-
- protected void checkWritable() throws MessageNotWriteableException
- {
- if (isReadOnly())
- {
- throw new MessageNotWriteableException("You need to call clearBody() to make the message writable");
- }
- }
-
- public void setReadOnly()
- {
- _readOnly = true;
- }
-
- private static class InvalidJMSMEssageIdException extends JMSException
- {
- public InvalidJMSMEssageIdException(String messageId)
- {
- super("Invalid JMSMessageID: '" + messageId + "', JMSMessageID MUST start with 'ID:'");
- }
- }
-
- private class NonAMQPDestinationException extends JMSException
- {
- public NonAMQPDestinationException(Destination destination)
- {
- super("Destinations not a valid AMQP Destination, class of type: '"
- + destination.getClass().getName()
- + "', require '"
- + org.apache.qpid.amqp_1_0.jms.Destination.class.getName() + "'.");
- }
- }
-
- private class InvalidJMSPriorityException extends JMSException
- {
- public InvalidJMSPriorityException(int priority)
- {
- super("The provided priority: " + priority + " is not valid in AMQP, valid values are from 0 to 255");
- }
- }
-
- Header getHeader()
- {
- return _header;
- }
-
- Properties getProperties()
- {
- return _properties;
- }
-
-
- Footer getFooter()
- {
- return _footer;
- }
-
- MessageAnnotations getMessageAnnotations()
- {
- return _messageAnnotations;
- }
-
-
- DeliveryAnnotations getDeliveryAnnotations()
- {
- return _deliveryAnnotations;
- }
-
- public ApplicationProperties getApplicationProperties()
- {
- return _applicationProperties;
- }
-
- public void reset() throws JMSException
- {
- _readOnly = true;
- }
-
- void setFromQueue(final boolean fromQueue)
- {
- _isFromQueue = fromQueue;
- }
-
- void setFromTopic(final boolean fromTopic)
- {
- _isFromTopic = fromTopic;
- }
-
- abstract Collection<Section> getSections();
-
- DecodedDestination toDecodedDestination(Destination destination) throws NonAMQPDestinationException
- {
- if(destination == null)
- {
- return null;
- }
- if (destination instanceof DestinationImpl)
- {
- return _sessionImpl.getConnection().toDecodedDestination((DestinationImpl) destination);
- }
- throw new NonAMQPDestinationException(destination);
- }
-
- DestinationImpl toDestination(String address, Set<String> kind)
- {
- if( address == null )
- {
- return null;
- }
-
- // If destination prefixes are in play, we have to strip the the prefix, and we might
- // be able to infer the kind, if we don't know it yet.
- DecodedDestination decoded = _sessionImpl.getConnection().toDecodedDestination(address, kind);
- address = decoded.getAddress();
- kind = decoded.getAttributes();
-
- if( kind == null )
- {
- return DestinationImpl.valueOf(address);
- }
- if( kind.contains(QUEUE_ATTRIBUTE) )
- {
- if( kind.contains(TEMPORARY_ATTRIBUTE) )
- {
- return new TemporaryQueueImpl(address, null, _sessionImpl);
- }
- else
- {
- return QueueImpl.valueOf(address);
- }
- }
- else if ( kind.contains(TOPIC_ATTRIBUTE) )
- {
- if( kind.contains(TEMPORARY_ATTRIBUTE) )
- {
- return new TemporaryTopicImpl(address, null, _sessionImpl);
- }
- else
- {
- return TopicImpl.valueOf(address);
- }
- }
-
- return DestinationImpl.valueOf(address);
- }
-
- private Object getMessageAnnotation(Symbol key)
- {
- Map messageAttrs = _messageAnnotations == null ? null : _messageAnnotations.getValue();
- return messageAttrs == null ? null : messageAttrs.get(key);
- }
-
- private Map messageAnnotationMap()
- {
- Map messageAttrs = _messageAnnotations == null ? null : _messageAnnotations.getValue();
- if(messageAttrs == null)
- {
- messageAttrs = new HashMap();
- _messageAnnotations = new MessageAnnotations(messageAttrs);
- }
- return messageAttrs;
- }
-
- private Map deliveryAnnotationsMap()
- {
- Map deliveryAttrs = _deliveryAnnotations == null ? null : _deliveryAnnotations.getValue();
- if(deliveryAttrs == null)
- {
- deliveryAttrs = new HashMap();
- _deliveryAnnotations = new DeliveryAnnotations(deliveryAttrs);
- }
- return deliveryAttrs;
- }
-
- Set<String> splitCommaSeparateSet(String value)
- {
- if( value == null )
- {
- return null;
- }
- HashSet<String> rc = new HashSet<String>();
- for( String x: value.split("\\s*,\\s*") )
- {
- rc.add(x);
- }
- return rc;
- }
-
- private static Set<String> set(String ...args)
- {
- HashSet<String> s = new HashSet<String>();
- for (String arg : args)
- {
- s.add(arg);
- }
- return Collections.unmodifiableSet(s);
- }
-
- static final String join(String sep, Iterable items)
- {
- StringBuilder result = new StringBuilder();
-
- if (items != null)
- {
- for (Object o : items)
- {
- if (result.length() > 0)
- {
- result.append(sep);
- }
- result.append(o.toString());
- }
- }
-
- return result.toString();
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
deleted file mode 100644
index 9e03f43a08..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * 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.*;
-import org.apache.qpid.amqp_1_0.client.Session;
-import org.apache.qpid.amqp_1_0.jms.MessageProducer;
-import org.apache.qpid.amqp_1_0.jms.MessageRejectedException;
-import org.apache.qpid.amqp_1_0.jms.MessageProducerException;
-import org.apache.qpid.amqp_1_0.jms.QueueSender;
-import org.apache.qpid.amqp_1_0.jms.TemporaryDestination;
-import org.apache.qpid.amqp_1_0.jms.TopicPublisher;
-import org.apache.qpid.amqp_1_0.type.Binary;
-import org.apache.qpid.amqp_1_0.type.Outcome;
-import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-
-import javax.jms.*;
-import javax.jms.IllegalStateException;
-import javax.jms.Message;
-import java.util.UUID;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.qpid.amqp_1_0.type.messaging.Accepted;
-import org.apache.qpid.amqp_1_0.type.messaging.Rejected;
-import org.apache.qpid.amqp_1_0.type.messaging.Source;
-import org.apache.qpid.amqp_1_0.type.messaging.codec.AcceptedConstructor;
-import org.apache.qpid.amqp_1_0.type.messaging.codec.RejectedConstructor;
-import org.apache.qpid.amqp_1_0.type.transport.Error;
-
-public class MessageProducerImpl implements MessageProducer, QueueSender, TopicPublisher
-{
- private boolean _disableMessageID;
- private boolean _disableMessageTimestamp;
- private int _deliveryMode = Message.DEFAULT_DELIVERY_MODE;
- private int _priority = Message.DEFAULT_PRIORITY;
- private long _timeToLive;
-
- private DestinationImpl _destination;
- private SessionImpl _session;
- private Sender _sender;
- private boolean _closed;
- private Boolean _syncPublish;
-
- private long _syncPublishTimeout = Long.getLong("qpid.sync_publish_timeout", 30000l);
-
- protected MessageProducerImpl(final Destination destination,
- final SessionImpl session) throws JMSException
- {
-
- if(destination instanceof DestinationImpl)
- {
- _destination = (DestinationImpl) destination;
- }
- else if(destination != null)
- {
- throw new InvalidDestinationException("Invalid Destination Class" + destination.getClass().getName());
- }
-
- _session = session;
- _syncPublish = session.getConnection().syncPublish();
-
- if(_destination != null)
- {
- try
- {
- final String sourceName = _destination.getLocalTerminus() != null
- ? _destination.getLocalTerminus()
- : UUID.randomUUID().toString();
-
- _sender = _session.getClientSession().createSender(sourceName, _session.toAddress(_destination), new Session.SourceConfigurator()
- {
- public void configureSource(final Source source)
- {
- source.setDefaultOutcome(new Accepted());
- source.setOutcomes(AcceptedConstructor.SYMBOL_CONSTRUCTOR, RejectedConstructor.SYMBOL_CONSTRUCTOR);
- }
- });
- }
- catch (Sender.SenderCreationException e)
- {
- // TODO - refine exception
- JMSException jmsEx = new JMSException(e.getMessage());
- jmsEx.initCause(e);
- jmsEx.setLinkedException(e);
- throw jmsEx;
- }
- catch (ConnectionClosedException e)
- {
-
- // TODO - refine exception
- JMSException jmsEx = new JMSException(e.getMessage());
- jmsEx.initCause(e);
- jmsEx.setLinkedException(e);
- throw jmsEx;
- }
- _sender.setRemoteErrorListener(new Runnable()
- {
- @Override
- public void run()
- {
- try
- {
- final ExceptionListener exceptionListener = _session.getConnection().getExceptionListener();
-
- if(exceptionListener != null)
- {
- final org.apache.qpid.amqp_1_0.type.transport.Error receiverError = _sender.getError();
-
- MessageProducerException mpe = new MessageProducerException(
- receiverError.getDescription(),
- receiverError.getCondition().getValue().toString(),
- _destination.getAddress());
-
- exceptionListener.onException(mpe);
- }
- }
- catch (JMSException e)
- {
-
- }
- }
- });
- }
- }
-
- private void checkClosed() throws IllegalStateException
- {
- if(_closed)
- {
- throw new javax.jms.IllegalStateException("Producer closed");
- }
- }
-
- public boolean getDisableMessageID() throws IllegalStateException
- {
- checkClosed();
- return _disableMessageID;
- }
-
- public void setDisableMessageID(final boolean disableMessageID) throws IllegalStateException
- {
- checkClosed();
- _disableMessageID = disableMessageID;
- }
-
- public boolean getDisableMessageTimestamp() throws IllegalStateException
- {
- checkClosed();
- return _disableMessageTimestamp;
- }
-
- public void setDisableMessageTimestamp(final boolean disableMessageTimestamp) throws IllegalStateException
- {
- checkClosed();
- _disableMessageTimestamp = disableMessageTimestamp;
- }
-
- public int getDeliveryMode() throws IllegalStateException
- {
- checkClosed();
- return _deliveryMode;
- }
-
- public void setDeliveryMode(final int deliveryMode) throws IllegalStateException
- {
- checkClosed();
- _deliveryMode = deliveryMode;
- }
-
- public int getPriority() throws IllegalStateException
- {
- checkClosed();
- return _priority;
- }
-
- public void setPriority(final int priority) throws IllegalStateException
- {
- checkClosed();
- _priority = priority;
- }
-
- public long getTimeToLive() throws IllegalStateException
- {
- checkClosed();
- return _timeToLive;
- }
-
- public void setTimeToLive(final long timeToLive) throws IllegalStateException
- {
- checkClosed();
- _timeToLive = timeToLive;
- }
-
- public DestinationImpl getDestination() throws JMSException
- {
- checkClosed();
- return _destination;
- }
-
- public void close() throws JMSException
- {
- try
- {
- if(!_closed)
- {
- _closed = true;
- if(_sender != null)
- {
- _sender.close();
- }
- }
-
- }
- catch (Sender.SenderClosingException e)
- {
- final JMSException jmsException = new JMSException("Error closing producer: " + e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- }
-
- public void send(final Message message) throws JMSException
- {
- send(message, getDeliveryMode(), getPriority(), getTimeToLive());
- }
-
- public void send(final Message message, final int deliveryMode, final int priority, final long ttl) throws JMSException
- {
- if(_sender == null)
- {
- throw new UnsupportedOperationException("No Destination provided");
- }
- if(_destination instanceof TemporaryDestination && ((TemporaryDestination)_destination).isDeleted())
- {
- throw new IllegalStateException("Destination is deleted");
- }
-
-
- //TODO
- MessageImpl msg;
- if(message instanceof org.apache.qpid.amqp_1_0.jms.Message)
- {
- msg = (MessageImpl) message;
- }
- else
- {
- msg = _session.convertMessage(message);
- }
-
-
-
- msg.setJMSDeliveryMode(deliveryMode);
- msg.setJMSPriority(priority);
-
- msg.setJMSDestination(_destination);
-
- long timestamp = 0l;
-
- if(!getDisableMessageTimestamp() || ttl != 0)
- {
- timestamp = System.currentTimeMillis();
- msg.setJMSTimestamp(timestamp);
-
- }
- if(ttl != 0)
- {
- msg.setTtl(UnsignedInteger.valueOf(ttl));
- }
- else
- {
- msg.setTtl(null);
- }
-
- if(!getDisableMessageID() && msg.getMessageId() == null)
- {
- final Object messageId = generateMessageId();
- msg.setMessageId(messageId);
-
- }
-
- if(message != msg)
- {
- message.setJMSTimestamp(msg.getJMSTimestamp());
- message.setJMSMessageID(msg.getJMSMessageID());
- message.setJMSDeliveryMode(msg.getJMSDeliveryMode());
- message.setJMSPriority(msg.getJMSPriority());
- message.setJMSExpiration(msg.getJMSExpiration());
- }
-
-
- final org.apache.qpid.amqp_1_0.client.Message clientMessage = new org.apache.qpid.amqp_1_0.client.Message(msg.getSections());
-
- DispositionAction action = null;
- final boolean doSync = Boolean.TRUE.equals(_syncPublish)
- || (deliveryMode == DeliveryMode.PERSISTENT
- && _session.getTxn() == null
- && !Boolean.FALSE.equals(_syncPublish));
- if(doSync)
- {
- action = new DispositionAction(_sender);
- }
-
- try
- {
- _sender.send(clientMessage, _session.getTxn(), action);
- }
- catch (LinkDetachedException e)
- {
- JMSException jmsException = new InvalidDestinationException("Sender has been closed");
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- catch (TimeoutException e)
- {
- JMSException jmsException = new JMSException("Timed out while waiting to get credit to send");
- jmsException.setLinkedException(e);
- throw jmsException;
- }
-
- if(doSync && !action.wasAccepted(_syncPublishTimeout))
- {
- if (action.getOutcome() instanceof Rejected)
- {
- Error err = ((Rejected) action.getOutcome()).getError();
- if(err != null)
- {
- throw new MessageRejectedException(err.getDescription(), err.getCondition().toString());
- }
- else
- {
- throw new MessageRejectedException("Message was rejected: " + action.getOutcome());
- }
- }
- else
- {
- throw new MessageRejectedException("Message was not accepted. Outcome was: " + action.getOutcome());
- }
- }
-
- if(getDestination() != null)
- {
- message.setJMSDestination(getDestination());
- }
- }
-
- public void send(final javax.jms.Queue queue, final Message message) throws JMSException
- {
- send((Destination)queue, message);
- }
-
- public void send(final javax.jms.Queue queue, final Message message, final int deliveryMode, final int priority, final long ttl)
- throws JMSException
- {
- send((Destination)queue, message, deliveryMode, priority, ttl);
- }
-
- private Object generateMessageId()
- {
- UUID uuid = UUID.randomUUID();
- final String messageIdString = uuid.toString();
- return _session.getConnection().useBinaryMessageId() ? new Binary(messageIdString.getBytes()) : messageIdString;
- }
-
- public void send(final Destination destination, final Message message) throws JMSException
- {
- send(destination, message, getDeliveryMode(), getPriority(), getTimeToLive());
- }
-
- public void send(final Destination destination, final Message message, final int deliveryMode, final int priority, final long ttl)
- throws JMSException
- {
-
- checkClosed();
- if(destination == null)
- {
- send(message, deliveryMode, priority, ttl);
- }
- else
- {
- if(_destination != null)
- {
- throw new UnsupportedOperationException("Cannot use explicit destination pon non-anonymous producer");
- }
- else if(!(destination instanceof DestinationImpl))
- {
- throw new InvalidDestinationException("Invalid Destination Class" + destination.getClass().getName());
- }
- else if(destination instanceof TemporaryDestination && ((TemporaryDestination)destination).isDeleted())
- {
- throw new IllegalStateException("Destination has been deleted");
- }
- try
- {
- _destination = (DestinationImpl) destination;
- _sender = _session.getClientSession().createSender(_session.toAddress(_destination));
-
- send(message, deliveryMode, priority, ttl);
-
- _sender.close();
-
-
-
- }
- catch (Sender.SenderCreationException e)
- {
- // TODO - refine exception
- JMSException jmsEx = new JMSException(e.getMessage());
- jmsEx.initCause(e);
- jmsEx.setLinkedException(e);
- throw jmsEx;
- }
- catch (Sender.SenderClosingException e)
- {
- JMSException jmsEx = new JMSException(e.getMessage());
- jmsEx.initCause(e);
- jmsEx.setLinkedException(e);
- throw jmsEx;
- }
- catch (ConnectionClosedException e)
- {
-
- JMSException jmsEx = new JMSException(e.getMessage());
- jmsEx.initCause(e);
- jmsEx.setLinkedException(e);
- throw jmsEx;
- }
- finally
- {
- _sender = null;
- _destination = null;
- }
- }
- }
-
- public QueueImpl getQueue() throws JMSException
- {
- return (QueueImpl) getDestination();
- }
-
- public TopicImpl getTopic() throws JMSException
- {
- return (TopicImpl) getDestination();
- }
-
- public void publish(final Message message) throws JMSException
- {
- send(message);
- }
-
- public void publish(final Message message, final int deliveryMode, final int priority, final long ttl) throws JMSException
- {
- send(message, deliveryMode, priority, ttl);
- }
-
- public void publish(final Topic topic, final Message message) throws JMSException
- {
- send(topic, message);
- }
-
- public void publish(final Topic topic, final Message message, final int deliveryMode, final int priority, final long ttl)
- throws JMSException
- {
- send(topic, message, deliveryMode, priority, ttl);
- }
-
- private static class DispositionAction implements Sender.OutcomeAction
- {
- private final Sender _sender;
- private final Object _lock;
- private Outcome _outcome;
-
- public DispositionAction(Sender sender)
- {
- _sender = sender;
- _lock = sender.getEndpoint().getLock();
- }
-
- @Override
- public void onOutcome(Binary deliveryTag, Outcome outcome)
- {
- synchronized (_lock)
- {
- _outcome = outcome;
- _lock.notifyAll();
- }
- }
-
- public boolean wasAccepted(long timeout) throws JMSException
- {
- synchronized(_lock)
- {
- while(_outcome == null && !_sender.getEndpoint().isDetached())
- {
- try
- {
- _lock.wait(timeout);
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- if(_outcome == null)
- {
-
- if(_sender.getEndpoint().isDetached())
- {
- throw new JMSException("Link was detached");
- }
- else
- {
- throw new JMSException("Timed out waiting for message acceptance");
- }
- }
- else
- {
- return _outcome instanceof Accepted;
- }
- }
- }
-
- Outcome getOutcome()
- {
- return _outcome;
- }
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ObjectMessageImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ObjectMessageImpl.java
deleted file mode 100644
index a80af518c4..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ObjectMessageImpl.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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 java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.jms.JMSException;
-import javax.jms.MessageNotWriteableException;
-
-import org.apache.qpid.amqp_1_0.jms.ObjectMessage;
-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.Symbol;
-import org.apache.qpid.amqp_1_0.type.messaging.ApplicationProperties;
-import org.apache.qpid.amqp_1_0.type.messaging.Data;
-import org.apache.qpid.amqp_1_0.type.messaging.DeliveryAnnotations;
-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.MessageAnnotations;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-public class ObjectMessageImpl extends MessageImpl implements ObjectMessage
-{
- static final Symbol CONTENT_TYPE = Symbol.valueOf("application/x-java-serialized-object");
-
- static final Data NULL_OBJECT_DATA;
- static
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try
- {
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(null);
- oos.flush();
- oos.close();
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- NULL_OBJECT_DATA = new Data(new Binary(baos.toByteArray()));
- }
-
- private Data _objectData = NULL_OBJECT_DATA;
-
- protected ObjectMessageImpl(Header header,
- DeliveryAnnotations deliveryAnnotations,
- MessageAnnotations messageAnnotations,
- Properties properties,
- ApplicationProperties appProperties,
- Data dataSection,
- Footer footer,
- SessionImpl session)
- {
- super(header, deliveryAnnotations, messageAnnotations, properties, appProperties, footer, session);
- getProperties().setContentType(CONTENT_TYPE);
- Serializable serializable = null;
- _objectData = dataSection;
-
- }
-
- protected ObjectMessageImpl(final SessionImpl session)
- {
- super(new Header(), new DeliveryAnnotations(new HashMap()), new MessageAnnotations(new HashMap()),
- new Properties(), new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
- session);
- getProperties().setContentType(CONTENT_TYPE);
- }
-
- public void setObject(final Serializable serializable) throws MessageNotWriteableException
- {
- checkWritable();
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try
- {
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(serializable);
- oos.flush();
- oos.close();
-
- _objectData = new Data(new Binary(baos.toByteArray()));
-
- }
- catch (IOException e)
- {
- e.printStackTrace(); //TODO
- }
- }
-
- public Serializable getObject() throws JMSException
- {
-
- if(_objectData == null)
- {
- return null;
- }
-
- Binary data = _objectData.getValue();
-
- try
- {
- ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data.getArray(), data.getArrayOffset(), data.getLength()));
- return (Serializable) ois.readObject();
- }
- catch (IOException e)
- {
- JMSException jmsException = new JMSException(e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- catch (ClassNotFoundException e)
- {
-
- JMSException jmsException = new JMSException(e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
-
- }
-
- @Override
- public void clearBody() throws JMSException
- {
- super.clearBody();
- _objectData = null;
- }
-
- @Override Collection<Section> getSections()
- {
- List<Section> sections = new ArrayList<Section>();
- sections.add(getHeader());
- if(getDeliveryAnnotations() != null && getDeliveryAnnotations().getValue() != null && !getDeliveryAnnotations().getValue().isEmpty())
- {
- sections.add(getDeliveryAnnotations());
- }
- if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
- {
- sections.add(getMessageAnnotations());
- }
- sections.add(getProperties());
- sections.add(getApplicationProperties());
-
- sections.add(_objectData);
-
- sections.add(getFooter());
- return sections;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueBrowserImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueBrowserImpl.java
deleted file mode 100644
index 29de87875c..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueBrowserImpl.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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 java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import org.apache.qpid.amqp_1_0.client.AcknowledgeMode;
-import org.apache.qpid.amqp_1_0.client.ConnectionErrorException;
-import org.apache.qpid.amqp_1_0.client.Message;
-import org.apache.qpid.amqp_1_0.client.Receiver;
-import org.apache.qpid.amqp_1_0.jms.QueueBrowser;
-import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-import org.apache.qpid.amqp_1_0.type.messaging.Filter;
-import org.apache.qpid.amqp_1_0.type.messaging.JMSSelectorFilter;
-import org.apache.qpid.amqp_1_0.type.messaging.StdDistMode;
-import org.apache.qpid.amqp_1_0.type.transport.AmqpError;
-
-public class QueueBrowserImpl implements QueueBrowser
-{
- private static final String JMS_SELECTOR = "jms-selector";
- private QueueImpl _queue;
- private String _selector;
- private final SessionImpl _session;
- private Map<Symbol, Filter> _filters;
- private HashSet<MessageEnumeration> _enumerations = new HashSet<MessageEnumeration>();
- private boolean _closed;
-
- QueueBrowserImpl(final QueueImpl queue, final String selector, SessionImpl session) throws JMSException
- {
- _queue = queue;
- _selector = selector;
- _session = session;
-
-
- if(selector == null || selector.trim().equals(""))
- {
- _filters = null;
- }
- else
- {
- _filters = Collections.singletonMap(Symbol.valueOf(JMS_SELECTOR),(Filter) new JMSSelectorFilter(_selector));
- // We do this just to have the server validate the filter..
- new MessageEnumeration().close();
- }
- }
-
- public QueueImpl getQueue()
- {
- return _queue;
- }
-
- public String getMessageSelector()
- {
- return _selector;
- }
-
- public Enumeration getEnumeration() throws JMSException
- {
- if(_closed)
- {
- throw new IllegalStateException("Browser has been closed");
- }
- return new MessageEnumeration();
- }
-
- public void close() throws JMSException
- {
- _closed = true;
- for(MessageEnumeration me : new ArrayList<MessageEnumeration>(_enumerations))
- {
- me.close();
- }
- }
-
- private final class MessageEnumeration implements Enumeration<MessageImpl>
- {
- private Receiver _receiver;
- private MessageImpl _nextElement;
- private boolean _needNext = true;
-
- MessageEnumeration() throws JMSException
- {
- try
- {
- _receiver = _session.getClientSession().createReceiver(_session.toAddress(_queue),
- StdDistMode.COPY,
- AcknowledgeMode.AMO, null,
- false,
- _filters, null);
- _receiver.setCredit(UnsignedInteger.valueOf(100), true);
- }
- catch(ConnectionErrorException e)
- {
- org.apache.qpid.amqp_1_0.type.transport.Error error = e.getRemoteError();
- if(AmqpError.INVALID_FIELD.equals(error.getCondition()))
- {
- throw new InvalidSelectorException(e.getMessage());
- }
- else
- {
- throw new JMSException(e.getMessage(), error.getCondition().getValue().toString());
- }
-
- }
- _enumerations.add(this);
-
- }
-
- public void close()
- {
- _enumerations.remove(this);
- _receiver.close();
- _receiver = null;
- }
-
- @Override
- public boolean hasMoreElements()
- {
- if( _receiver == null )
- {
- return false;
- }
- if( _needNext )
- {
- _needNext = false;
- Message msg = _receiver.receive(0L);
- if(msg != null)
- {
- _receiver.acknowledge(msg);
- }
- _nextElement = createJMSMessage(msg);
- if( _nextElement == null )
- {
- _receiver.setCredit(UnsignedInteger.valueOf(100), true);
- // Drain to verify there really are no more messages.
- _receiver.drain();
- _receiver.drainWait();
- msg = _receiver.receive(0L);
-
- if(msg != null)
- {
- _receiver.acknowledge(msg);
- }
- _nextElement = createJMSMessage(msg);
-
- if( _nextElement == null )
- {
- close();
- }
- else
- {
- // there are still more messages, open up the credit window again..
- _receiver.clearDrain();
- }
- }
- }
- return _nextElement != null;
- }
-
- @Override
- public MessageImpl nextElement()
- {
- if( hasMoreElements() )
- {
- MessageImpl message = _nextElement;
- _nextElement = null;
- _needNext = true;
- return message;
- }
- else
- {
- throw new NoSuchElementException();
- }
- }
- }
-
- MessageImpl createJMSMessage(final Message msg)
- {
- if(msg != null)
- {
- final MessageImpl message = _session.getMessageFactory().createMessage(_queue, msg);
- message.setFromQueue(true);
- message.setFromTopic(false);
- return message;
- }
- else
- {
- return null;
- }
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueConnectionImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueConnectionImpl.java
deleted file mode 100644
index 3741702505..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueConnectionImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.QueueConnection;
-
-import javax.jms.ConnectionConsumer;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.ServerSessionPool;
-
-public class QueueConnectionImpl extends ConnectionImpl implements QueueConnection
-{
- QueueConnectionImpl(String host, int port, String username, String password, String clientId)
- throws JMSException
- {
- super(host, port, username, password, clientId);
- }
-
- public QueueSessionImpl createQueueSession(final boolean b, final int i) throws JMSException
- {
- return null; //TODO
- }
-
- public ConnectionConsumer createConnectionConsumer(final Queue queue,
- final String s,
- final ServerSessionPool serverSessionPool,
- final int i) throws JMSException
- {
- return null; //TODO
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueImpl.java
deleted file mode 100644
index 589ee5204f..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.Queue;
-
-import java.util.UUID;
-import java.util.WeakHashMap;
-
-public class QueueImpl extends DestinationImpl implements Queue
-{
- private static final WeakHashMap<String, QueueImpl> QUEUE_CACHE =
- new WeakHashMap<String, QueueImpl>();
-
- public QueueImpl(String address)
- {
- super(address);
- }
-
- public String getQueueName()
- {
- return getAddress();
- }
-
- public static synchronized QueueImpl createQueue(String address)
- {
- QueueImpl queue;
- if (address.endsWith("!!"))
- {
- address = address.substring(0, address.length() - 2);
- String localTerminusName = UUID.randomUUID().toString();
- queue = new QueueImpl(address);
- queue.setLocalTerminus(localTerminusName);
- }
- else
- {
- queue = QUEUE_CACHE.get(address);
- if(queue == null)
- {
- queue = new QueueImpl(address);
- QUEUE_CACHE.put(address, queue);
- }
- }
- return queue;
- }
-
- public static QueueImpl valueOf(String address)
- {
- return address == null ? null : createQueue(address);
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueReceiverImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueReceiverImpl.java
deleted file mode 100644
index 21161ff83f..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueReceiverImpl.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 javax.jms.JMSException;
-import org.apache.qpid.amqp_1_0.client.ConnectionErrorException;
-import org.apache.qpid.amqp_1_0.client.Receiver;
-import org.apache.qpid.amqp_1_0.jms.Queue;
-import org.apache.qpid.amqp_1_0.jms.QueueReceiver;
-
-import java.util.UUID;
-
-public class QueueReceiverImpl extends MessageConsumerImpl implements QueueReceiver
-{
- QueueReceiverImpl(final QueueImpl destination,
- final SessionImpl session,
- final String selector,
- final boolean noLocal)
- throws JMSException
- {
- super(destination, session, selector, noLocal);
- setQueueConsumer(true);
- }
-
- protected Receiver createClientReceiver() throws JMSException
- {
- try
- {
- final String targetAddr =
- getDestination().getLocalTerminus() != null ? getDestination().getLocalTerminus() : UUID
- .randomUUID().toString();
- return getSession().getClientSession().createMovingReceiver(getSession().toAddress(getDestination()),
- targetAddr);
- }
- catch (ConnectionErrorException e)
- {
- throw new JMSException(e.getMessage(), e.getRemoteError().getCondition().toString());
- }
- }
-
- public Queue getQueue() throws JMSException
- {
- return (QueueImpl) getDestination();
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueSenderImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueSenderImpl.java
deleted file mode 100644
index 690febc100..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueSenderImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.QueueSender;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-public class QueueSenderImpl extends MessageProducerImpl implements QueueSender
-{
- protected QueueSenderImpl(final Destination destination, final SessionImpl session)
- throws JMSException
- {
- super(destination, session);
- }
-
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueSessionImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueSessionImpl.java
deleted file mode 100644
index 0d89e9b495..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueSessionImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.QueueSession;
-
-import javax.jms.JMSException;
-import javax.jms.Queue;
-
-public class QueueSessionImpl extends SessionImpl implements QueueSession
-{
- protected QueueSessionImpl(final ConnectionImpl connection, final AcknowledgeMode acknowledgeMode)
- throws JMSException
- {
- super(connection, acknowledgeMode);
- setQueueSession(true);
- }
-
- public QueueReceiverImpl createReceiver(final Queue queue) throws JMSException
- {
- return createReceiver(queue, null);
- }
-
- public QueueReceiverImpl createReceiver(final Queue queue, final String selector) throws JMSException
- {
- // TODO - assert queue is a queueimpl and throw relevant JMS Exception
- final QueueReceiverImpl messageConsumer;
- synchronized(getClientSession().getEndpoint().getLock())
- {
- messageConsumer = new QueueReceiverImpl((QueueImpl)queue, this, selector, false);
- addConsumer(messageConsumer);
- }
- return messageConsumer;
-
- }
-
- public QueueSenderImpl createSender(final Queue queue) throws JMSException
- {
- return null; //TODO
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
deleted file mode 100644
index 945ae1c655..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
+++ /dev/null
@@ -1,1066 +0,0 @@
-/*
- * 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 java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.IllegalStateException;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.MessageEOFException;
-import javax.jms.MessageListener;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-
-import org.apache.qpid.amqp_1_0.client.*;
-import org.apache.qpid.amqp_1_0.jms.QueueReceiver;
-import org.apache.qpid.amqp_1_0.jms.QueueSender;
-import org.apache.qpid.amqp_1_0.jms.QueueSession;
-import org.apache.qpid.amqp_1_0.jms.Session;
-import org.apache.qpid.amqp_1_0.jms.TemporaryDestination;
-import org.apache.qpid.amqp_1_0.jms.TopicPublisher;
-import org.apache.qpid.amqp_1_0.jms.TopicSession;
-import org.apache.qpid.amqp_1_0.jms.TopicSubscriber;
-import org.apache.qpid.amqp_1_0.jms.ErrorCodes;
-import org.apache.qpid.amqp_1_0.jms.SessionException;
-import org.apache.qpid.amqp_1_0.transport.SessionEventListener;
-import org.apache.qpid.amqp_1_0.type.messaging.Source;
-import org.apache.qpid.amqp_1_0.type.messaging.Target;
-import org.apache.qpid.amqp_1_0.type.transport.*;
-import org.apache.qpid.amqp_1_0.type.transport.Error;
-
-public class SessionImpl implements Session, QueueSession, TopicSession
-{
- private ConnectionImpl _connection;
- private AcknowledgeMode _acknowledgeMode;
- private org.apache.qpid.amqp_1_0.client.Session _session;
- private MessageFactory _messageFactory;
- private List<MessageConsumerImpl> _consumers = new ArrayList<MessageConsumerImpl>();
- private List<MessageProducerImpl> _producers = new ArrayList<MessageProducerImpl>();
-
- private MessageListener _messageListener;
- private Dispatcher _dispatcher = new Dispatcher();
- private Thread _dispatcherThread;
-
- private boolean _closed;
-
- private boolean _isQueueSession;
- private boolean _isTopicSession;
- private Transaction _txn;
- private int _maxPrefetch;
-
- protected SessionImpl(final ConnectionImpl connection, final AcknowledgeMode acknowledgeMode) throws JMSException
- {
- _connection = connection;
- _acknowledgeMode = acknowledgeMode;
- Connection clientConn = _connection.getClientConnection();
- try
- {
- _session = clientConn.createSession();
- }
- catch (ConnectionException e)
- {
- JMSException jmsException;
- if (e instanceof ChannelsExhaustedException)
- {
- jmsException = new JMSException(e.getMessage(), ErrorCodes.CHANNELS_EXHAUSTED);
- }
- else
- {
- jmsException = new JMSException(e.getMessage());
- }
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- _session.getEndpoint().setSessionEventListener(new SessionEventListener.DefaultSessionEventListener()
- {
- @Override
- public void remoteEnd(End end)
- {
- if(!_closed)
- {
- try
- {
- close();
- }
- catch (JMSException e)
- {
- }
- try
- {
- final Error error = end == null ? null : end.getError();
- final ExceptionListener exceptionListener = _connection.getExceptionListener();
- if(exceptionListener != null)
- {
- if(error != null)
- {
- SessionException se = new SessionException(
- error.getDescription(),
- error.getCondition().getValue().toString());
-
- exceptionListener.onException(se);
- }
- else
- {
- exceptionListener.onException(new SessionException("Session remotely closed"));
- }
- }
- }
- catch (JMSException e)
- {
-
- }
-
- }
- }
- });
- if(_acknowledgeMode == AcknowledgeMode.SESSION_TRANSACTED)
- {
- try
- {
- _txn = _session.createSessionLocalTransaction();
- }
- catch (LinkDetachedException e)
- {
- JMSException jmsException = new JMSException("Unable to create transactional session");
- jmsException.setLinkedException(e);
- jmsException.initCause(e);
- throw jmsException;
- }
- }
-
- _messageFactory = new MessageFactory(this);
-
- }
-
- public BytesMessageImpl createBytesMessage() throws IllegalStateException
- {
- checkClosed();
- return new BytesMessageImpl(this);
-
- }
-
- public MapMessageImpl createMapMessage() throws JMSException
- {
- checkClosed();
- return new MapMessageImpl(this);
- }
-
- public MessageImpl createMessage() throws IllegalStateException
- {
- return createAmqpMessage();
- }
-
- public ObjectMessageImpl createObjectMessage() throws JMSException
- {
- checkClosed();
- return new ObjectMessageImpl(this);
- }
-
- public ObjectMessageImpl createObjectMessage(final Serializable serializable) throws JMSException
- {
- checkClosed();
- ObjectMessageImpl msg = new ObjectMessageImpl(this);
- msg.setObject(serializable);
- return msg;
- }
-
- public StreamMessageImpl createStreamMessage() throws JMSException
- {
- checkClosed();
- return new StreamMessageImpl(this);
- }
-
- public TextMessageImpl createTextMessage() throws JMSException
- {
- return createTextMessage("");
- }
-
- public TextMessageImpl createTextMessage(final String s) throws JMSException
- {
- checkClosed();
- TextMessageImpl msg = new TextMessageImpl(this);
- msg.setText(s);
- return msg;
- }
-
- public AmqpMessageImpl createAmqpMessage() throws IllegalStateException
- {
- checkClosed();
- return new AmqpMessageImpl(this);
- }
-
- public boolean getTransacted() throws JMSException
- {
- checkClosed();
- return _acknowledgeMode == AcknowledgeMode.SESSION_TRANSACTED;
- }
-
- public int getAcknowledgeMode() throws IllegalStateException
- {
- checkClosed();
- return _acknowledgeMode.ordinal();
- }
-
- AcknowledgeMode getAckModeEnum()
- {
- return _acknowledgeMode;
- }
-
- public void commit() throws JMSException
- {
- checkClosed();
- checkTransactional();
-
- try
- {
- _txn.commit();
- for(MessageConsumerImpl consumer : _consumers)
- {
- consumer.postCommit();
- }
-
- _txn = _session.createSessionLocalTransaction();
- }
- catch (LinkDetachedException e)
- {
- final JMSException jmsException = new JMSException("Unable to commit transaction");
- jmsException.setLinkedException(e);
- jmsException.initCause(e);
- throw jmsException;
- }
- }
-
- public void rollback() throws JMSException
- {
- checkClosed();
- checkTransactional();
-
- try
- {
- _txn.rollback();
-
- for(MessageConsumerImpl consumer : _consumers)
- {
- consumer.postRollback();
- }
-
- _txn = _session.createSessionLocalTransaction();
- }
- catch (LinkDetachedException e)
- {
- final JMSException jmsException = new JMSException("Unable to rollback transaction");
- jmsException.setLinkedException(e);
- jmsException.initCause(e);
- throw jmsException;
- }
- }
-
- private void checkTransactional() throws JMSException
- {
- if(!getTransacted())
- {
- throw new IllegalStateException("Session must be transacted in order to perform this operation");
- }
- }
-
- public void close() throws JMSException
- {
- if(!_closed)
- {
- _closed = true;
- _dispatcher.close();
-
- List<MessageConsumerImpl> consumers = null;
- List<MessageProducerImpl> producers = null;
- synchronized (_session.getEndpoint().getLock())
- {
- consumers = new ArrayList<MessageConsumerImpl>(_consumers);
- producers = new ArrayList<MessageProducerImpl>(_producers);
- }
- for(MessageConsumerImpl consumer : consumers)
- {
- consumer.close();
- }
- for(MessageProducerImpl producer : producers)
- {
- producer.close();
- }
-
- _session.close();
- _connection.removeSession(this);
- }
- }
-
- private void checkClosed() throws IllegalStateException
- {
- if(_closed)
- {
- throw new IllegalStateException("Closed");
- }
- }
-
- public void recover() throws JMSException
- {
- checkClosed();
- checkNotTransactional();
-
- if(_acknowledgeMode == AcknowledgeMode.CLIENT_ACKNOWLEDGE)
- {
- synchronized(_session.getEndpoint().getLock())
- {
- for(MessageConsumerImpl consumer : _consumers)
- {
- consumer.doRecover();
- }
- }
- }
- else
- {
- if(Thread.currentThread() == _dispatcherThread)
- {
- _dispatcher.doRecover();
- }
- }
-
- }
-
- private void checkNotTransactional() throws JMSException
- {
-
- if(getTransacted())
- {
- throw new IllegalStateException("This operation cannot be carried out on a transacted session");
- }
- }
-
- public MessageListener getMessageListener() throws JMSException
- {
- return _messageListener;
- }
-
- public void setMessageListener(final MessageListener messageListener) throws JMSException
- {
- if(_messageListener != null)
- {
- // TODO
- }
- else
- {
- _messageListener = messageListener;
- }
- }
-
- public void run()
- {
- //TODO
- }
-
- public MessageProducerImpl createProducer(final Destination destination) throws JMSException
- {
- checkClosed();
-
- final MessageProducerImpl messageProducer = new MessageProducerImpl(destination, this);
-
- _producers.add(messageProducer);
-
- return messageProducer;
- }
-
- public MessageConsumerImpl createConsumer(final Destination destination) throws JMSException
- {
- checkClosed();
- return createConsumer(destination, null, false);
- }
-
- public MessageConsumerImpl createConsumer(final Destination destination, final String selector) throws JMSException
- {
- checkClosed();
- return createConsumer(destination, selector, false);
- }
-
- public MessageConsumerImpl createConsumer(final Destination destination, final String selector, final boolean noLocal)
- throws JMSException
- {
- checkClosed();
- checkValidDestination(destination);
- if(destination instanceof TemporaryDestination)
- {
- TemporaryDestination temporaryDestination = (TemporaryDestination) destination;
- if(temporaryDestination.getSession() != this)
- {
- throw new JMSException("Cannot consume from a temporary destination created on another session");
- }
- if(temporaryDestination.isDeleted())
- {
- throw new IllegalStateException("Destination is deleted");
- }
- }
- final MessageConsumerImpl messageConsumer;
- synchronized(_session.getEndpoint().getLock())
- {
- if(_dispatcherThread == null)
- {
- _dispatcherThread = new Thread(_dispatcher);
- _dispatcherThread.start();
- }
-
- messageConsumer = new MessageConsumerImpl(destination, this, selector, noLocal);
- addConsumer(messageConsumer);
- if(_connection.isStarted())
- {
- messageConsumer.start();
- }
- }
- return messageConsumer;
- }
-
- private void checkValidDestination(Destination destination) throws InvalidDestinationException
- {
- if (destination == null || !(destination instanceof DestinationImpl))
- {
- throw new InvalidDestinationException("Invalid Destination");
- }
- }
-
-
- protected void addConsumer(final MessageConsumerImpl messageConsumer)
- {
- _consumers.add(messageConsumer);
- }
-
- public QueueImpl createQueue(final String s) throws JMSException
- {
- checkClosed();
- checkNotTopicSession();
- return QueueImpl.valueOf(s);
- }
-
- public QueueReceiver createReceiver(final Queue queue) throws JMSException
- {
- checkClosed();
- checkNotTopicSession();
- return createConsumer(queue);
- }
-
- public QueueReceiver createReceiver(final Queue queue, final String selector) throws JMSException
- {
- checkClosed();
- checkNotTopicSession();
- return createConsumer(queue, selector);
- }
-
- public QueueSender createSender(final Queue queue) throws JMSException
- {
- checkClosed();
- checkNotTopicSession();
- return createProducer(queue);
- }
-
- public TopicImpl createTopic(final String s) throws JMSException
- {
- checkClosed();
- checkNotQueueSession();
- return TopicImpl.valueOf(s);
- }
-
- public TopicSubscriber createSubscriber(final Topic topic) throws JMSException
- {
- checkClosed();
- checkNotQueueSession();
- return createConsumer(topic);
- }
-
- public TopicSubscriber createSubscriber(final Topic topic, final String selector, final boolean noLocal) throws JMSException
- {
- checkClosed();
- checkNotQueueSession();
- return createConsumer(topic, selector, noLocal);
- }
-
- public TopicSubscriberImpl createDurableSubscriber(final Topic topic, final String name) throws JMSException
- {
- checkClosed();
- checkNotQueueSession();
- return createDurableSubscriber(topic, name, null, false);
- }
-
- private void checkNotQueueSession() throws IllegalStateException
- {
- if(_isQueueSession)
- {
- throw new IllegalStateException("Cannot perform this operation on a QueueSession");
- }
- }
-
-
- private void checkNotTopicSession() throws IllegalStateException
- {
- if(_isTopicSession)
- {
- throw new IllegalStateException("Cannot perform this operation on a TopicSession");
- }
- }
-
- public TopicSubscriberImpl createDurableSubscriber(final Topic topic, final String name, final String selector, final boolean noLocal)
- throws JMSException
- {
- checkClosed();
- checkNotQueueSession();
- if(!(topic instanceof TopicImpl))
- {
- throw new InvalidDestinationException("invalid destination " + topic);
- }
- final TopicSubscriberImpl messageConsumer;
- synchronized(_session.getEndpoint().getLock())
- {
- messageConsumer = new TopicSubscriberImpl(name, true, (org.apache.qpid.amqp_1_0.jms.Topic) topic, this,
- selector,
- noLocal);
-
- if(_dispatcherThread == null)
- {
- _dispatcherThread = new Thread(_dispatcher);
- _dispatcherThread.start();
- }
-
- addConsumer(messageConsumer);
- if(_connection.isStarted())
- {
- messageConsumer.start();
- }
- }
- return messageConsumer;
- }
-
- public TopicPublisher createPublisher(final Topic topic) throws JMSException
- {
- checkClosed();
- checkNotQueueSession();
- return createProducer(topic);
- }
-
- public QueueBrowserImpl createBrowser(final Queue queue) throws JMSException
- {
- checkClosed();
- checkNotTopicSession();
- checkValidDestination(queue);
- return createBrowser(queue, null);
- }
-
- public QueueBrowserImpl createBrowser(final Queue queue, final String selector) throws JMSException
- {
- checkClosed();
- checkNotTopicSession();
- checkValidDestination(queue);
-
- return new QueueBrowserImpl((QueueImpl) queue, selector, this);
-
- }
-
- public TemporaryQueueImpl createTemporaryQueue() throws JMSException
- {
- checkClosed();
- checkNotTopicSession();
- try
- {
- Sender send = _session.createTemporaryQueueSender();
-
- TemporaryQueueImpl tempQ = new TemporaryQueueImpl(((Target)send.getTarget()).getAddress(), send, this);
- return tempQ;
- }
- catch (Sender.SenderCreationException e)
- {
- throw new JMSException("Unable to create temporary queue");
- }
- catch (ConnectionClosedException e)
- {
- throw new JMSException("Unable to create temporary queue");
- }
- }
-
- public TemporaryTopicImpl createTemporaryTopic() throws JMSException
- {
- checkClosed();
- checkNotQueueSession();
- try
- {
- Sender send = _session.createTemporaryQueueSender();
-
- TemporaryTopicImpl tempQ = new TemporaryTopicImpl(((Target)send.getTarget()).getAddress(), send, this);
- return tempQ;
- }
- catch (Sender.SenderCreationException e)
- {
- throw new JMSException("Unable to create temporary queue");
- }
- catch (ConnectionClosedException e)
- {
- throw new JMSException("Unable to create temporary queue");
- }
- }
-
- public void unsubscribe(final String s) throws JMSException
- {
- checkClosed();
-
- checkNotQueueSession();
-
- Target target = new Target();
- target.setAddress(UUID.randomUUID().toString());
-
- try
- {
- Receiver receiver = new Receiver(getClientSession(), s, target, null,
- org.apache.qpid.amqp_1_0.client.AcknowledgeMode.ALO, false);
-
- final org.apache.qpid.amqp_1_0.type.Source receiverSource = receiver.getSource();
- if(receiverSource instanceof Source)
- {
- Source source = (Source) receiverSource;
- receiver.close();
- receiver = new Receiver(getClientSession(), s, target, source,
- org.apache.qpid.amqp_1_0.client.AcknowledgeMode.ALO, false);
-
- }
- receiver.close();
- }
- catch(ConnectionErrorException e)
- {
- if(e.getRemoteError().getCondition() == AmqpError.NOT_FOUND)
- {
- throw new InvalidDestinationException(s);
- }
- else
- {
- JMSException jmsException = new JMSException(e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- }
-
- //TODO
- }
-
- void stop()
- {
- //TODO
- }
-
- void start()
- {
- _dispatcher.start();
- for(MessageConsumerImpl consumer : _consumers)
- {
- consumer.start();
- }
- }
-
- org.apache.qpid.amqp_1_0.client.Session getClientSession()
- {
- return _session;
- }
-
- public MessageFactory getMessageFactory()
- {
- return _messageFactory;
- }
-
- void acknowledgeAll() throws IllegalStateException
- {
- synchronized(_session.getEndpoint().getLock())
- {
- checkClosed();
- for(MessageConsumerImpl consumer : _consumers)
- {
- consumer.acknowledgeAll();
- }
- }
- }
-
- void messageListenerSet(final MessageConsumerImpl messageConsumer)
- {
- _dispatcher.updateMessageListener(messageConsumer);
- }
-
- public void messageArrived(final MessageConsumerImpl messageConsumer)
- {
- _dispatcher.messageArrivedAtConsumer(messageConsumer);
- }
-
- MessageImpl convertMessage(final javax.jms.Message message) throws JMSException
- {
- MessageImpl replacementMessage;
-
- if(message instanceof BytesMessage)
- {
- replacementMessage = convertBytesMessage((BytesMessage) message);
- }
- else
- {
- if(message instanceof MapMessage)
- {
- replacementMessage = convertMapMessage((MapMessage) message);
- }
- else
- {
- if(message instanceof ObjectMessage)
- {
- replacementMessage = convertObjectMessage((ObjectMessage) message);
- }
- else
- {
- if(message instanceof StreamMessage)
- {
- replacementMessage = convertStreamMessage((StreamMessage) message);
- }
- else
- {
- if(message instanceof TextMessage)
- {
- replacementMessage = convertTextMessage((TextMessage) message);
- }
- else
- {
- replacementMessage = createMessage();
- }
- }
- }
- }
- }
-
- convertMessageProperties(message, replacementMessage);
-
- return replacementMessage;
- }
-
-
- private void convertMessageProperties(final javax.jms.Message message, final MessageImpl replacementMessage)
- throws JMSException
- {
- Enumeration propertyNames = message.getPropertyNames();
- while (propertyNames.hasMoreElements())
- {
- String propertyName = String.valueOf(propertyNames.nextElement());
- // TODO: Shouldn't need to check for JMS properties here as don't think getPropertyNames() should return them
- if (!propertyName.startsWith("JMSX_"))
- {
- Object value = message.getObjectProperty(propertyName);
- replacementMessage.setObjectProperty(propertyName, value);
- }
- }
-
-
- replacementMessage.setJMSDeliveryMode(message.getJMSDeliveryMode());
-
- if (message.getJMSReplyTo() != null)
- {
- replacementMessage.setJMSReplyTo(message.getJMSReplyTo());
- }
-
- replacementMessage.setJMSType(message.getJMSType());
-
- replacementMessage.setJMSCorrelationID(message.getJMSCorrelationID());
- }
-
- private MessageImpl convertMapMessage(final MapMessage message) throws JMSException
- {
- MapMessageImpl mapMessage = createMapMessage();
-
- Enumeration mapNames = message.getMapNames();
- while (mapNames.hasMoreElements())
- {
- String name = (String) mapNames.nextElement();
- mapMessage.setObject(name, message.getObject(name));
- }
-
- return mapMessage;
- }
-
- private MessageImpl convertBytesMessage(final BytesMessage message) throws JMSException
- {
- BytesMessageImpl bytesMessage = createBytesMessage();
-
- message.reset();
-
- byte[] buf = new byte[1024];
-
- int len;
-
- while ((len = message.readBytes(buf)) != -1)
- {
- bytesMessage.writeBytes(buf, 0, len);
- }
-
- return bytesMessage;
- }
-
- private MessageImpl convertObjectMessage(final ObjectMessage message) throws JMSException
- {
- ObjectMessageImpl objectMessage = createObjectMessage();
- objectMessage.setObject(message.getObject());
- return objectMessage;
- }
-
- private MessageImpl convertStreamMessage(final StreamMessage message) throws JMSException
- {
- StreamMessageImpl streamMessage = createStreamMessage();
-
- try
- {
- message.reset();
- while (true)
- {
- streamMessage.writeObject(message.readObject());
- }
- }
- catch (MessageEOFException e)
- {
- // we're at the end so don't mind the exception
- }
-
- return streamMessage;
- }
-
- private MessageImpl convertTextMessage(final TextMessage message) throws JMSException
- {
- return createTextMessage(message.getText());
- }
-
- ConnectionImpl getConnection()
- {
- return _connection;
- }
-
- Transaction getTxn()
- {
- return _txn;
- }
-
- public void setMaxPrefetch(final int maxPrefetch)
- {
- _maxPrefetch = maxPrefetch;
- }
-
- public int getMaxPrefetch()
- {
- return _maxPrefetch;
- }
-
- private class Dispatcher implements Runnable
- {
-
- private final List<MessageConsumerImpl> _messageConsumerList = new ArrayList<MessageConsumerImpl>();
-
- private boolean _closed;
- private boolean _started;
-
- private Message _recoveredMessage;
- private MessageConsumerImpl _recoveredConsumer;
- private MessageConsumerImpl _currentConsumer;
- private Message _currentMessage;
-
- public void run()
- {
- synchronized(getLock())
- {
-
- while(!(_closed || getClientSession().getEndpoint().isEnded()))
- {
- while(!(_closed || getClientSession().getEndpoint().isEnded()) && (!_started || (_recoveredMessage == null && _messageConsumerList.isEmpty())))
- {
- try
- {
- getLock().wait();
- }
- catch (InterruptedException e)
- {
- return;
- }
- }
- while(!(_closed || getClientSession().getEndpoint().isEnded()) && (_started && (_recoveredMessage != null || !_messageConsumerList.isEmpty())))
- {
- Message msg;
-
- MessageConsumerImpl consumer;
-
- boolean recoveredMessage = _recoveredMessage != null;
- if(recoveredMessage)
- {
- consumer = _recoveredConsumer;
- msg = _recoveredMessage;
- _recoveredMessage = null;
- _recoveredConsumer = null;
- }
- else
- {
- consumer = _messageConsumerList.remove(0);
- msg = consumer.receiveRecoveredMessage();
- if(msg == null)
- {
- msg = consumer.receive0(0L);
- }
- else
- {
- recoveredMessage = true;
- }
- }
-
- MessageListener listener = consumer._messageListener;
-
- MessageImpl message = consumer.createJMSMessage(msg, recoveredMessage);
-
- if(message != null)
- {
- if(_acknowledgeMode == AcknowledgeMode.CLIENT_ACKNOWLEDGE)
- {
- consumer.setLastUnackedMessage(msg.getDeliveryTag());
- }
- _currentConsumer = consumer;
- _currentMessage = msg;
- try
- {
- listener.onMessage(message);
- }
- finally
- {
- _currentConsumer = null;
- _currentMessage = null;
- }
-
- if(_recoveredMessage == null)
- {
- consumer.preReceiveAction(msg);
- }
-
- }
-
- }
- Iterator<MessageConsumerImpl> consumers = _consumers.iterator();
- while(consumers.hasNext())
- {
- MessageConsumerImpl consumer = consumers.next();
- try
- {
- consumer.checkReceiverError();
- }
- catch (JMSException e)
- {
-
- consumers.remove();
- try
- {
- ExceptionListener expListener = _connection.getExceptionListener();
- if (expListener != null)
- expListener.onException(e);
- consumer.close();
- }
- catch (JMSException e1)
- {
- }
- }
- }
-
- }
- }
- }
-
- private Object getLock()
- {
- return _session.getEndpoint().getLock();
- }
-
- public void messageArrivedAtConsumer(MessageConsumerImpl impl)
- {
- synchronized (getLock())
- {
- _messageConsumerList.add(impl);
- getLock().notifyAll();
- }
- }
-
- public void close()
- {
- synchronized (getLock())
- {
- _closed = true;
- getLock().notifyAll();
- }
- }
-
- public void updateMessageListener(final MessageConsumerImpl messageConsumer)
- {
- synchronized (getLock())
- {
- getLock().notifyAll();
- }
- }
-
- public void start()
- {
- synchronized (getLock())
- {
- _started = true;
- getLock().notifyAll();
- }
- }
-
- public void stop()
- {
- synchronized (getLock())
- {
- _started = false;
- getLock().notifyAll();
- }
- }
-
- public void doRecover()
- {
- _recoveredConsumer = _currentConsumer;
- _recoveredMessage = _currentMessage;
- }
- }
-
- void setQueueSession(final boolean queueSession)
- {
- _isQueueSession = queueSession;
- }
-
- void setTopicSession(final boolean topicSession)
- {
- _isTopicSession = topicSession;
- }
-
- String toAddress(DestinationImpl dest)
- {
- return _connection.toDecodedDestination(dest).getAddress();
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java
deleted file mode 100644
index 76a614fbd2..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/StreamMessageImpl.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.jms.JMSException;
-import javax.jms.MessageEOFException;
-import javax.jms.MessageFormatException;
-
-import org.apache.qpid.amqp_1_0.jms.StreamMessage;
-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.AmqpValue;
-import org.apache.qpid.amqp_1_0.type.messaging.ApplicationProperties;
-import org.apache.qpid.amqp_1_0.type.messaging.DeliveryAnnotations;
-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.MessageAnnotations;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-public class StreamMessageImpl extends MessageImpl implements StreamMessage
-{
- private List _list;
- private boolean _readOnly;
- private int _position = -1;
- private int _offset = -1;
-
-
-
- protected StreamMessageImpl(Header header,
- DeliveryAnnotations deliveryAnnotations,
- MessageAnnotations messageAnnotations,
- Properties properties,
- ApplicationProperties appProperties,
- List list,
- Footer footer,
- SessionImpl session)
- {
- super(header, deliveryAnnotations, messageAnnotations, properties, appProperties, footer, session);
- _list = list;
- }
-
- StreamMessageImpl(final SessionImpl session)
- {
- super(new Header(), new DeliveryAnnotations(new HashMap()), new MessageAnnotations(new HashMap()), new Properties(),
- new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
- session);
- _list = new ArrayList();
- }
-
- public boolean readBoolean() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Boolean)
- {
- return (Boolean) obj;
- }
- if(obj instanceof String || obj == null)
- {
- return Boolean.valueOf((String)obj);
- }
- else
- {
- throw new MessageFormatException("Cannot read " + obj.getClass().getName() + " as boolean");
- }
- }
-
- @Override
- public void clearBody() throws JMSException
- {
- super.clearBody();
- _list.clear();
- _position = -1;
- _offset = -1;
- }
-
- public byte readByte() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Byte)
- {
- return (Byte) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Byte.valueOf((String)obj);
- }
- catch(RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- private void backup()
- {
- _position--;
- }
-
- public short readShort() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Short)
- {
- return (Short) obj;
- }
- else if(obj instanceof Byte)
- {
- return (Byte) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Short.valueOf((String)obj);
- }
- catch(RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
-
- }
-
- public char readChar() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Character)
- {
- return (Character) obj;
- }
- if(obj == null)
- {
- backup();
- throw new NullPointerException();
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot read " + obj.getClass().getName() + " as boolean");
- }
-
- }
-
- public int readInt() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Integer)
- {
- return (Integer) obj;
- }
- else if(obj instanceof Short)
- {
- return (Short) obj;
- }
- else if(obj instanceof Byte)
- {
- return (Byte) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Integer.valueOf((String)obj);
- }
- catch (RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- public long readLong() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Long)
- {
- return (Long) obj;
- }
- else if(obj instanceof Integer)
- {
- return (Integer) obj;
- }
- else if(obj instanceof Short)
- {
- return (Short) obj;
- }
- else if(obj instanceof Byte)
- {
- return (Byte) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Long.valueOf((String)obj);
- }
- catch (RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- public float readFloat() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Float)
- {
- return (Float) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Float.valueOf((String)obj);
- }
- catch (RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- public double readDouble() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Double)
- {
- return (Double) obj;
- }
- else if(obj instanceof Float)
- {
- return (Float) obj;
- }
- else if(obj instanceof String || obj == null)
- {
- try
- {
- return Double.valueOf((String)obj);
- }
- catch (RuntimeException e)
- {
- backup();
- throw e;
- }
- }
- else
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- }
-
- public String readString() throws JMSException
- {
- Object obj = readObject();
- if(obj instanceof Binary)
- {
- backup();
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- return String.valueOf(obj);
- }
-
- public int readBytes(final byte[] bytes) throws JMSException
- {
- Object obj = readObject();
- if(!(obj instanceof Binary))
- {
- backup();
- if(_position > -1 && _list.get(_position) instanceof Binary)
- {
- return -1;
- }
- throw new MessageFormatException("Cannot convert value of type " + obj.getClass().getName());
- }
- Binary binary = (Binary) obj;
- if(bytes.length >= binary.getLength())
- {
- System.arraycopy(binary.getArray(),binary.getArrayOffset(),bytes,0,binary.getLength());
- return binary.getLength();
- }
- return -1;
- }
-
- public Object readObject() throws JMSException
- {
- checkReadable();
- if(_offset == -1)
- {
- try
- {
- return _list.get(++_position);
- }
- catch (IndexOutOfBoundsException e)
- {
- throw new MessageEOFException("No more data in message stream");
- }
- }
- else
- {
- return null; //TODO
- }
- }
-
- public void writeBoolean(final boolean b) throws JMSException
- {
- checkWritable();
- _list.add(b);
- }
-
- public void writeByte(final byte b) throws JMSException
- {
- checkWritable();
- _list.add(b);
- }
-
- public void writeShort(final short i) throws JMSException
- {
- checkWritable();
- _list.add(i);
- }
-
- public void writeChar(final char c) throws JMSException
- {
- checkWritable();
- _list.add(c);
- }
-
- public void writeInt(final int i) throws JMSException
- {
- checkWritable();
- _list.add(i);
- }
-
- public void writeLong(final long l) throws JMSException
- {
- checkWritable();
- _list.add(l);
- }
-
- public void writeFloat(final float v) throws JMSException
- {
- checkWritable();
- _list.add(v);
- }
-
- public void writeDouble(final double v) throws JMSException
- {
- checkWritable();
- _list.add(v);
- }
-
- public void writeString(final String s) throws JMSException
- {
- checkWritable();
- _list.add(s);
- }
-
- public void writeBytes(final byte[] bytes) throws JMSException
- {
- checkWritable();
- writeBytes(bytes, 0, bytes.length);
- }
-
- public void writeBytes(final byte[] bytes, final int offset, final int size) throws JMSException
- {
- checkWritable();
-
- if(!_list.isEmpty() && _list.get(_list.size()-1) instanceof byte[])
- {
- Binary oldVal = (Binary) _list.get(_list.size()-1);
- byte[] allBytes = new byte[oldVal.getLength() + size];
- System.arraycopy(oldVal.getArray(),oldVal.getArrayOffset(),allBytes,0,oldVal.getLength());
- System.arraycopy(bytes, offset, allBytes, oldVal.getLength(), size);
- _list.set(_list.size()-1, allBytes);
- }
- else
- {
- byte[] dup = new byte[size];
- System.arraycopy(bytes,offset,dup,0,size);
- _list.add(new Binary(dup));
- }
- }
-
- public void writeObject(final Object o) throws JMSException
- {
- checkWritable();
- if(o == null || _supportedClasses.contains(o.getClass()))
- {
- _list.add(o);
- }
- }
-
- public void reset() throws JMSException
- {
- super.reset();
- _position = -1;
- _offset = -1;
- }
-
- @Override Collection<Section> getSections()
- {
- List<Section> sections = new ArrayList<Section>();
- sections.add(getHeader());
- if(getDeliveryAnnotations() != null && getDeliveryAnnotations().getValue() != null && !getDeliveryAnnotations().getValue().isEmpty())
- {
- sections.add(getDeliveryAnnotations());
- }
- if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
- {
- sections.add(getMessageAnnotations());
- }
- sections.add(getProperties());
- sections.add(getApplicationProperties());
- sections.add(new AmqpValue(_list));
- sections.add(getFooter());
- return sections;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java
deleted file mode 100644
index 45cd7525c0..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryQueueImpl.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.Sender;
-import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
-import org.apache.qpid.amqp_1_0.jms.TemporaryQueue;
-
-import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-public class TemporaryQueueImpl extends QueueImpl implements TemporaryQueue
-{
- private Sender _sender;
- private SessionImpl _session;
- private final Set<MessageConsumer> _consumers =
- Collections.synchronizedSet(new HashSet<MessageConsumer>());
- private boolean _deleted;
-
- protected TemporaryQueueImpl(String address, Sender sender, SessionImpl session)
- {
- super(address);
- _sender = sender;
- _session = session;
- _session.getConnection().addOnCloseTask(new ConnectionImpl.CloseTask()
- {
- public void onClose() throws JMSException
- {
- synchronized (TemporaryQueueImpl.this)
- {
- close();
- }
- }
- });
- }
-
- public synchronized void delete() throws JMSException
- {
- if(_consumers.isEmpty())
- {
- close();
- _deleted = true;
- }
- else
- {
- throw new IllegalStateException("Cannot delete destination as it has consumers");
- }
- }
-
- private void close() throws JMSException
- {
- if(_sender != null)
- {
- try
- {
- _sender.close();
- _sender = null;
- }
- catch (Sender.SenderClosingException e)
- {
- final JMSException jmsException = new JMSException(e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- }
-
- }
-
- public SessionImpl getSession()
- {
- return _session;
- }
-
- public void addConsumer(MessageConsumer consumer)
- {
- _consumers.add(consumer);
- }
-
- public void removeConsumer(MessageConsumer consumer)
- {
- _consumers.remove(consumer);
- }
-
- public boolean isDeleted()
- {
- return _deleted;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java
deleted file mode 100644
index b2587e41d4..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TemporaryTopicImpl.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.Sender;
-import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
-import org.apache.qpid.amqp_1_0.jms.TemporaryTopic;
-
-import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-public class TemporaryTopicImpl extends TopicImpl implements TemporaryTopic
-{
- private Sender _sender;
- private SessionImpl _session;
- private final Set<MessageConsumer> _consumers =
- Collections.synchronizedSet(new HashSet<MessageConsumer>());
- private boolean _deleted;
-
- protected TemporaryTopicImpl(String address, Sender sender, SessionImpl session)
- {
- super(address);
- _sender = sender;
- _session = session;
-
- _session.getConnection().addOnCloseTask(new ConnectionImpl.CloseTask()
- {
- public void onClose() throws JMSException
- {
- synchronized (TemporaryTopicImpl.this)
- {
- close();
- }
- }
- });
- }
-
- public void delete() throws JMSException
- {
- if(_consumers.isEmpty())
- {
- _deleted = true;
- close();
- }
- else
- {
- throw new IllegalStateException("Cannot delete destination as it has consumers");
- }
-
- }
-
-
- private void close() throws JMSException
- {
- if(_sender != null)
- {
- try
- {
-
- _sender.close();
- _sender = null;
- }
- catch (Sender.SenderClosingException e)
- {
- final JMSException jmsException = new JMSException(e.getMessage());
- jmsException.setLinkedException(e);
- throw jmsException;
- }
- }
-
- }
-
- public SessionImpl getSession()
- {
- return _session;
- }
-
-
- public void addConsumer(MessageConsumer consumer)
- {
- _consumers.add(consumer);
- }
-
- public void removeConsumer(MessageConsumer consumer)
- {
- _consumers.remove(consumer);
- }
-
- public boolean isDeleted()
- {
- return _deleted;
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java
deleted file mode 100644
index 6d061083fd..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TextMessageImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.jms.JMSException;
-import javax.jms.MessageNotWriteableException;
-
-import org.apache.qpid.amqp_1_0.jms.TextMessage;
-import org.apache.qpid.amqp_1_0.type.Section;
-import org.apache.qpid.amqp_1_0.type.messaging.AmqpValue;
-import org.apache.qpid.amqp_1_0.type.messaging.ApplicationProperties;
-import org.apache.qpid.amqp_1_0.type.messaging.DeliveryAnnotations;
-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.MessageAnnotations;
-import org.apache.qpid.amqp_1_0.type.messaging.Properties;
-
-public class TextMessageImpl extends MessageImpl implements TextMessage
-{
- private String _text;
-
- protected TextMessageImpl(Header header,
- DeliveryAnnotations deliveryAnnotations,
- MessageAnnotations messageAnnotations,
- Properties properties,
- ApplicationProperties appProperties,
- String text,
- Footer footer,
- SessionImpl session)
- {
- super(header, deliveryAnnotations, messageAnnotations, properties, appProperties, footer, session);
- _text = text;
- }
-
- protected TextMessageImpl(final SessionImpl session)
- {
- super(new Header(), new DeliveryAnnotations(new HashMap()), new MessageAnnotations(new HashMap()),
- new Properties(), new ApplicationProperties(new HashMap()), new Footer(Collections.EMPTY_MAP),
- session);
- }
-
- public void setText(final String text) throws MessageNotWriteableException
- {
- if(isReadOnly())
- {
- throw new MessageNotWriteableException("Cannot set object, message is in read only mode");
- }
-
- _text = text;
- }
-
- public String getText() throws JMSException
- {
- return _text;
- }
-
- @Override
- public void clearBody() throws JMSException
- {
- super.clearBody();
- _text = null;
- }
-
- @Override Collection<Section> getSections()
- {
- List<Section> sections = new ArrayList<Section>();
- sections.add(getHeader());
- if(getDeliveryAnnotations() != null && getDeliveryAnnotations().getValue() != null && !getDeliveryAnnotations().getValue().isEmpty())
- {
- sections.add(getDeliveryAnnotations());
- }
- if(getMessageAnnotations() != null && getMessageAnnotations().getValue() != null && !getMessageAnnotations().getValue().isEmpty())
- {
- sections.add(getMessageAnnotations());
- }
- sections.add(getProperties());
- sections.add(getApplicationProperties());
- AmqpValue section = new AmqpValue(_text);
- sections.add(section);
- sections.add(getFooter());
- return sections;
- }
-
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java
deleted file mode 100644
index 8fe92dd801..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicConnectionImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.TopicConnection;
-
-import javax.jms.ConnectionConsumer;
-import javax.jms.JMSException;
-import javax.jms.ServerSessionPool;
-import javax.jms.Topic;
-
-public class TopicConnectionImpl extends ConnectionImpl implements TopicConnection
-{
- TopicConnectionImpl(String host, int port, String username, String password, String clientId)
- throws JMSException
- {
- super(host, port, username, password, clientId);
- }
-
- public TopicSessionImpl createTopicSession(final boolean b, final int i) throws JMSException
- {
- return null; //TODO
- }
-
- public ConnectionConsumer createConnectionConsumer(final Topic topic,
- final String s,
- final ServerSessionPool serverSessionPool,
- final int i) throws JMSException
- {
- return null; //TODO
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java
deleted file mode 100644
index edc583e233..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.Topic;
-
-import java.util.UUID;
-import java.util.WeakHashMap;
-
-public class TopicImpl extends DestinationImpl implements Topic
-{
- private static final WeakHashMap<String, TopicImpl> TOPIC_CACHE =
- new WeakHashMap<String, TopicImpl>();
-
-
- public TopicImpl(String address)
- {
- super(address);
- }
-
- public String getTopicName()
- {
- return getAddress();
- }
-
- public static synchronized TopicImpl createTopic(String address)
- {
- TopicImpl topic;
- if (address.endsWith("!!"))
- {
- address = address.substring(0, address.length() - 2);
- String localTerminusName = UUID.randomUUID().toString();
- topic = new TopicImpl(address);
- topic.setLocalTerminus(localTerminusName);
- }
- else
- {
- topic = TOPIC_CACHE.get(address);
- if(topic == null)
- {
- topic = new TopicImpl(address);
- TOPIC_CACHE.put(address, topic);
- }
- }
- return topic;
- }
-
- public static TopicImpl valueOf(String address)
- {
- return address == null ? null : createTopic(address);
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java
deleted file mode 100644
index 62c3783682..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicPublisherImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.TopicPublisher;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Topic;
-
-public class TopicPublisherImpl extends MessageProducerImpl implements TopicPublisher
-{
- protected TopicPublisherImpl(final Destination destination, final SessionImpl session)
- throws JMSException
- {
- super(destination, session);
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java
deleted file mode 100644
index 44d0c7f78f..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSessionImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.TopicSession;
-
-import javax.jms.JMSException;
-import javax.jms.Topic;
-
-public class TopicSessionImpl extends SessionImpl implements TopicSession
-{
- protected TopicSessionImpl(final ConnectionImpl connection, final AcknowledgeMode acknowledgeMode)
- throws JMSException
- {
- super(connection, acknowledgeMode);
- setTopicSession(true);
- }
-
- public TopicSubscriberImpl createSubscriber(final Topic topic) throws JMSException
- {
- return createSubscriber(topic,null, false);
- }
-
- public TopicSubscriberImpl createSubscriber(final Topic topic, final String selector, final boolean noLocal) throws JMSException
- {
-
- final TopicSubscriberImpl messageConsumer;
- synchronized(getClientSession().getEndpoint().getLock())
- {
- messageConsumer = new TopicSubscriberImpl((TopicImpl) topic, this, selector, noLocal);
- addConsumer(messageConsumer);
- }
- return messageConsumer;
- }
-
- public TopicPublisherImpl createPublisher(final Topic topic) throws JMSException
- {
- return null; //TODO
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java
deleted file mode 100644
index 4b53cfa795..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/TopicSubscriberImpl.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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 java.util.Map;
-import java.util.UUID;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import org.apache.qpid.amqp_1_0.client.AcknowledgeMode;
-import org.apache.qpid.amqp_1_0.client.ConnectionErrorException;
-import org.apache.qpid.amqp_1_0.client.Receiver;
-import org.apache.qpid.amqp_1_0.jms.Topic;
-import org.apache.qpid.amqp_1_0.jms.TopicSubscriber;
-import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.messaging.Filter;
-import org.apache.qpid.amqp_1_0.type.messaging.StdDistMode;
-import org.apache.qpid.amqp_1_0.type.transport.AmqpError;
-
-public class TopicSubscriberImpl extends MessageConsumerImpl implements TopicSubscriber
-{
-
- TopicSubscriberImpl(String name,
- boolean durable,
- final Topic destination,
- final SessionImpl session,
- final String selector,
- final boolean noLocal)
- throws JMSException
- {
- super(destination, session, selector, noLocal, name, durable);
- setTopicSubscriber(true);
- }
-
- TopicSubscriberImpl(final Topic destination,
- final SessionImpl session,
- final String selector,
- final boolean noLocal)
- throws JMSException
- {
- super(destination, session, selector, noLocal);
- setTopicSubscriber(true);
- }
-
- public TopicImpl getTopic() throws JMSException
- {
- return (TopicImpl) getDestination();
- }
-
-
- protected Receiver createClientReceiver() throws JMSException
- {
- try
- {
- String address = getSession().toAddress(getDestination());
- String targetAddress = getDestination().getLocalTerminus() != null ? getDestination().getLocalTerminus() : UUID.randomUUID().toString();
-
- Receiver receiver = getSession().getClientSession().createReceiver(address, targetAddress,
- StdDistMode.COPY, AcknowledgeMode.ALO,
- getLinkName(), isDurable(), getFilters(),
- null);
- String actualAddress = receiver.getAddress();
-
- @SuppressWarnings("unchecked")
- Map<Symbol, Filter> actualFilters = (Map<Symbol, Filter>) receiver.getFilter();
-
- if(!address.equals(actualAddress) || !filtersEqual(getFilters(), actualFilters))
- {
- receiver.close();
- if(isDurable())
- {
- receiver = getSession().getClientSession().createReceiver(address,
- StdDistMode.COPY, AcknowledgeMode.ALO,
- getLinkName(), false, getFilters(),
- null);
- receiver.close();
- }
- receiver = getSession().getClientSession().createReceiver(address,
- StdDistMode.COPY, AcknowledgeMode.ALO,
- getLinkName(), isDurable(), getFilters(),
- null);
- }
-
-
- return receiver;
- }
- catch (ConnectionErrorException e)
- {
- org.apache.qpid.amqp_1_0.type.transport.Error error = e.getRemoteError();
- if(AmqpError.INVALID_FIELD.equals(error.getCondition()))
- {
- throw new InvalidSelectorException(e.getMessage());
- }
- else
- {
- throw new JMSException(e.getMessage(), error.getCondition().getValue().toString());
-
- }
-
- }
- }
-
- private boolean filtersEqual(Map<Symbol, Filter> filters, Map<Symbol, Filter> actualFilters)
- {
- if(filters == null || filters.isEmpty())
- {
- return actualFilters == null || actualFilters.isEmpty();
- }
- else
- {
- return actualFilters != null && filters.equals(actualFilters);
- }
-
- }
-
-
- protected void closeUnderlyingReceiver(Receiver receiver)
- {
- if(isDurable())
- {
- receiver.detach();
- }
- else
- {
- receiver.close();
- }
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/AnnotationDecoder.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/AnnotationDecoder.java
deleted file mode 100644
index 4fa7a0940b..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/AnnotationDecoder.java
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- *
- * 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.util;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.qpid.amqp_1_0.codec.DescribedType;
-import org.apache.qpid.amqp_1_0.type.Binary;
-import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.UnsignedByte;
-import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-import org.apache.qpid.amqp_1_0.type.UnsignedLong;
-import org.apache.qpid.amqp_1_0.type.UnsignedShort;
-
-public class AnnotationDecoder
-{
- private static final Map<String,Converter> CONVERTERS = new HashMap<>();
-
-
- private final JsonDecoder _decoder = new JsonDecoder();
-
- public Map<Symbol,Object> decode(String value) throws IOException
- {
- Map<String,Object> map = (Map<String,Object>) _decoder.decode(new StringReader(value));
- Map<Symbol,Object> convertedMap = new LinkedHashMap<>();
- for(Map.Entry<String,Object> entry : map.entrySet())
- {
- convertedMap.put(Symbol.valueOf(entry.getKey()), convertObject(entry.getValue()));
- }
- return convertedMap;
- }
-
- private Object convertObject(final Object value)
- {
- if(value == null || value instanceof String || value instanceof Boolean)
- {
- return value;
- }
- else if(value instanceof Number)
- {
- return ((Number)value).intValue();
- }
- else if(value instanceof Collection)
- {
- Collection<?> list = (Collection<?>)value;
- List<Object> convertedList = new ArrayList<>(list.size());
- for(Object o : list)
- {
- convertedList.add(convertObject(o));
- }
- return convertedList;
- }
- else if(value instanceof Map)
- {
- Map<String,Object> map = (Map<String,Object>)value;
- if(map.size() != 1)
- {
- throw new IllegalArgumentException("Cannot parse map " + map + " as a value");
- }
- Converter converter = CONVERTERS.get(map.keySet().iterator().next());
- return converter.convert(map.values().iterator().next(), this);
- }
- return null;
- }
-
- private static abstract class Converter
- {
- Converter(String name)
- {
- CONVERTERS.put(name, this);
- }
-
- abstract Object convert(Object value, final AnnotationDecoder decoder);
- }
-
- private static Converter LONG_CONVERTER = new Converter("long")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- return ((Number)value).longValue();
- }
- };
-
- private static Converter SHORT_CONVERTER = new Converter("short")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- return ((Number)value).shortValue();
- }
- };
-
- private static Converter BYTE_CONVERTER = new Converter("byte")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- return ((Number)value).byteValue();
- }
- };
-
- private static Converter ULONG_CONVERTER = new Converter("ulong")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- Number number = (Number) value;
- return UnsignedLong.valueOf(number.toString());
- }
- };
-
- private static Converter UINT_CONVERTER = new Converter("uint")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- return UnsignedInteger.valueOf(((Number) value).longValue());
- }
- };
-
- private static Converter USHORT_CONVERTER = new Converter("ushort")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- Number number = (Number) value;
- return UnsignedShort.valueOf(number.toString());
- }
- };
-
- private static Converter UBYTE_CONVERTER = new Converter("ubyte")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- Number number = (Number) value;
-
- return UnsignedByte.valueOf(value.toString());
- }
- };
-
- private static Converter FLOAT_CONVERTER = new Converter("float")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- return ((Number) value).floatValue();
- }
- };
-
- private static Converter DOUBLE_CONVERTER = new Converter("double")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- return ((Number) value).doubleValue();
- }
- };
-
-
- private static Converter SYMBOL_CONVERTER = new Converter("symbol")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- return Symbol.valueOf((String) value);
- }
- };
-
-
- private static Converter CHAR_CONVERTER = new Converter("char")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- String stringValue = (String) value;
- if(stringValue.length() != 1)
- {
- throw new IllegalArgumentException("Cannot decode '"+stringValue+"' as a char");
- }
- return stringValue.charAt(0);
- }
- };
-
-
- private static Converter TIMESTAMP_CONVERTER = new Converter("timestamp")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- return new Date(((Number) value).longValue());
- }
- };
-
-
- private static Converter MAP_CONVERTER = new Converter("map")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- Map<?,?> map = (Map<?,?>) value;
- Map<Object,Object> convertedMap = new LinkedHashMap<>();
- for(Map.Entry<?,?> entry : map.entrySet())
- {
- convertedMap.put(decoder.convertObject(entry.getKey()), decoder.convertObject(entry.getValue()));
- }
- return convertedMap;
- }
- };
-
-
- private static Converter DESCRIBED_CONVERTER = new Converter("described")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- Map<?,?> map = (Map<?,?>) value;
- if(map.size() != 1)
- {
- throw new IllegalArgumentException("Cannot convert described type from: " + map);
- }
- Object descriptor = decoder.convertObject(map.keySet().iterator().next());
- Object described = decoder.convertObject(map.values().iterator().next());
- return new DescribedType(descriptor, described);
- }
- };
-
- private static Converter BINARY_CONVERTER = new Converter("binary")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- String valueString = (String)value;
- byte[] bytes = DatatypeConverter.parseBase64Binary(valueString);
- return new Binary(bytes);
- }
- };
-
- private static Converter ARRAY_CONVERTER = new Converter("array")
- {
- @Override
- Object convert(final Object value, final AnnotationDecoder decoder)
- {
- Collection<?> list = (Collection<?>)value;
- List<Object> convertedList = new ArrayList<>(list.size());
- Set<Class> objClasses = new HashSet<>();
- for(Object o : list)
- {
- Object convertObject = decoder.convertObject(o);
- objClasses.add(convertObject == null ? Void.class : convertObject.getClass());
- convertedList.add(convertObject);
- }
- if(objClasses.size() != 1)
- {
- throw new IllegalArgumentException("Cannot convert object to an array: " + value);
- }
- Class objClass = objClasses.iterator().next();
- if(objClass == Void.class)
- {
- return new Void[convertedList.size()];
- }
- else if(objClass == Boolean.class)
- {
- boolean[] array = new boolean[convertedList.size()];
- for(int i = 0; i < convertedList.size(); i++)
- {
- array[i] = (Boolean) convertedList.get(i);
- }
- return array;
- }
- else if(objClass == Byte.class)
- {
- byte[] array = new byte[convertedList.size()];
- for(int i = 0; i < convertedList.size(); i++)
- {
- array[i] = (Byte) convertedList.get(i);
- }
- return array;
- }
- else if(objClass == Character.class)
- {
- char[] array = new char[convertedList.size()];
- for(int i = 0; i < convertedList.size(); i++)
- {
- array[i] = (Character) convertedList.get(i);
- }
- return array;
- }
- else if(objClass == Short.class)
- {
- short[] array = new short[convertedList.size()];
- for(int i = 0; i < convertedList.size(); i++)
- {
- array[i] = (Short) convertedList.get(i);
- }
- return array;
- }
- else if(objClass == Integer.class)
- {
- int[] array = new int[convertedList.size()];
- for(int i = 0; i < convertedList.size(); i++)
- {
- array[i] = (Integer) convertedList.get(i);
- }
- return array;
- }
- else if(objClass == Long.class)
- {
- long[] array = new long[convertedList.size()];
- for(int i = 0; i < convertedList.size(); i++)
- {
- array[i] = (Long) convertedList.get(i);
- }
- return array;
- }
- else if(objClass == Float.class)
- {
- float[] array = new float[convertedList.size()];
- for(int i = 0; i < convertedList.size(); i++)
- {
- array[i] = (Float) convertedList.get(i);
- }
- return array;
- }
- else if(objClass == Double.class)
- {
- double[] array = new double[convertedList.size()];
- for(int i = 0; i < convertedList.size(); i++)
- {
- array[i] = (Double) convertedList.get(i);
- }
- return array;
- }
- else
- {
- return convertedList.toArray((Object[])Array.newInstance(objClass, convertedList.size()));
- }
- }
- };
-
-
- public static void main(String[] args) throws Exception
- {
- Map<Symbol, Object> foo = new LinkedHashMap<>();
- foo.put(Symbol.valueOf("ARG_1"), 2);
- foo.put(Symbol.valueOf("ARG_2"), true);
- foo.put(Symbol.valueOf("ARG_3"), "wibble");
- foo.put(Symbol.valueOf("ARG_4"), Arrays.asList("this", "is", "a", "test"));
- foo.put(Symbol.valueOf("ARG_5"), Arrays.asList((Object)"this", 2l, Symbol.valueOf("a"), "test"));
- foo.put(Symbol.valueOf("ARG_6"), Collections.singletonMap("wibble",0.3));
-
-
-
- String encoded = new AnnotationEncoder().encode(foo);
- System.err.println(encoded);
- Object foo2 = new AnnotationDecoder().decode(encoded);
-
- System.out.println(foo2.equals(foo));
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/AnnotationEncoder.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/AnnotationEncoder.java
deleted file mode 100644
index d8b90320e9..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/AnnotationEncoder.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *
- * 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.util;
-
-import java.io.IOException;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.qpid.amqp_1_0.codec.DescribedType;
-import org.apache.qpid.amqp_1_0.type.Binary;
-import org.apache.qpid.amqp_1_0.type.Symbol;
-import org.apache.qpid.amqp_1_0.type.UnsignedByte;
-import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-import org.apache.qpid.amqp_1_0.type.UnsignedLong;
-import org.apache.qpid.amqp_1_0.type.UnsignedShort;
-
-public class AnnotationEncoder
-{
- private final JsonEncoder _encoder = new JsonEncoder();
-
- public String encode(Map<Symbol,Object> annotations) throws IOException
- {
- Map<String,Object> convertedMap = convertMap(annotations);
- return _encoder.encode(convertedMap);
- }
-
-
- private Map<String, Object> convertMap(final Map<Symbol,Object> value)
- {
- Map<String,Object> converted = new LinkedHashMap<>();
- for(Map.Entry<Symbol,Object> entry : value.entrySet())
- {
- converted.put(entry.getKey().toString(), convert(entry.getValue()));
- }
- return converted;
- }
-
- private Object convert(final Object value)
- {
- if(value == null || value instanceof String || value instanceof Boolean || value instanceof Integer)
- {
- return value;
- }
- else if(value instanceof Long)
- {
- return Collections.singletonMap("long", value);
- }
- else if(value instanceof Short)
- {
- return Collections.singletonMap("short", value);
- }
- else if(value instanceof Byte)
- {
- return Collections.singletonMap("byte", value);
- }
- else if(value instanceof UnsignedLong)
- {
- return Collections.singletonMap("ulong", ((UnsignedLong)value).bigIntegerValue());
- }
- else if(value instanceof UnsignedInteger)
- {
- return Collections.singletonMap("uint", ((UnsignedInteger)value).longValue());
- }
- else if(value instanceof UnsignedShort)
- {
- return Collections.singletonMap("ushort", ((UnsignedShort)value).intValue());
- }
- else if(value instanceof UnsignedByte)
- {
- return Collections.singletonMap("ubyte", ((UnsignedByte)value).shortValue());
- }
- else if(value instanceof Character)
- {
- return Collections.singletonMap("char", value.toString());
- }
- else if(value instanceof Symbol)
- {
- return Collections.singletonMap("symbol", value.toString());
- }
- else if(value instanceof Date)
- {
- return Collections.singletonMap("timestamp", ((Date)value).getTime());
- }
- else if(value instanceof Float)
- {
- return Collections.singletonMap("float", value);
- }
- else if(value instanceof Double)
- {
- return Collections.singletonMap("double", value);
- }
- else if(value instanceof Binary)
- {
- Binary bin = (Binary) value;
- byte[] bytes;
- if(bin.getArrayOffset() != 0 || bin.getLength() != bin.getArray().length)
- {
- bytes = new byte[bin.getLength()];
- System.arraycopy(bin.getArray(), bin.getArrayOffset(),bytes, 0, bin.getLength());
- }
- else
- {
- bytes = bin.getArray();
- }
- return Collections.singletonMap("binary", DatatypeConverter.printBase64Binary(bytes));
- }
- else if(value instanceof List)
- {
- List<?> list = (List) value;
- List<Object> convertedList = new ArrayList<>(list.size());
- for(Object o : list)
- {
- convertedList.add(convert(o));
- }
- return convertedList;
- }
- else if(value instanceof Map)
- {
- Map<?,?> map = (Map<?,?>) value;
- Map<Object,Object> convertedMap = new LinkedHashMap<>();
- for(Map.Entry<?,?> entry : map.entrySet())
- {
- convertedMap.put(convert(entry.getKey()), convert(entry.getValue()));
- }
- return Collections.singletonMap("map", convertedMap);
- }
- else if(value instanceof Object[])
- {
- return Collections.singletonMap("array", convert(Arrays.asList((Object[])value)));
- }
- else if(value.getClass().isArray())
- {
- int length = Array.getLength(value);
- List<Object> list = new ArrayList<>(length);
- for(int i = 0; i < length; i++)
- {
- list.add(Array.get(value, i));
- }
- return Collections.singletonMap("array", convert(list));
- }
- else if(value instanceof DescribedType)
- {
- DescribedType type = (DescribedType) value;
- return Collections.singletonMap("described", Collections.singletonMap(convert(type.getDescriptor()),
- convert(type.getDescribed())));
- }
- throw new IllegalArgumentException("Cannot convert object of class: " + value.getClass().getName());
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/JsonDecoder.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/JsonDecoder.java
deleted file mode 100644
index 2760492ca8..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/JsonDecoder.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- *
- * 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.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-
-public class JsonDecoder
-{
- static enum TokenType
- {
- BEGIN_MAP,
- END_MAP,
- BEGIN_ARRAY,
- END_ARRAY,
- COMMA,
- COLON,
- STRING,
- BOOLEAN,
- NUMBER,
- NULL
- }
-
- static private class Token
- {
- private final TokenType _type;
- private final Object _value;
-
-
- private Token(final TokenType type, final Object value)
- {
- _type = type;
- _value = value;
- }
-
- public TokenType getType()
- {
- return _type;
- }
-
- public Object getValue()
- {
- return _value;
- }
- }
-
- public Object decode(Reader reader) throws IOException
- {
- if(!reader.markSupported())
- {
- return decode(new BufferedReader(reader));
- }
- else
- {
- return readValue(reader, new Stack<Token>());
- }
- }
-
- private Object readValue(final Reader reader, final Stack<Token> tokenStack) throws IOException
- {
- Token token = readToken(reader, tokenStack);
- switch(token.getType())
- {
- case BOOLEAN:
- case NUMBER:
- case STRING:
- case NULL:
- return token.getValue();
- case BEGIN_MAP:
- Map<Object,Object> map = new LinkedHashMap<>();
- token = readToken(reader, tokenStack);
- if(token.getType() != TokenType.END_MAP)
- {
- tokenStack.push(token);
- do
- {
- Object key = readValue(reader, tokenStack);
- token = readToken(reader, tokenStack);
- if(token.getType() != TokenType.COLON)
- {
- throw new IllegalArgumentException("Cannot parse Json string");
- }
- Object value = readValue(reader, tokenStack);
- map.put(key, value);
- token = readToken(reader, tokenStack);
- if(!(token.getType() == TokenType.END_MAP
- || token.getType() == TokenType.COMMA))
- {
- throw new IllegalArgumentException("Cannot parse Json string");
- }
- }
- while(token.getType() != TokenType.END_MAP);
-
- }
- return map;
- case BEGIN_ARRAY:
- List<Object> list = new ArrayList<>();
- token = readToken(reader, tokenStack);
- if(token.getType() != TokenType.END_MAP)
- {
- tokenStack.push(token);
- do
- {
- Object element = readValue(reader, tokenStack);
- list.add(element);
- token = readToken(reader, tokenStack);
- if(!(token.getType() == TokenType.END_ARRAY
- || token.getType() == TokenType.COMMA))
- {
- throw new IllegalArgumentException("Cannot parse Json string");
- }
- }
- while(token.getType() != TokenType.END_ARRAY);
-
- }
-
- return list;
- default:
- throw new IllegalArgumentException("Could not parse Json String");
-
- }
- }
-
- static final Map<Character, Token> PUNCTUATION_TOKENS;
- static
- {
- final Map<Character, Token> tokenMap = new HashMap<>();
- tokenMap.put('{', new Token(TokenType.BEGIN_MAP, null));
- tokenMap.put('}', new Token(TokenType.END_MAP, null));
- tokenMap.put('[', new Token(TokenType.BEGIN_ARRAY, null));
- tokenMap.put(']', new Token(TokenType.END_ARRAY, null));
- tokenMap.put(':', new Token(TokenType.COLON, null));
- tokenMap.put(',', new Token(TokenType.COMMA, null));
- PUNCTUATION_TOKENS = Collections.unmodifiableMap(tokenMap);
- }
-
- private Token readToken(final Reader reader, final Stack<Token> tokenStack) throws IOException
- {
- if(!tokenStack.isEmpty())
- {
- return tokenStack.pop();
- }
- ignoreWhitespace(reader);
-
-
- char[] cb = new char[1];
- reader.mark(2);
- if(reader.read(cb) == 1)
- {
- final char c = cb[0];
- Token token = PUNCTUATION_TOKENS.get(c);
- if(token != null)
- {
- return token;
- }
- if(c == '"')
- {
- reader.reset();
- return readString(reader);
- }
- else if(c == '-' || (c >= '0' && c <= '9'))
- {
- reader.reset();
- return readNumber(reader);
- }
- else if(c == 't')
- {
- reader.reset();
- readLiteral(reader, "true");
- return new Token(TokenType.BOOLEAN, true);
- }
- else if(c == 'f')
- {
- reader.reset();
- readLiteral(reader, "false");
- return new Token(TokenType.BOOLEAN, false);
- }
- else if(c == 'n')
- {
- reader.reset();
- readLiteral(reader, "null");
- return new Token(TokenType.NULL, null);
- }
- else
- {
- throw new IllegalArgumentException("Could not parse json string");
- }
- }
- else
- {
- throw new IllegalArgumentException("Insufficient data");
- }
-
- }
-
- private Token readNumber(final Reader reader) throws IOException
- {
- StringBuilder buffer = new StringBuilder();
- reader.mark(1);
- char[] cb = new char[1];
- int read;
- while((read = reader.read(cb)) == 1 && (Character.isDigit(cb[0]) || cb[0] == '-' || Character.isAlphabetic(cb[0]) || cb[0] == '.'))
- {
- buffer.append(cb[0]);
- reader.mark(1);
- }
- if(read == 1)
- {
- reader.reset();
- }
-
- // todo - here
- String numberString = buffer.toString();
- if(!numberString.matches("-?\\d+(\\.\\d+)?([eE][+\\-]?\\d+)?"))
- {
- throw new IllegalArgumentException("Cannot parse number from " + numberString);
- }
- BigDecimal number = new BigDecimal(numberString.toUpperCase());
- try
- {
- // TODO - doesn't cope with unsigned longs > Long.MAX_VALUE
- BigInteger bigInteger = number.toBigIntegerExact();
- if(bigInteger.longValue() > Integer.MAX_VALUE
- || bigInteger.longValue() < Integer.MIN_VALUE)
- {
- return new Token(TokenType.NUMBER, bigInteger.longValue());
- }
- else
- {
- return new Token(TokenType.NUMBER, bigInteger.intValue());
- }
- }
- catch(ArithmeticException e)
- {
- return new Token(TokenType.NUMBER, number.doubleValue());
- }
- }
-
- private Token readString(final Reader reader) throws IOException
- {
- StringBuilder builder = new StringBuilder();
- // ignore starting quote
- reader.read();
-
-
- do
- {
- char c = readChar(reader);
- if(c == '\\')
- {
- c = readChar(reader);
- if(c == '\\' || c == '/' || c == '"')
- {
- builder.append(c);
- }
- else if(c == 't')
- {
- builder.append('\t');
- }
- else if(c == 'n')
- {
- builder.append('\n');
- }
- else if(c == 'r')
- {
- builder.append('\r');
- }
- else if(c == 'f')
- {
- builder.append('\f');
- }
- else if(c == 'b')
- {
- builder.append('\b');
- }
- else if(c == 'u')
- {
- char[] point = new char[4];
- if(reader.read(point) != 4)
- {
- throw new IllegalArgumentException("Insufficient data");
- }
- char codePoint = (char)(Integer.parseInt((new String(point)).toUpperCase(), 16) & 0xffff);
- builder.append(codePoint);
- }
- else
- {
- throw new IllegalArgumentException("Invalid escaped character");
- }
- }
- else if(c == '"')
- {
- break;
- }
- else
- {
- builder.append(c);
- }
- }
- while(true);
-
-
- return new Token(TokenType.STRING, builder.toString());
- }
-
- private char readChar(final Reader reader) throws IOException
- {
- char[] cb = new char[1];
- if(reader.read(cb) != 1)
- {
- throw new IllegalArgumentException("Insufficient data");
- }
- return cb[0];
- }
-
-
- private void readLiteral(final Reader reader, CharSequence expected) throws IOException
- {
- char[] cbuf = new char[expected.length()];
- int read = reader.read(cbuf);
- if(read != expected.length())
- {
- throw new IllegalArgumentException("Could not parse literal");
- }
- for(int i = 0; i < expected.length(); i++)
- {
- if(cbuf[i] != expected.charAt(i))
- {
- throw new IllegalArgumentException("Could not parse literal");
- }
- }
- }
-
- private void ignoreWhitespace(Reader reader) throws IOException
- {
- char[] cb = new char[1];
- reader.mark(1);
- while(reader.read(cb) == 1)
- {
- if(!Character.isWhitespace(cb[0]))
- {
- reader.reset();
- break;
- }
- else
- {
- reader.mark(1);
- }
- }
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/JsonEncoder.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/JsonEncoder.java
deleted file mode 100644
index 7d9a066b24..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/util/JsonEncoder.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *
- * 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.util;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Map;
-
-public class JsonEncoder
-{
- public void encode(Object object, Writer writer) throws IOException
- {
- if(object == null)
- {
- writer.append("null");
- }
- else if(object instanceof Boolean)
- {
- writer.append(((Boolean)object)? "true" : "false");
- }
- else if(object instanceof Number)
- {
- writer.append(object.toString());
- }
- else if(object instanceof Object[])
- {
- writer.append("[ ");
- boolean first = true;
- for(Object element : ((Object[])object))
- {
- if(first)
- {
- first = false;
- }
- else
- {
- writer.append(',');
- }
- encode(element, writer);
- writer.append(" ]");
- }
- }
- else if(object instanceof Iterable)
- {
- writer.append("[ ");
- boolean first = true;
- for(Object element : ((Iterable)object))
- {
- if(first)
- {
- first = false;
- }
- else
- {
- writer.append(", ");
- }
- encode(element, writer);
- }
- writer.append(" ]");
- }
- else if(object instanceof Map)
- {
- writer.append("{ ");
- boolean first = true;
- for(Map.Entry element : ((Map<?,?>)object).entrySet())
- {
- if(first)
- {
- first = false;
- }
- else
- {
- writer.append(", ");
- }
- encode(element.getKey(), writer);
- writer.append(" : ");
- encode(element.getValue(), writer);
- }
- writer.append(" }");
- }
- else if(object instanceof CharSequence)
- {
- CharSequence string = (CharSequence)object;
- writer.append('"');
- for(int i = 0; i < string.length(); i++)
- {
- char c = string.charAt(i);
- if(c == '"' || c=='\\')
- {
- writer.append('\\');
- }
- writer.append(c);
- }
- writer.append('"');
- }
- else
- {
- throw new IllegalArgumentException("Don't know how to encode class " + object.getClass().getName());
- }
- }
-
- public String encode(Object object) throws IOException
- {
- StringWriter writer = new StringWriter();
- encode(object, writer);
- return writer.toString();
- }
-
-
- public static void main(String[] args) throws Exception
- {
- JsonEncoder encoder = new JsonEncoder();
- String encoded =
- encoder.encode(Collections.singletonMap("hello \\\" world", Arrays.asList(3, 7.2, false, null, 4)));
- Object decoded = new JsonDecoder().decode(new StringReader(encoded));
- System.err.println(encoded);
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/NameParserImpl.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/NameParserImpl.java
deleted file mode 100644
index d2a741d96c..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/NameParserImpl.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * 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.jndi;
-
-import javax.naming.CompositeName;
-import javax.naming.Name;
-import javax.naming.NameParser;
-import javax.naming.NamingException;
-
-/**
- * A default implementation of {@link NameParser}
- * <p>
- * Based on class from ActiveMQ.
- */
-public class NameParserImpl implements NameParser
-{
- public Name parse(String name) throws NamingException
- {
- return new CompositeName(name);
- }
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/PropertiesFileInitialContextFactory.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/PropertiesFileInitialContextFactory.java
deleted file mode 100644
index 39a6b152a2..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/PropertiesFileInitialContextFactory.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- *
- * 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.jndi;
-
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.Queue;
-import javax.jms.Topic;
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
-
-import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
-import org.apache.qpid.amqp_1_0.jms.impl.DestinationImpl;
-import org.apache.qpid.amqp_1_0.jms.impl.QueueImpl;
-import org.apache.qpid.amqp_1_0.jms.impl.TopicImpl;
-
-
-public class PropertiesFileInitialContextFactory implements InitialContextFactory
-{
-
- private String CONNECTION_FACTORY_PREFIX = "connectionfactory.";
- private String DESTINATION_PREFIX = "destination.";
- private String QUEUE_PREFIX = "queue.";
- private String TOPIC_PREFIX = "topic.";
-
- public Context getInitialContext(Hashtable environment) throws NamingException
- {
- Map data = new ConcurrentHashMap();
-
- String file = null;
-
- try
- {
-
-
- if (environment.containsKey(Context.PROVIDER_URL))
- {
- file = (String) environment.get(Context.PROVIDER_URL);
- }
- else
- {
- file = System.getProperty(Context.PROVIDER_URL);
- }
-
- if (file != null)
- {
-
- // Load the properties specified
- BufferedInputStream inputStream;
-
- try
- {
- URL fileURL = new URL(file);
- inputStream = new BufferedInputStream(fileURL.openStream());
- }
- catch(MalformedURLException e)
- {
- inputStream = new BufferedInputStream(new FileInputStream(file));
- }
-
- Properties p = new Properties();
- try
- {
- p.load(inputStream);
- }
- finally
- {
- inputStream.close();
- }
-
- for (Map.Entry me : p.entrySet())
- {
- String key = (String) me.getKey();
- String value = (String) me.getValue();
- environment.put(key, value);
- if (System.getProperty(key) == null)
- {
- System.setProperty(key, value);
- }
- }
- }
- }
- catch (IOException ioe)
- {
- NamingException ne = new NamingException("Unable to load property file:" + file +".");
- ne.setRootCause(ioe);
- throw ne;
- }
-
- try
- {
- createConnectionFactories(data, environment);
- }
- catch (MalformedURLException e)
- {
- NamingException ne = new NamingException();
- ne.setRootCause(e);
- throw ne;
- }
-
- createDestinations(data, environment);
-
- createQueues(data, environment);
-
- createTopics(data, environment);
-
- return createContext(data, environment);
- }
-
- protected ReadOnlyContext createContext(Map data, Hashtable environment)
- {
- return new ReadOnlyContext(environment, data);
- }
-
- protected void createConnectionFactories(Map data, Hashtable environment) throws MalformedURLException
- {
- for (Iterator iter = environment.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry entry = (Map.Entry) iter.next();
- String key = entry.getKey().toString();
- if (key.startsWith(CONNECTION_FACTORY_PREFIX))
- {
- String jndiName = key.substring(CONNECTION_FACTORY_PREFIX.length());
- ConnectionFactory cf = createFactory(entry.getValue().toString().trim());
- if (cf != null)
- {
- data.put(jndiName, cf);
- }
- }
- }
- }
-
- protected void createDestinations(Map data, Hashtable environment)
- {
- for (Iterator iter = environment.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry entry = (Map.Entry) iter.next();
- String key = entry.getKey().toString();
- if (key.startsWith(DESTINATION_PREFIX))
- {
- String jndiName = key.substring(DESTINATION_PREFIX.length());
- Destination dest = createDestination(entry.getValue().toString().trim());
- if (dest != null)
- {
- data.put(jndiName, dest);
- }
- }
- }
- }
-
- protected void createQueues(Map data, Hashtable environment)
- {
- for (Iterator iter = environment.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry entry = (Map.Entry) iter.next();
- String key = entry.getKey().toString();
- if (key.startsWith(QUEUE_PREFIX))
- {
- String jndiName = key.substring(QUEUE_PREFIX.length());
- Queue q = createQueue(entry.getValue().toString().trim());
- if (q != null)
- {
- data.put(jndiName, q);
- }
- }
- }
- }
-
- protected void createTopics(Map data, Hashtable environment)
- {
- for (Iterator iter = environment.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry entry = (Map.Entry) iter.next();
- String key = entry.getKey().toString();
- if (key.startsWith(TOPIC_PREFIX))
- {
- String jndiName = key.substring(TOPIC_PREFIX.length());
- Topic t = createTopic(entry.getValue().toString().trim());
- if (t != null)
- {
- data.put(jndiName, t);
- }
- }
- }
- }
-
-
- private ConnectionFactory createFactory(String url) throws MalformedURLException
- {
- return ConnectionFactoryImpl.createFromURL(url);
- }
-
- private DestinationImpl createDestination(String str)
- {
- return DestinationImpl.createDestination(str);
- }
-
- private QueueImpl createQueue(String address)
- {
- return QueueImpl.createQueue(address);
- }
-
- private TopicImpl createTopic(String address)
- {
- return TopicImpl.createTopic(address);
- }
-
-}
diff --git a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/ReadOnlyContext.java b/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/ReadOnlyContext.java
deleted file mode 100644
index d0f7ddb216..0000000000
--- a/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/jndi/ReadOnlyContext.java
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- *
- * 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.jndi;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.naming.Binding;
-import javax.naming.CompositeName;
-import javax.naming.Context;
-import javax.naming.LinkRef;
-import javax.naming.Name;
-import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NotContextException;
-import javax.naming.OperationNotSupportedException;
-import javax.naming.Reference;
-import javax.naming.spi.NamingManager;
-
-/**
- * Based on class from ActiveMQ.
- * A read-only Context
- * <p>
- * This version assumes it and all its subcontext are read-only and any attempt
- * to modify (e.g. through bind) will result in an OperationNotSupportedException.
- * Each Context in the tree builds a cache of the entries in all sub-contexts
- * to optimise the performance of lookup.
- * <p>
- * This implementation is intended to optimise the performance of lookup(String)
- * to about the level of a HashMap get. It has been observed that the scheme
- * resolution phase performed by the JVM takes considerably longer, so for
- * optimum performance lookups should be coded like:</p>
- * <code>
- * Context componentContext = (Context)new InitialContext().lookup("java:comp");
- * String envEntry = (String) componentContext.lookup("env/myEntry");
- * String envEntry2 = (String) componentContext.lookup("env/myEntry2");
- * </code>
- */
-public class ReadOnlyContext implements Context, Serializable
-{
- private static final long serialVersionUID = -5754338187296859149L;
- protected static final NameParser nameParser = new NameParserImpl();
-
- protected final Hashtable environment; // environment for this context
- protected final Map bindings; // bindings at my level
- protected final Map treeBindings; // all bindings under me
-
- private boolean frozen = false;
- private String nameInNamespace = "";
- public static final String SEPARATOR = "/";
-
- public ReadOnlyContext()
- {
- environment = new Hashtable();
- bindings = new HashMap();
- treeBindings = new HashMap();
- }
-
- public ReadOnlyContext(Hashtable env)
- {
- if (env == null)
- {
- this.environment = new Hashtable();
- }
- else
- {
- this.environment = new Hashtable(env);
- }
-
- this.bindings = Collections.EMPTY_MAP;
- this.treeBindings = Collections.EMPTY_MAP;
- }
-
- public ReadOnlyContext(Hashtable environment, Map bindings)
- {
- if (environment == null)
- {
- this.environment = new Hashtable();
- }
- else
- {
- this.environment = new Hashtable(environment);
- }
-
- this.bindings = bindings;
- treeBindings = new HashMap();
- frozen = true;
- }
-
- public ReadOnlyContext(Hashtable environment, Map bindings, String nameInNamespace)
- {
- this(environment, bindings);
- this.nameInNamespace = nameInNamespace;
- }
-
- protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env)
- {
- this.bindings = clone.bindings;
- this.treeBindings = clone.treeBindings;
- this.environment = new Hashtable(env);
- }
-
- protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env, String nameInNamespace)
- {
- this(clone, env);
- this.nameInNamespace = nameInNamespace;
- }
-
- public void freeze()
- {
- frozen = true;
- }
-
- boolean isFrozen()
- {
- return frozen;
- }
-
- /**
- * internalBind is intended for use only during setup or possibly by suitably synchronized superclasses.
- * It binds every possible lookup into a map in each context. To do this, each context
- * strips off one name segment and if necessary creates a new context for it. Then it asks that context
- * to bind the remaining name. It returns a map containing all the bindings from the next context, plus
- * the context it just created (if it in fact created it). (the names are suitably extended by the segment
- * originally lopped off).
- */
- protected Map internalBind(String name, Object value) throws NamingException
- {
- assert (name != null) && (name.length() > 0);
- assert !frozen;
-
- Map newBindings = new HashMap();
- int pos = name.indexOf('/');
- if (pos == -1)
- {
- if (treeBindings.put(name, value) != null)
- {
- throw new NamingException("Something already bound at " + name);
- }
-
- bindings.put(name, value);
- newBindings.put(name, value);
- }
- else
- {
- String segment = name.substring(0, pos);
- assert segment != null;
- assert !segment.equals("");
- Object o = treeBindings.get(segment);
- if (o == null)
- {
- o = newContext();
- treeBindings.put(segment, o);
- bindings.put(segment, o);
- newBindings.put(segment, o);
- }
- else if (!(o instanceof ReadOnlyContext))
- {
- throw new NamingException("Something already bound where a subcontext should go");
- }
-
- ReadOnlyContext readOnlyContext = (ReadOnlyContext) o;
- String remainder = name.substring(pos + 1);
- Map subBindings = readOnlyContext.internalBind(remainder, value);
- for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext();)
- {
- Map.Entry entry = (Map.Entry) iterator.next();
- String subName = segment + "/" + (String) entry.getKey();
- Object bound = entry.getValue();
- treeBindings.put(subName, bound);
- newBindings.put(subName, bound);
- }
- }
-
- return newBindings;
- }
-
- protected ReadOnlyContext newContext()
- {
- return new ReadOnlyContext();
- }
-
- public Object addToEnvironment(String propName, Object propVal) throws NamingException
- {
- return environment.put(propName, propVal);
- }
-
- public Hashtable getEnvironment() throws NamingException
- {
- return (Hashtable) environment.clone();
- }
-
- public Object removeFromEnvironment(String propName) throws NamingException
- {
- return environment.remove(propName);
- }
-
- public Object lookup(String name) throws NamingException
- {
- if (name.length() == 0)
- {
- return this;
- }
-
- Object result = treeBindings.get(name);
- if (result == null)
- {
- result = bindings.get(name);
- }
-
- if (result == null)
- {
- int pos = name.indexOf(':');
- if (pos > 0)
- {
- String scheme = name.substring(0, pos);
- Context ctx = NamingManager.getURLContext(scheme, environment);
- if (ctx == null)
- {
- throw new NamingException("scheme " + scheme + " not recognized");
- }
-
- return ctx.lookup(name);
- }
- else
- {
- // Split out the first name of the path
- // and look for it in the bindings map.
- CompositeName path = new CompositeName(name);
-
- if (path.size() == 0)
- {
- return this;
- }
- else
- {
- String first = path.get(0);
- Object obj = bindings.get(first);
- if (obj == null)
- {
- throw new NameNotFoundException(name);
- }
- else if ((obj instanceof Context) && (path.size() > 1))
- {
- Context subContext = (Context) obj;
- obj = subContext.lookup(path.getSuffix(1));
- }
-
- return obj;
- }
- }
- }
-
- if (result instanceof LinkRef)
- {
- LinkRef ref = (LinkRef) result;
- result = lookup(ref.getLinkName());
- }
-
- if (result instanceof Reference)
- {
- try
- {
- result = NamingManager.getObjectInstance(result, null, null, this.environment);
- }
- catch (NamingException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
- }
- }
-
- if (result instanceof ReadOnlyContext)
- {
- String prefix = getNameInNamespace();
- if (prefix.length() > 0)
- {
- prefix = prefix + SEPARATOR;
- }
-
- result = new ReadOnlyContext((ReadOnlyContext) result, environment, prefix + name);
- }
-
- return result;
- }
-
- public Object lookup(Name name) throws NamingException
- {
- return lookup(name.toString());
- }
-
- public Object lookupLink(String name) throws NamingException
- {
- return lookup(name);
- }
-
- public Name composeName(Name name, Name prefix) throws NamingException
- {
- Name result = (Name) prefix.clone();
- result.addAll(name);
-
- return result;
- }
-
- public String composeName(String name, String prefix) throws NamingException
- {
- CompositeName result = new CompositeName(prefix);
- result.addAll(new CompositeName(name));
-
- return result.toString();
- }
-
- public NamingEnumeration list(String name) throws NamingException
- {
- Object o = lookup(name);
- if (o == this)
- {
- return new ListEnumeration();
- }
- else if (o instanceof Context)
- {
- return ((Context) o).list("");
- }
- else
- {
- throw new NotContextException();
- }
- }
-
- public NamingEnumeration listBindings(String name) throws NamingException
- {
- Object o = lookup(name);
- if (o == this)
- {
- return new ListBindingEnumeration();
- }
- else if (o instanceof Context)
- {
- return ((Context) o).listBindings("");
- }
- else
- {
- throw new NotContextException();
- }
- }
-
- public Object lookupLink(Name name) throws NamingException
- {
- return lookupLink(name.toString());
- }
-
- public NamingEnumeration list(Name name) throws NamingException
- {
- return list(name.toString());
- }
-
- public NamingEnumeration listBindings(Name name) throws NamingException
- {
- return listBindings(name.toString());
- }
-
- public void bind(Name name, Object obj) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void bind(String name, Object obj) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void close() throws NamingException
- {
- // ignore
- }
-
- public Context createSubcontext(Name name) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public Context createSubcontext(String name) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void destroySubcontext(Name name) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void destroySubcontext(String name) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public String getNameInNamespace() throws NamingException
- {
- return nameInNamespace;
- }
-
- public NameParser getNameParser(Name name) throws NamingException
- {
- return nameParser;
- }
-
- public NameParser getNameParser(String name) throws NamingException
- {
- return nameParser;
- }
-
- public void rebind(Name name, Object obj) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void rebind(String name, Object obj) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void rename(Name oldName, Name newName) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void rename(String oldName, String newName) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void unbind(Name name) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- public void unbind(String name) throws NamingException
- {
- throw new OperationNotSupportedException();
- }
-
- private abstract class LocalNamingEnumeration implements NamingEnumeration
- {
- private Iterator i = bindings.entrySet().iterator();
-
- public boolean hasMore() throws NamingException
- {
- return i.hasNext();
- }
-
- public boolean hasMoreElements()
- {
- return i.hasNext();
- }
-
- protected Map.Entry getNext()
- {
- return (Map.Entry) i.next();
- }
-
- public void close() throws NamingException
- { }
- }
-
- private class ListEnumeration extends LocalNamingEnumeration
- {
- public Object next() throws NamingException
- {
- return nextElement();
- }
-
- public Object nextElement()
- {
- Map.Entry entry = getNext();
-
- return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName());
- }
- }
-
- private class ListBindingEnumeration extends LocalNamingEnumeration
- {
- public Object next() throws NamingException
- {
- return nextElement();
- }
-
- public Object nextElement()
- {
- Map.Entry entry = getNext();
-
- return new Binding((String) entry.getKey(), entry.getValue());
- }
- }
-}