diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2012-04-04 14:03:24 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2012-04-04 14:03:24 +0000 |
| commit | 4f380560727833bc21c92e9ea2bfb64cf59830b1 (patch) | |
| tree | 816667abebf08676f365708de24f1258b4b4ab62 /qpid/java | |
| parent | 063ffdf483c3226f34a86a77d9678526e8287514 (diff) | |
| download | qpid-python-4f380560727833bc21c92e9ea2bfb64cf59830b1.tar.gz | |
QPID-3401 Added implementations for TemporaryQueue and TemporaryTopic.
Generating temp queue name, topic name as well as deleting temp
destinations is abstracted via the TemporaryDestinationProvider
interface. This keeps the Destination implementation independent of any
session implementation. These classes can then be used with the old
AMQSessionxx variants or with any new implementation.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/address-refactor2@1309392 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
3 files changed, 116 insertions, 0 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/jms/QpidTemporaryQueue.java b/qpid/java/client/src/main/java/org/apache/qpid/jms/QpidTemporaryQueue.java new file mode 100644 index 0000000000..ae6eb81f04 --- /dev/null +++ b/qpid/java/client/src/main/java/org/apache/qpid/jms/QpidTemporaryQueue.java @@ -0,0 +1,42 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.jms; + +import javax.jms.JMSException; +import javax.jms.TemporaryQueue; + +public class QpidTemporaryQueue extends QpidQueue implements TemporaryQueue +{ + TemporaryDestinationProvider provider; + + public QpidTemporaryQueue(TemporaryDestinationProvider provider) throws JMSException + { + super(provider.generateTempQueueAddress()); + this.provider = provider; + } + + @Override + public void delete() throws JMSException + { + provider.delete(); + } + +} diff --git a/qpid/java/client/src/main/java/org/apache/qpid/jms/QpidTemporaryTopic.java b/qpid/java/client/src/main/java/org/apache/qpid/jms/QpidTemporaryTopic.java new file mode 100644 index 0000000000..3942551ba5 --- /dev/null +++ b/qpid/java/client/src/main/java/org/apache/qpid/jms/QpidTemporaryTopic.java @@ -0,0 +1,42 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.jms; + +import javax.jms.JMSException; +import javax.jms.TemporaryTopic; + +public class QpidTemporaryTopic extends QpidTopic implements TemporaryTopic +{ + TemporaryDestinationProvider provider; + + public QpidTemporaryTopic(TemporaryDestinationProvider provider) throws JMSException + { + super(provider.generateTempTopicAddress()); + this.provider = provider; + } + + @Override + public void delete() throws JMSException + { + provider.delete(); + } + +} diff --git a/qpid/java/client/src/main/java/org/apache/qpid/jms/TemporaryDestinationProvider.java b/qpid/java/client/src/main/java/org/apache/qpid/jms/TemporaryDestinationProvider.java new file mode 100644 index 0000000000..47e2b8a6c5 --- /dev/null +++ b/qpid/java/client/src/main/java/org/apache/qpid/jms/TemporaryDestinationProvider.java @@ -0,0 +1,32 @@ +/* + * + * 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.jms; + +import javax.jms.JMSException; + +public interface TemporaryDestinationProvider +{ + public String generateTempQueueAddress(); + + public String generateTempTopicAddress(); + + public void delete() throws JMSException; +} |
