From 5b5e8fc7d7ed98f91e57db5c408d91796302da45 Mon Sep 17 00:00:00 2001 From: Kenneth Anthony Giusti Date: Sat, 19 Feb 2011 13:51:04 +0000 Subject: QPID-2935: merge latest trunk git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-2935@1072330 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/CMakeLists.txt | 1 + qpid/cpp/bindings/qpid/CMakeLists.txt | 39 ++++++ qpid/cpp/bindings/qpid/dotnet/Makefile.am | 1 + .../org.apache.qpid.messaging.sessionreceiver.sln | 76 +++++++++++ qpid/cpp/bindings/qpid/examples/perl/client.pl | 8 +- qpid/cpp/bindings/qpid/examples/perl/drain.pl | 12 +- .../cpp/bindings/qpid/examples/perl/hello_world.pl | 10 +- qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl | 6 +- .../bindings/qpid/examples/perl/map_receiver.pl | 8 +- qpid/cpp/bindings/qpid/examples/perl/map_sender.pl | 8 +- qpid/cpp/bindings/qpid/examples/perl/server.pl | 6 +- qpid/cpp/bindings/qpid/examples/perl/spout.pl | 10 +- qpid/cpp/bindings/qpid/perl/CMakeLists.txt | 39 ++++++ qpid/cpp/bindings/qpid/perl/Makefile.am | 20 +-- qpid/cpp/bindings/qpid/perl/perl.i | 2 +- qpid/cpp/bindings/qpid/python/CMakeLists.txt | 46 +++++++ qpid/cpp/bindings/qpid/qpid.i | 2 + qpid/cpp/bindings/qpid/ruby/CMakeLists.txt | 39 ++++++ qpid/cpp/src/CMakeLists.txt | 101 ++++++++++++-- qpid/cpp/src/Makefile.am | 5 +- qpid/cpp/src/qpid/management/ManagementAgent.cpp | 20 +++ qpid/cpp/src/qpid/management/ManagementAgent.h | 7 +- qpid/cpp/src/tests/MessagingFixture.h | 117 ++++++++++++++++ qpid/cpp/src/tests/MessagingSessionTests.cpp | 47 +++++++ qpid/cpp/src/tests/QueueTest.cpp | 2 +- qpid/cpp/src/tests/qpid-ctrl | 5 +- qpid/cpp/src/tests/sender.cpp | 2 +- qpid/doc/dev-readme/QPID-0.8-Component-README.odg | Bin 13700 -> 0 bytes qpid/doc/dev-readme/QPID-0.8-Component-README.pdf | Bin 40319 -> 0 bytes qpid/doc/dev-readme/QPID-Component-README.odg | Bin 0 -> 14069 bytes qpid/doc/dev-readme/QPID-Component-README.pdf | Bin 0 -> 39535 bytes .../main/java/org/apache/qpid/qmf/QMFService.java | 19 +++ .../qpid/server/logging/actors/CurrentActor.java | 20 +-- .../qpid/server/util/InternalBrokerBaseCase.java | 5 +- .../qpid/client/AMQConnectionDelegate_0_10.java | 14 +- .../org/apache/qpid/client/AMQSession_0_10.java | 9 +- .../client/message/AMQMessageDelegate_0_10.java | 25 ++-- .../java/org/apache/qpid/transport/Binary.java | 9 ++ .../org/apache/qpid/transport/ServerDelegate.java | 7 +- .../qpid/transport/codec/AbstractDecoder.java | 10 +- .../org/apache/qpid/transport/codec/BBDecoder.java | 5 + .../apache/qpid/transport/network/Assembler.java | 65 ++++++--- .../qpid/transport/network/Disassembler.java | 57 +++----- .../server/queue/QueueDepthWithSelectorTest.java | 141 +++++-------------- .../qpid/test/client/QueueBrowserAutoAckTest.java | 16 +-- .../apache/qpid/test/unit/message/UTF8Test.java | 35 ++--- qpid/packaging/windows/INSTALL_NOTES.html | 73 +++------- qpid/packaging/windows/installer.proj | 51 ++++++- qpid/packaging/windows/qpidc.wxs | 149 +++++++++++++++++++-- qpid/specs/management-schema.xml | 13 ++ 50 files changed, 978 insertions(+), 384 deletions(-) create mode 100644 qpid/cpp/bindings/qpid/CMakeLists.txt create mode 100644 qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sessionreceiver.sln create mode 100644 qpid/cpp/bindings/qpid/perl/CMakeLists.txt create mode 100644 qpid/cpp/bindings/qpid/python/CMakeLists.txt create mode 100644 qpid/cpp/bindings/qpid/ruby/CMakeLists.txt delete mode 100644 qpid/doc/dev-readme/QPID-0.8-Component-README.odg delete mode 100644 qpid/doc/dev-readme/QPID-0.8-Component-README.pdf create mode 100644 qpid/doc/dev-readme/QPID-Component-README.odg create mode 100644 qpid/doc/dev-readme/QPID-Component-README.pdf diff --git a/qpid/cpp/CMakeLists.txt b/qpid/cpp/CMakeLists.txt index 5c37ecfc97..17411e90a4 100644 --- a/qpid/cpp/CMakeLists.txt +++ b/qpid/cpp/CMakeLists.txt @@ -80,6 +80,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "qpidc-${qpidc_version}") add_subdirectory(managementgen) add_subdirectory(etc) add_subdirectory(src) +add_subdirectory(bindings/qpid) add_subdirectory(docs/api) # add_subdirectory(docs/man) add_subdirectory(examples) diff --git a/qpid/cpp/bindings/qpid/CMakeLists.txt b/qpid/cpp/bindings/qpid/CMakeLists.txt new file mode 100644 index 0000000000..b44065d32f --- /dev/null +++ b/qpid/cpp/bindings/qpid/CMakeLists.txt @@ -0,0 +1,39 @@ +# +# 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. +# + + +include(FindSWIG) +include(UseSWIG) +include(FindRuby) +include(FindPythonLibs) +include(FindPerlLibs) + +if (SWIG_FOUND) + if (PYTHONLIBS_FOUND) + add_subdirectory(python) + endif (PYTHONLIBS_FOUND) + + if (RUBY_FOUND) + add_subdirectory(ruby) + endif (RUBY_FOUND) + + if (PERLLIBS_FOUND) + add_subdirectory(perl) + endif (PERLLIBS_FOUND) +endif (SWIG_FOUND) diff --git a/qpid/cpp/bindings/qpid/dotnet/Makefile.am b/qpid/cpp/bindings/qpid/dotnet/Makefile.am index f2b106bcb2..b5c1f6dda5 100644 --- a/qpid/cpp/bindings/qpid/dotnet/Makefile.am +++ b/qpid/cpp/bindings/qpid/dotnet/Makefile.am @@ -81,6 +81,7 @@ EXTRA_DIST = winsdk_sources/winsdk_dotnet_examples.sln \ configure-windows.ps1 \ ReadMe.txt \ org.apache.qpid.messaging.sln \ + org.apache.qpid.messaging.sessionreceiver.sln \ test/messaging.test/messaging.test.address.cs \ test/messaging.test/messaging.test.duration.cs \ test/messaging.test/messaging.test.cs \ diff --git a/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sessionreceiver.sln b/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sessionreceiver.sln new file mode 100644 index 0000000000..90e98a4bbe --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sessionreceiver.sln @@ -0,0 +1,76 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +# +# 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("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Org.Apache.Qpid.Messaging", "src\org.apache.qpid.messaging.vcproj", "{AA5A3B83-5F98-406D-A01C-5A921467A57D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "org.apache.qpid.messaging.sessionreceiver", "src\sessionreceiver\org.apache.qpid.messaging.sessionreceiver.csproj", "{B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + RelWithDebInfo|Win32 = RelWithDebInfo|Win32 + RelWithDebInfo|x64 = RelWithDebInfo|x64 + RelWithDebInfo|x86 = RelWithDebInfo|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Win32.Build.0 = Debug|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x64.ActiveCfg = Debug|x64 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x64.Build.0 = Debug|x64 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x86.ActiveCfg = Debug|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x86.Build.0 = Debug|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Win32.ActiveCfg = Release|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Win32.Build.0 = Release|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x64.ActiveCfg = Release|x64 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x64.Build.0 = Release|x64 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x86.ActiveCfg = Release|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x86.Build.0 = Release|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|Win32 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|Win32.ActiveCfg = Debug|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x64.ActiveCfg = Debug|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x64.Build.0 = Debug|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x86.ActiveCfg = Debug|x86 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x86.Build.0 = Debug|x86 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|Win32.ActiveCfg = Release|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x64.ActiveCfg = Release|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x64.Build.0 = Release|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x86.ActiveCfg = Release|x86 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x86.Build.0 = Release|x86 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86 + {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/qpid/cpp/bindings/qpid/examples/perl/client.pl b/qpid/cpp/bindings/qpid/examples/perl/client.pl index 93eec88e07..19d9d3f14f 100644 --- a/qpid/cpp/bindings/qpid/examples/perl/client.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/client.pl @@ -20,13 +20,13 @@ use strict; use warnings; -use cqpid; +use cqpid_perl; my $url = ( @ARGV == 1 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672"; my $connectionOptions = ( @ARGV > 1 ) ? $ARGV[1] : ""; -my $connection = new cqpid::Connection($url, $connectionOptions); +my $connection = new cqpid_perl::Connection($url, $connectionOptions); eval { $connection->open(); @@ -35,7 +35,7 @@ my $session = $connection->createSession(); my $sender = $session->createSender("service_queue"); #create temp queue & receiver... -my $responseQueue = new cqpid::Address("#response-queue; {create:always, delete:always}"); +my $responseQueue = new cqpid_perl::Address("#response-queue; {create:always, delete:always}"); my $receiver = $session->createReceiver($responseQueue); #Now send some messages... @@ -47,7 +47,7 @@ my @s = ( "And the mome raths outgrabe." ); -my $request = new cqpid::Message(); +my $request = new cqpid_perl::Message(); $request->setReplyTo($responseQueue); for (my $i=0; $i<4; $i++) { $request->setContent($s[$i]); diff --git a/qpid/cpp/bindings/qpid/examples/perl/drain.pl b/qpid/cpp/bindings/qpid/examples/perl/drain.pl index 8010b7c95b..60ac0c50ed 100644 --- a/qpid/cpp/bindings/qpid/examples/perl/drain.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/drain.pl @@ -20,7 +20,7 @@ use strict; use warnings; -use cqpid; +use cqpid_perl; use Getopt::Long; my $url = "127.0.0.1"; @@ -47,11 +47,11 @@ if ($#ARGV ge 0) { } sub getTimeout { - return ($forever) ? $cqpid::Duration::FOREVER : new cqpid::Duration($timeout*1000); + return ($forever) ? $cqpid_perl::Duration::FOREVER : new cqpid_perl::Duration($timeout*1000); } -my $connection = new cqpid::Connection($url, $connectionOptions); +my $connection = new cqpid_perl::Connection($url, $connectionOptions); eval { $connection->open(); @@ -59,13 +59,13 @@ eval { my $receiver = $session->createReceiver($address); my $timeout = getTimeout(); - my $message = new cqpid::Message(); + my $message = new cqpid_perl::Message(); my $i = 0; while($receiver->fetch($message, $timeout)) { print "Message(properties=" . $message->getProperties() . ",content='"; if ($message->getContentType() eq "amqp/map") { - my $content = cqpid::decodeMap($message); + my $content = cqpid_perl::decodeMap($message); map{ print "\n$_ => $content->{$_}"; } keys %{$content}; } else { @@ -77,7 +77,7 @@ eval { if ($replyto->getName()) { print "Replying to " . $message->getReplyTo()->str() . "...\n"; my $sender = $session->createSender($replyto); - my $response = new cqpid::Message("received by the server."); + my $response = new cqpid_perl::Message("received by the server."); $sender->send($response); } $session->acknowledge(); diff --git a/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl b/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl index cf2f05f8b7..a96b98a002 100644 --- a/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl @@ -21,13 +21,13 @@ use strict; use warnings; use Data::Dumper; -use cqpid; +use cqpid_perl; my $broker = ( @ARGV > 0 ) ? $ARGV[0] : "localhost:5672"; my $address = ( @ARGV > 1 ) ? $ARGV[0] : "amq.topic"; my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[1] : ""; -my $connection = new cqpid::Connection($broker, $connectionOptions); +my $connection = new cqpid_perl::Connection($broker, $connectionOptions); eval { $connection->open(); @@ -36,12 +36,12 @@ eval { my $receiver = $session->createReceiver($address); my $sender = $session->createSender($address); - $sender->send(new cqpid::Message("Hello world!")); + $sender->send(new cqpid_perl::Message("Hello world!")); - #my $duration = new cqpid::Duration(1000); + #my $duration = new cqpid_perl::Duration(1000); #print ">>>" . $duration->getMilliseconds() . "\n"; - my $message = $receiver->fetch($cqpid::Duration::SECOND); + my $message = $receiver->fetch($cqpid_perl::Duration::SECOND); #$message->setDurable(1); #print "Durable: " . $message->getDurable() . "\n"; diff --git a/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl b/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl index c48a5225c2..cebf2ceee6 100644 --- a/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl @@ -20,7 +20,7 @@ use strict; use warnings; -use cqpid; +use cqpid_perl; my $broker = ( @ARGV > 0 ) ? $ARGV[0] : "localhost:5672"; my $connectionOptions = ( @ARGV > 1 ) ? $ARGV[1] : ""; @@ -44,7 +44,7 @@ x-bindings: [{ exchange: xml-exchange, key: weather, arguments: { xquery:" $quer END -my $connection = new cqpid::Connection($broker, $connectionOptions); +my $connection = new cqpid_perl::Connection($broker, $connectionOptions); eval { $connection->open(); @@ -52,7 +52,7 @@ eval { my $receiver = $session->createReceiver($address); - my $message = new cqpid::Message(); + my $message = new cqpid_perl::Message(); my $content = < diff --git a/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl b/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl index e3e8a201dd..2e2611e38f 100644 --- a/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl @@ -21,21 +21,21 @@ use strict; use warnings; use Data::Dumper; -use cqpid; +use cqpid_perl; my $url = ( @ARGV > 0 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672"; my $address = ( @ARGV > 1 ) ? $ARGV[0] : "message_queue; {create: always}"; my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[1] : ""; -my $connection = new cqpid::Connection($url, $connectionOptions); +my $connection = new cqpid_perl::Connection($url, $connectionOptions); eval { $connection->open(); my $session = $connection->createSession(); my $receiver = $session->createReceiver($address); - my $content = cqpid::decodeMap($receiver->fetch()); - #my $content = cqpid::decodeList($receiver->fetch()); + my $content = cqpid_perl::decodeMap($receiver->fetch()); + #my $content = cqpid_perl::decodeList($receiver->fetch()); print Dumper($content); diff --git a/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl b/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl index 095acce0ab..4107cd48b9 100644 --- a/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl @@ -21,13 +21,13 @@ use strict; use warnings; use Data::Dumper; -use cqpid; +use cqpid_perl; my $url = ( @ARGV > 0 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672"; my $address = ( @ARGV > 1 ) ? $ARGV[1] : "message_queue; {create: always}"; my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[2] : ""; -my $connection = new cqpid::Connection($url, $connectionOptions); +my $connection = new cqpid_perl::Connection($url, $connectionOptions); eval { $connection->open(); @@ -35,13 +35,13 @@ eval { my $session = $connection->createSession(); my $sender = $session->createSender($address); - my $message = new cqpid::Message(); + my $message = new cqpid_perl::Message(); my $content = { id => 987654321, name => "Widget", percent => sprintf("%.2f", 0.99), colours => [ qw (red green white) ], }; - cqpid::encode($content, $message); + cqpid_perl::encode($content, $message); $sender->send($message, 1); $connection->close(); diff --git a/qpid/cpp/bindings/qpid/examples/perl/server.pl b/qpid/cpp/bindings/qpid/examples/perl/server.pl index 0c64f15c66..b14da565b9 100644 --- a/qpid/cpp/bindings/qpid/examples/perl/server.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/server.pl @@ -20,13 +20,13 @@ use strict; use warnings; -use cqpid; +use cqpid_perl; my $url = ( @ARGV == 1 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672"; my $connectionOptions = ( @ARGV > 1 ) ? $ARGV[1] : ""; -my $connection = new cqpid::Connection($url, $connectionOptions); +my $connection = new cqpid_perl::Connection($url, $connectionOptions); eval { $connection->open(); @@ -41,7 +41,7 @@ eval { my $sender = $session->createSender($address); my $s = $request->getContent(); $s = uc($s); - my $response = new cqpid::Message($s); + my $response = new cqpid_perl::Message($s); $sender->send($response); print "Processed request: " . $request->getContent() . " -> " . $response->getContent() . "\n"; $session->acknowledge(); diff --git a/qpid/cpp/bindings/qpid/examples/perl/spout.pl b/qpid/cpp/bindings/qpid/examples/perl/spout.pl index 50773a4fe2..7365e732bf 100644 --- a/qpid/cpp/bindings/qpid/examples/perl/spout.pl +++ b/qpid/cpp/bindings/qpid/examples/perl/spout.pl @@ -20,7 +20,7 @@ use strict; use warnings; -use cqpid; +use cqpid_perl; use Getopt::Long; use Time::Local; @@ -77,19 +77,19 @@ sub setProperties { } } -my $connection = new cqpid::Connection($url, $connectionOptions); +my $connection = new cqpid_perl::Connection($url, $connectionOptions); eval { $connection->open(); my $session = $connection->createSession(); my $sender = $session->createSender($address); - my $message = new cqpid::Message(); + my $message = new cqpid_perl::Message(); setProperties($message) if (@properties); if (@entries) { my $content = {}; setEntries($content); - cqpid::encode($content, $message); + cqpid_perl::encode($content, $message); } elsif ($content) { $message->setContent($content); @@ -98,7 +98,7 @@ eval { my $receiver; if ($replyto) { - my $responseQueue = new cqpid::Address($replyto); + my $responseQueue = new cqpid_perl::Address($replyto); $receiver = $session->createReceiver($responseQueue); $message->setReplyTo($responseQueue); } diff --git a/qpid/cpp/bindings/qpid/perl/CMakeLists.txt b/qpid/cpp/bindings/qpid/perl/CMakeLists.txt new file mode 100644 index 0000000000..da3c0be41a --- /dev/null +++ b/qpid/cpp/bindings/qpid/perl/CMakeLists.txt @@ -0,0 +1,39 @@ +# +# 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. +# + +##------------------------------------------------------ +## Use Swig to generate a literal binding to the C++ API +##------------------------------------------------------ +set(CMAKE_SWIG_FLAGS "-w361,362,401,467,503") +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/perl.i PROPERTIES CPLUSPLUS ON) +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/perl.i PROPERTIES SWIG_FLAGS "-I${qpid-cpp_SOURCE_DIR}/include") + +swig_add_module(cqpid_perl perl ${CMAKE_CURRENT_SOURCE_DIR}/perl.i) +swig_link_libraries(cqpid_perl qpidmessaging qpidtypes qmf2 ${PERL_LIBRARY}) + +set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "-I${PERL_INCLUDE_PATH} -I${qpid-cpp_SOURCE_DIR}/include") + +##---------------------------------- +## Install the complete Perl binding +##---------------------------------- +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcqpid_perl.so + ${CMAKE_CURRENT_BINARY_DIR}/cqpid_perl.pm + DESTINATION ${PERL_VENDORARCH} + COMPONENT ${QPID_COMPONENT_CLIENT} + ) diff --git a/qpid/cpp/bindings/qpid/perl/Makefile.am b/qpid/cpp/bindings/qpid/perl/Makefile.am index 982d493ba0..13ab66f032 100644 --- a/qpid/cpp/bindings/qpid/perl/Makefile.am +++ b/qpid/cpp/bindings/qpid/perl/Makefile.am @@ -22,21 +22,21 @@ if HAVE_PERL_DEVEL INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src -I$(top_builddir)/src -I$(PERL_INC) EXTRA_DIST = perl.i -BUILT_SOURCES = cqpid.cpp +BUILT_SOURCES = cqpid_perl.cpp SWIG_FLAGS = -w362,401 -cqpid.cpp: $(srcdir)/perl.i $(srcdir)/../qpid.i $(srcdir)/../../swig_perl_typemaps.i - $(SWIG) -perl -c++ $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I/usr/include -o cqpid.cpp $(srcdir)/perl.i +cqpid_perl.cpp: $(srcdir)/perl.i $(srcdir)/../qpid.i $(srcdir)/../../swig_perl_typemaps.i + $(SWIG) -perl -c++ $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I/usr/include -o cqpid_perl.cpp $(srcdir)/perl.i -lib_LTLIBRARIES = cqpid.la -cqpid_PERL = cqpid.pm +lib_LTLIBRARIES = libcqpid_perl.la +cqpid_perl_PERL = cqpid_perl.pm -cqpid_la_LDFLAGS = -avoid-version -module -shared -cqpid_la_LIBADD = -L$(top_builddir)/src/.libs -lqpidmessaging -lqpidtypes \ +libcqpid_perl_la_LDFLAGS = -avoid-version -shared +libcqpid_perl_la_LIBADD = -L$(top_builddir)/src/.libs -lqpidmessaging -lqpidtypes \ $(top_builddir)/src/libqpidmessaging.la $(top_builddir)/src/libqpidtypes.la -cqpid_la_CXXFLAGS = $(INCLUDES) -nodist_cqpid_la_SOURCES = cqpid.cpp +libcqpid_perl_la_CXXFLAGS = $(INCLUDES) +nodist_libcqpid_perl_la_SOURCES = cqpid_perl.cpp -CLEANFILES = cqpid.cpp cqpid.pm +CLEANFILES = cqpid_perl.cpp cqpid_perl.pm endif # HAVE_PERL_DEVEL diff --git a/qpid/cpp/bindings/qpid/perl/perl.i b/qpid/cpp/bindings/qpid/perl/perl.i index b7ae0568b6..38ac91761f 100644 --- a/qpid/cpp/bindings/qpid/perl/perl.i +++ b/qpid/cpp/bindings/qpid/perl/perl.i @@ -17,7 +17,7 @@ * under the License. */ -%module cqpid +%module cqpid_perl %include "std_string.i" %include "../../swig_perl_typemaps.i" diff --git a/qpid/cpp/bindings/qpid/python/CMakeLists.txt b/qpid/cpp/bindings/qpid/python/CMakeLists.txt new file mode 100644 index 0000000000..51c983f3cf --- /dev/null +++ b/qpid/cpp/bindings/qpid/python/CMakeLists.txt @@ -0,0 +1,46 @@ +# +# 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. +# + +##------------------------------------------------------ +## Use Swig to generate a literal binding to the C++ API +##------------------------------------------------------ +set(CMAKE_SWIG_FLAGS "-w361,362,401,467") +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/python.i PROPERTIES CPLUSPLUS ON) +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/python.i PROPERTIES SWIG_FLAGS "-I${qpid-cpp_SOURCE_DIR}/include") + +swig_add_module(cqpid python ${CMAKE_CURRENT_SOURCE_DIR}/python.i) +swig_link_libraries(cqpid qpidmessaging qpidtypes qmf2 ${PYTHON_LIBRARIES}) + +set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing -I${PYTHON_INCLUDE_PATH} -I${qpid-cpp_SOURCE_DIR}/include") + +##------------------------------------ +## Install the complete Python binding +##------------------------------------ +execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE) +install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m py_compile cqpid.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})") +install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile cqpid.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})") +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cqpid.py + ${CMAKE_CURRENT_BINARY_DIR}/cqpid.pyc + ${CMAKE_CURRENT_BINARY_DIR}/cqpid.pyo + ${CMAKE_CURRENT_BINARY_DIR}/_cqpid.so + DESTINATION ${PYTHON_SITE_PACKAGES} + COMPONENT ${QPID_COMPONENT_CLIENT} + ) diff --git a/qpid/cpp/bindings/qpid/qpid.i b/qpid/cpp/bindings/qpid/qpid.i index e60ce1ce7c..01f9bff64d 100644 --- a/qpid/cpp/bindings/qpid/qpid.i +++ b/qpid/cpp/bindings/qpid/qpid.i @@ -27,6 +27,7 @@ #include #include #include +#include // // Wrapper functions for map-decode and list-decode. This allows us to avoid @@ -56,6 +57,7 @@ qpid::types::Variant::List& decodeList(const qpid::messaging::Message& msg) { %include %include %include +%include qpid::types::Variant::Map& decodeMap(const qpid::messaging::Message&); qpid::types::Variant::List& decodeList(const qpid::messaging::Message&); diff --git a/qpid/cpp/bindings/qpid/ruby/CMakeLists.txt b/qpid/cpp/bindings/qpid/ruby/CMakeLists.txt new file mode 100644 index 0000000000..7113d93b62 --- /dev/null +++ b/qpid/cpp/bindings/qpid/ruby/CMakeLists.txt @@ -0,0 +1,39 @@ +# +# 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. +# + +##------------------------------------------------------ +## Use Swig to generate a literal binding to the C++ API +##------------------------------------------------------ +set(CMAKE_SWIG_FLAGS "-w361,362,401,467") +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/ruby.i PROPERTIES CPLUSPLUS ON) +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/ruby.i PROPERTIES SWIG_FLAGS "-I${qpid-cpp_SOURCE_DIR}/include") + +swig_add_module(cqpid ruby ${CMAKE_CURRENT_SOURCE_DIR}/ruby.i) +swig_link_libraries(cqpid qpidmessaging qpidtypes qmf2 ${RUBY_LIBRARY}) + +set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "-I${RUBY_INCLUDE_DIR} -I${qpid-cpp_SOURCE_DIR}/include") + +##---------------------------------- +## Install the complete Ruby binding +##---------------------------------- +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcqpid.so + RENAME cqpid.so + DESTINATION ${RUBY_SITEARCH_DIR} + COMPONENT ${QPID_COMPONENT_CLIENT} + ) diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt index 4b5a1b1c2c..d0ca2d9c2b 100644 --- a/qpid/cpp/src/CMakeLists.txt +++ b/qpid/cpp/src/CMakeLists.txt @@ -313,10 +313,6 @@ if (NOT Boost_FILESYSTEM_LIBRARY) set(Boost_FILESYSTEM_LIBRARY boost_filesystem) endif (NOT Boost_FILESYSTEM_LIBRARY) -if (NOT Boost_SYSTEM_LIBRARY) - set(Boost_SYSTEM_LIBRARY boost_system) -endif (NOT Boost_SYSTEM_LIBRARY) - if (NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY) set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY boost_unit_test_framework) endif (NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY) @@ -602,14 +598,14 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows) set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /O2 /Ob2 /D NDEBUG") set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "/debug /INCREMENTAL:NO") - # Set the windows version for the .NET Binding cpp project - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../bindings/qpid/dotnet/src/org.apache.qpid.messaging.template.rc - ${CMAKE_CURRENT_BINARY_DIR}/windows/resources/org.apache.qpid.messaging.rc) - - # Set the windows version for the .NET Binding sessionreceiver project - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../bindings/qpid/dotnet/src/sessionreceiver/properties/sessionreceiver-AssemblyInfo-template.cs - ${CMAKE_CURRENT_BINARY_DIR}/windows/generated_src/sessionreceiver-AssemblyInfo.cs) - + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../bindings/qpid/dotnet/src) + # Set the windows version for the .NET Binding cpp project + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../bindings/qpid/dotnet/src/org.apache.qpid.messaging.template.rc + ${CMAKE_CURRENT_BINARY_DIR}/windows/resources/org.apache.qpid.messaging.rc) + # Set the windows version for the .NET Binding sessionreceiver project + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../bindings/qpid/dotnet/src/sessionreceiver/properties/sessionreceiver-AssemblyInfo-template.cs + ${CMAKE_CURRENT_BINARY_DIR}/windows/generated_src/sessionreceiver-AssemblyInfo.cs) + endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../bindings/qpid/dotnet/src) endif (MSVC) set (qpidtypes_platform_SOURCES @@ -1068,13 +1064,15 @@ endif (CPACK_GENERATOR STREQUAL "NSIS") # REVISION => Version of underlying implementation. # Bump if implementation changes but API/ABI doesn't # AGE => Number of API/ABI versions this is backward compatible with -set (qmf_version 1.0.0) +set (qmf_version 2.0.0) +set (qmf2_version 1.0.0) set (qmfengine_version 1.0.0) set (qmf_SOURCES qpid/agent/ManagementAgentImpl.cpp qpid/agent/ManagementAgentImpl.h ) + add_msvc_version (qmf library dll) add_library (qmf SHARED ${qmf_SOURCES}) target_link_libraries (qmf qpidclient) @@ -1085,6 +1083,83 @@ install (TARGETS qmf OPTIONAL COMPONENT ${QPID_COMPONENT_QMF}) install_pdb (qmf ${QPID_COMPONENT_QMF}) +if(NOT WIN32) + set (qmf2_HEADERS + ../include/qmf/AgentEvent.h + ../include/qmf/Agent.h + ../include/qmf/AgentSession.h + ../include/qmf/ConsoleEvent.h + ../include/qmf/ConsoleSession.h + ../include/qmf/DataAddr.h + ../include/qmf/Data.h + ../include/qmf/exceptions.h + ../include/qmf/Handle.h + ../include/qmf/ImportExport.h + ../include/qmf/Query.h + ../include/qmf/Schema.h + ../include/qmf/SchemaId.h + ../include/qmf/SchemaMethod.h + ../include/qmf/SchemaProperty.h + ../include/qmf/SchemaTypes.h + ../include/qmf/Subscription.h + ) + + set (qmf2_SOURCES + ${qmf2_HEADERS} + qmf/agentCapability.h + qmf/Agent.cpp + qmf/AgentEvent.cpp + qmf/AgentEventImpl.h + qmf/AgentImpl.h + qmf/AgentSession.cpp + qmf/AgentSubscription.cpp + qmf/AgentSubscription.h + qmf/ConsoleEvent.cpp + qmf/ConsoleEventImpl.h + qmf/ConsoleSession.cpp + qmf/ConsoleSessionImpl.h + qmf/constants.cpp + qmf/constants.h + qmf/DataAddr.cpp + qmf/DataAddrImpl.h + qmf/Data.cpp + qmf/DataImpl.h + qmf/exceptions.cpp + qmf/Expression.cpp + qmf/Expression.h + qmf/Hash.cpp + qmf/Hash.h + qmf/PrivateImplRef.h + qmf/Query.cpp + qmf/QueryImpl.h + qmf/Schema.cpp + qmf/SchemaCache.cpp + qmf/SchemaCache.h + qmf/SchemaId.cpp + qmf/SchemaIdImpl.h + qmf/SchemaImpl.h + qmf/SchemaMethod.cpp + qmf/SchemaMethodImpl.h + qmf/SchemaProperty.cpp + qmf/SchemaPropertyImpl.h + qmf/Subscription.cpp + qmf/SubscriptionImpl.h + ) + + add_msvc_version (qmf2 library dll) + add_library (qmf2 SHARED ${qmf2_SOURCES}) + target_link_libraries (qmf2 qpidmessaging qpidtypes qpidclient qpidcommon) + set_target_properties (qmf2 PROPERTIES + VERSION ${qmf2_version}) + install (TARGETS qmf2 OPTIONAL + DESTINATION ${QPID_INSTALL_LIBDIR} + COMPONENT ${QPID_COMPONENT_QMF}) + install (FILES ${qmf2_HEADERS} + DESTINATION ${QPID_INSTALL_INCLUDEDIR}/qmf + COMPONENT ${QPID_COMPONENT_QMF}) + install_pdb (qmf2 ${QPID_COMPONENT_QMF}) +endif (NOT WIN32) + set (qmfengine_SOURCES qmf/engine/Agent.cpp qmf/engine/BrokerProxyImpl.cpp diff --git a/qpid/cpp/src/Makefile.am b/qpid/cpp/src/Makefile.am index 6fafff7d54..dfb2547613 100644 --- a/qpid/cpp/src/Makefile.am +++ b/qpid/cpp/src/Makefile.am @@ -56,7 +56,10 @@ windows_dist = \ qpid/broker/windows/BrokerDefaults.cpp \ qpid/broker/windows/SaslAuthenticator.cpp \ qpid/broker/windows/SslProtocolFactory.cpp \ - qpid/messaging/HandleInstantiator.cpp + qpid/messaging/HandleInstantiator.cpp \ + windows/resources/template-resource.rc \ + windows/resources/version-resource.h \ + windows/resources/qpid-icon.ico EXTRA_DIST= $(platform_dist) $(rgen_srcs) $(windows_dist) diff --git a/qpid/cpp/src/qpid/management/ManagementAgent.cpp b/qpid/cpp/src/qpid/management/ManagementAgent.cpp index 23c999a98a..8b4defaa73 100644 --- a/qpid/cpp/src/qpid/management/ManagementAgent.cpp +++ b/qpid/cpp/src/qpid/management/ManagementAgent.cpp @@ -31,6 +31,7 @@ #include #include "qpid/framing/MessageTransferBody.h" #include "qpid/sys/Time.h" +#include "qpid/sys/Thread.h" #include "qpid/broker/ConnectionState.h" #include "qpid/broker/AclModule.h" #include "qpid/types/Variant.h" @@ -2237,6 +2238,7 @@ void ManagementAgent::dispatchAgentCommandLH(Message& msg, bool viaLocal) uint32_t bufferLen = inBuffer.getPosition(); inBuffer.reset(); + setManagementExecutionContext((const qpid::broker::ConnectionState*) msg.getPublisher()); const framing::FieldTable *headers = msg.getApplicationHeaders(); if (headers && msg.getAppId() == "qmf2") { @@ -3085,3 +3087,21 @@ bool ManagementAgent::moveDeletedObjectsLH() { } return !deleteList.empty(); } + +namespace qpid { +namespace management { + +namespace { +QPID_TSS const qpid::broker::ConnectionState* executionContext = 0; +} + +void setManagementExecutionContext(const qpid::broker::ConnectionState* ctxt) +{ + executionContext = ctxt; +} +const qpid::broker::ConnectionState* getManagementExecutionContext() +{ + return executionContext; +} + +}} diff --git a/qpid/cpp/src/qpid/management/ManagementAgent.h b/qpid/cpp/src/qpid/management/ManagementAgent.h index 0db19594a7..fb15dc6ed1 100644 --- a/qpid/cpp/src/qpid/management/ManagementAgent.h +++ b/qpid/cpp/src/qpid/management/ManagementAgent.h @@ -41,6 +41,9 @@ #include namespace qpid { +namespace broker { +class ConnectionState; +} namespace management { class ManagementAgent @@ -422,6 +425,8 @@ private: void debugSnapshot(const char* title); }; +void setManagementExecutionContext(const qpid::broker::ConnectionState*); +const qpid::broker::ConnectionState* getManagementExecutionContext(); }} - + #endif /*!_ManagementAgent_*/ diff --git a/qpid/cpp/src/tests/MessagingFixture.h b/qpid/cpp/src/tests/MessagingFixture.h index 715de09bad..2312a87e9d 100644 --- a/qpid/cpp/src/tests/MessagingFixture.h +++ b/qpid/cpp/src/tests/MessagingFixture.h @@ -27,15 +27,19 @@ #include "qpid/client/Connection.h" #include "qpid/client/Session.h" #include "qpid/framing/Uuid.h" +#include "qpid/messaging/Address.h" #include "qpid/messaging/Connection.h" #include "qpid/messaging/Session.h" #include "qpid/messaging/Sender.h" #include "qpid/messaging/Receiver.h" #include "qpid/messaging/Message.h" +#include "qpid/types/Variant.h" namespace qpid { namespace tests { +using qpid::types::Variant; + struct BrokerAdmin { qpid::client::Connection connection; @@ -223,6 +227,119 @@ inline void receive(messaging::Receiver& receiver, uint count = 1, uint start = } } + +class MethodInvoker +{ + public: + MethodInvoker(messaging::Session& session) : replyTo("#; {create:always, node:{x-declare:{auto-delete:true}}}"), + sender(session.createSender("qmf.default.direct/broker")), + receiver(session.createReceiver(replyTo)) {} + + void createExchange(const std::string& name, const std::string& type, bool durable=false) + { + Variant::Map params; + params["name"]=name; + params["type"]="exchange"; + params["properties"] = Variant::Map(); + params["properties"].asMap()["exchange-type"] = type; + params["properties"].asMap()["durable"] = durable; + methodRequest("create", params); + } + + void deleteExchange(const std::string& name) + { + Variant::Map params; + params["name"]=name; + params["type"]="exchange"; + methodRequest("delete", params); + } + + void createQueue(const std::string& name, bool durable=false, bool autodelete=false, + const Variant::Map& options=Variant::Map()) + { + Variant::Map params; + params["name"]=name; + params["type"]="queue"; + params["properties"] = options; + params["properties"].asMap()["durable"] = durable; + params["properties"].asMap()["auto-delete"] = autodelete; + methodRequest("create", params); + } + + void deleteQueue(const std::string& name) + { + Variant::Map params; + params["name"]=name; + params["type"]="queue"; + methodRequest("delete", params); + } + + void bind(const std::string& exchange, const std::string& queue, const std::string& key, + const Variant::Map& options=Variant::Map()) + { + Variant::Map params; + params["name"]=(boost::format("%1%/%2%/%3%") % (exchange) % (queue) % (key)).str(); + params["type"]="binding"; + params["properties"] = options; + methodRequest("create", params); + } + + void unbind(const std::string& exchange, const std::string& queue, const std::string& key) + { + Variant::Map params; + params["name"]=(boost::format("%1%/%2%/%3%") % (exchange) % (queue) % (key)).str(); + params["type"]="binding"; + methodRequest("delete", params); + } + + void methodRequest(const std::string& method, const Variant::Map& inParams, Variant::Map* outParams = 0) + { + Variant::Map content; + Variant::Map objectId; + objectId["_object_name"] = "org.apache.qpid.broker:broker:amqp-broker"; + content["_object_id"] = objectId; + content["_method_name"] = method; + content["_arguments"] = inParams; + + messaging::Message request; + request.setReplyTo(replyTo); + request.getProperties()["x-amqp-0-10.app-id"] = "qmf2"; + request.getProperties()["qmf.opcode"] = "_method_request"; + encode(content, request); + + sender.send(request); + + messaging::Message response; + if (receiver.fetch(response, messaging::Duration::SECOND*5)) { + if (response.getProperties()["x-amqp-0-10.app-id"] == "qmf2") { + std::string opcode = response.getProperties()["qmf.opcode"]; + if (opcode == "_method_response") { + if (outParams) { + Variant::Map m; + decode(response, m); + *outParams = m["_arguments"].asMap(); + } + } else if (opcode == "_exception") { + Variant::Map m; + decode(response, m); + throw Exception(QPID_MSG("Error: " << m["_values"])); + } else { + throw Exception(QPID_MSG("Invalid response received, unexpected opcode: " << opcode)); + } + } else { + throw Exception(QPID_MSG("Invalid response received, not a qmfv2 message: app-id=" + << response.getProperties()["x-amqp-0-10.app-id"])); + } + } else { + throw Exception(QPID_MSG("No response received")); + } + } + private: + messaging::Address replyTo; + messaging::Sender sender; + messaging::Receiver receiver; +}; + }} // namespace qpid::tests #endif /*!TESTS_MESSAGINGFIXTURE_H*/ diff --git a/qpid/cpp/src/tests/MessagingSessionTests.cpp b/qpid/cpp/src/tests/MessagingSessionTests.cpp index 991ec847bf..f9a8b0e4c1 100644 --- a/qpid/cpp/src/tests/MessagingSessionTests.cpp +++ b/qpid/cpp/src/tests/MessagingSessionTests.cpp @@ -890,6 +890,53 @@ QPID_AUTO_TEST_CASE(testAcknowledge) BOOST_CHECK(!fix.session.createReceiver(fix.queue).fetch(m, Duration::IMMEDIATE)); } +QPID_AUTO_TEST_CASE(testQmfCreateAndDelete) +{ + MessagingFixture fix(Broker::Options(), true/*enable management*/); + MethodInvoker control(fix.session); + control.createQueue("my-queue"); + control.createExchange("my-exchange", "topic"); + control.bind("my-exchange", "my-queue", "subject1"); + + Sender sender = fix.session.createSender("my-exchange"); + Receiver receiver = fix.session.createReceiver("my-queue"); + Message out; + out.setSubject("subject1"); + out.setContent("one"); + sender.send(out); + Message in; + BOOST_CHECK(receiver.fetch(in, Duration::SECOND*5)); + BOOST_CHECK_EQUAL(out.getContent(), in.getContent()); + control.unbind("my-exchange", "my-queue", "subject1"); + control.bind("my-exchange", "my-queue", "subject2"); + + out.setContent("two"); + sender.send(out);//should be dropped + + out.setSubject("subject2"); + out.setContent("three"); + sender.send(out);//should not be dropped + + BOOST_CHECK(receiver.fetch(in, Duration::SECOND*5)); + BOOST_CHECK_EQUAL(out.getContent(), in.getContent()); + BOOST_CHECK(!receiver.fetch(in, Duration::IMMEDIATE)); + sender.close(); + receiver.close(); + + control.deleteExchange("my-exchange"); + messaging::Session other = fix.connection.createSession(); + { + ScopedSuppressLogging sl; + BOOST_CHECK_THROW(other.createSender("my-exchange"), qpid::messaging::NotFound); + } + control.deleteQueue("my-queue"); + other = fix.connection.createSession(); + { + ScopedSuppressLogging sl; + BOOST_CHECK_THROW(other.createReceiver("my-queue"), qpid::messaging::NotFound); + } +} + QPID_AUTO_TEST_SUITE_END() }} // namespace qpid::tests diff --git a/qpid/cpp/src/tests/QueueTest.cpp b/qpid/cpp/src/tests/QueueTest.cpp index 4d63d9bd97..e4e9897195 100644 --- a/qpid/cpp/src/tests/QueueTest.cpp +++ b/qpid/cpp/src/tests/QueueTest.cpp @@ -249,7 +249,7 @@ QPID_AUTO_TEST_CASE(testBound){ exchange2.reset(); //unbind the queue from all exchanges it knows it has been bound to: - queue->unbind(exchanges, queue); + queue->unbind(exchanges); //ensure the remaining exchanges don't still have the queue bound to them: FailOnDeliver deliverable; diff --git a/qpid/cpp/src/tests/qpid-ctrl b/qpid/cpp/src/tests/qpid-ctrl index 7b46c190fb..4246c57898 100755 --- a/qpid/cpp/src/tests/qpid-ctrl +++ b/qpid/cpp/src/tests/qpid-ctrl @@ -92,7 +92,10 @@ try: arguments = {} for a in args: name, val = nameval(a) - arguments[name] = val + if val[0] == '{' or val[0] == '[': + arguments[name] = eval(val) + else: + arguments[name] = val content = { "_object_id": {"_object_name": object_name}, "_method_name": method_name, diff --git a/qpid/cpp/src/tests/sender.cpp b/qpid/cpp/src/tests/sender.cpp index 9850e851da..063b5e87dc 100644 --- a/qpid/cpp/src/tests/sender.cpp +++ b/qpid/cpp/src/tests/sender.cpp @@ -120,7 +120,7 @@ void Sender::execute(AsyncSession& session, bool isRetry) string data; while (getline(std::cin, data)) { message.setData(data); - message.getHeaders().setInt("SN", ++sent); + //message.getHeaders().setInt("SN", ++sent); string matchKey; if (lvqMatchValues && getline(lvqMatchValues, matchKey)) { message.getHeaders().setString(QueueOptions::strLVQMatchProperty, matchKey); diff --git a/qpid/doc/dev-readme/QPID-0.8-Component-README.odg b/qpid/doc/dev-readme/QPID-0.8-Component-README.odg deleted file mode 100644 index 4a5024c330..0000000000 Binary files a/qpid/doc/dev-readme/QPID-0.8-Component-README.odg and /dev/null differ diff --git a/qpid/doc/dev-readme/QPID-0.8-Component-README.pdf b/qpid/doc/dev-readme/QPID-0.8-Component-README.pdf deleted file mode 100644 index 4b3c810081..0000000000 Binary files a/qpid/doc/dev-readme/QPID-0.8-Component-README.pdf and /dev/null differ diff --git a/qpid/doc/dev-readme/QPID-Component-README.odg b/qpid/doc/dev-readme/QPID-Component-README.odg new file mode 100644 index 0000000000..40f2972d88 Binary files /dev/null and b/qpid/doc/dev-readme/QPID-Component-README.odg differ diff --git a/qpid/doc/dev-readme/QPID-Component-README.pdf b/qpid/doc/dev-readme/QPID-Component-README.pdf new file mode 100644 index 0000000000..8863883df9 Binary files /dev/null and b/qpid/doc/dev-readme/QPID-Component-README.pdf differ diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFService.java b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFService.java index c0afae0773..2c8fd737c3 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFService.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/qmf/QMFService.java @@ -712,6 +712,25 @@ public class QMFService implements ConfigStore.ConfigEventListener, Closeable return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); } + public BrokerSchema.BrokerClass.CreateMethodResponseCommand create(final BrokerSchema.BrokerClass.CreateMethodResponseCommandFactory factory, + final String type, + final String name, + final Map properties, + final java.lang.Boolean lenient) + { + //TODO: + return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); + } + + public BrokerSchema.BrokerClass.DeleteMethodResponseCommand delete(final BrokerSchema.BrokerClass.DeleteMethodResponseCommandFactory factory, + final String type, + final String name, + final Map options) + { + //TODO: + return factory.createResponseCommand(CompletionCode.NOT_IMPLEMENTED); + } + public UUID getId() { return _obj.getId(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/actors/CurrentActor.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/actors/CurrentActor.java index 3d31a705fe..2ebbfeb734 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/actors/CurrentActor.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/actors/CurrentActor.java @@ -21,9 +21,6 @@ package org.apache.qpid.server.logging.actors; import org.apache.qpid.server.logging.LogActor; -import org.apache.qpid.server.logging.LogSubject; -import org.apache.qpid.server.logging.LogMessage; -import org.apache.qpid.server.logging.RootMessageLogger; import java.util.EmptyStackException; import java.util.Stack; @@ -72,7 +69,7 @@ public class CurrentActor private static LogActor _defaultActor; /** - * Set a new LogActor to be the Current Actor + * Set a new {@link LogActor} to be the Current Actor *

* This pushes the Actor in to the LIFO Queue * @@ -85,7 +82,16 @@ public class CurrentActor } /** - * Remove the current LogActor. + * Remove all {@link LogActor}s + */ + public static void removeAll() + { + Stack stack = _currentActor.get(); + stack.clear(); + } + + /** + * Remove the current {@link LogActor}. *

* Calling remove without calling set will result in an EmptyStackException. */ @@ -96,9 +102,7 @@ public class CurrentActor } /** - * Return the current head of the list of LogActors. - *

- * If there has been no set call then this will return Null. + * Return the current head of the list of {@link LogActor}s. * * @return Current LogActor */ diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java index 595822173f..925b161118 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java @@ -149,10 +149,7 @@ public class InternalBrokerBaseCase extends QpidTestCase { super.tearDown(); // Purge Any erroneously added actors - while (CurrentActor.get() != null) - { - CurrentActor.remove(); - } + CurrentActor.removeAll(); } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java index 4b4417b6ef..b0bd8f8e97 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.CountDownLatch; import javax.jms.ExceptionListener; import javax.jms.JMSException; @@ -211,15 +212,13 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec public void resubscribeSessions() throws JMSException, AMQException, FailoverException { List sessions = new ArrayList(_conn.getSessions().values()); - _logger.info(String.format("Resubscribing sessions = %s sessions.size=%s", sessions, sessions.size())); + _logger.info(String.format("Resubscribing sessions = %s sessions.size=%d", sessions, sessions.size())); for (AMQSession s : sessions) { - ((AMQSession_0_10) s)._qpidConnection = _qpidConnection; s.resubscribe(); } } - public void closeConnection(long timeout) throws JMSException, AMQException { try @@ -257,12 +256,14 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec ConnectionClose close = exc.getClose(); if (close == null) { + _conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1)); + try { if (_conn.firePreFailover(false) && _conn.attemptReconnection()) { _conn.failoverPrep(); - _qpidConnection.resume(); + _conn.resubscribeSessions(); _conn.fireFailoverComplete(); return; } @@ -271,6 +272,11 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec { _logger.error("error during failover", e); } + finally + { + _conn.getProtocolHandler().getFailoverLatch().countDown(); + _conn.getProtocolHandler().setFailoverLatch(null); + } } ExceptionListener listener = _conn._exceptionListener; diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java index 1eaccf53fc..517a7a5ce8 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java @@ -892,14 +892,6 @@ public class AMQSession_0_10 extends AMQSession _destinationCache = Collections.synchronizedMap(new ReferenceMap()); + private static final Map> _destinationCache = Collections.synchronizedMap(new HashMap>()); public static final String JMS_TYPE = "x-jms-type"; @@ -229,22 +229,19 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate } else { - Destination dest = _destinationCache.get(replyTo); + Destination dest = null; + SoftReference ref = _destinationCache.get(replyTo); + if (ref != null) + { + dest = ref.get(); + } if (dest == null) { String exchange = replyTo.getExchange(); String routingKey = replyTo.getRoutingKey(); - dest = generateDestination(exchange == null ? new AMQShortString("") : - new AMQShortString(exchange), - routingKey == null ? new AMQShortString(""): - new AMQShortString(routingKey)); - - - - - - _destinationCache.put(replyTo, dest); + dest = generateDestination(new AMQShortString(exchange), new AMQShortString(routingKey)); + _destinationCache.put(replyTo, new SoftReference(dest)); } return dest; @@ -291,7 +288,7 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate } final ReplyTo replyTo = new ReplyTo(amqd.getExchangeName().toString(), amqd.getRoutingKey().toString()); - _destinationCache.put(replyTo, destination); + _destinationCache.put(replyTo, new SoftReference(destination)); _messageProps.setReplyTo(replyTo); } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Binary.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Binary.java index 4e97855a6f..491a7ac218 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Binary.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/Binary.java @@ -142,4 +142,13 @@ public final class Binary return str(ByteBuffer.wrap(bytes, offset, size)); } + public boolean hasExcessCapacity() + { + return size != bytes.length; + } + + public Binary copy() + { + return new Binary(getBytes()); + } } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java index b8e7616a37..f21df251da 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java @@ -35,9 +35,7 @@ import org.slf4j.LoggerFactory; /** * ServerDelegate - * */ - public class ServerDelegate extends ConnectionDelegate { protected static final Logger _logger = LoggerFactory.getLogger(ServerDelegate.class); @@ -140,12 +138,12 @@ public class ServerDelegate extends ConnectionDelegate protected int getHeartbeatMax() { - return Integer.MAX_VALUE; + return 0xFFFF; } protected int getChannelMax() { - return Integer.MAX_VALUE; + return 0xFFFF; } @Override @@ -202,5 +200,4 @@ public class ServerDelegate extends ConnectionDelegate ssn.sessionAttached(atc.getName()); ssn.setState(Session.State.OPEN); } - } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java index a8a4997ae7..09ce6a7eb1 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java @@ -143,10 +143,18 @@ abstract class AbstractDecoder implements Decoder short size = readUint8(); Binary bin = get(size); String str = str8cache.get(bin); + if (str == null) { str = decode(bin.array(), bin.offset(), bin.size(), "UTF-8"); - str8cache.put(bin, str); + if(bin.hasExcessCapacity()) + { + str8cache.put(bin.copy(), str); + } + else + { + str8cache.put(bin, str); + } } return str; } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java index 6f7a2fa3b2..10f67e1cd6 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/BBDecoder.java @@ -41,6 +41,11 @@ public final class BBDecoder extends AbstractDecoder this.in.order(ByteOrder.BIG_ENDIAN); } + public void releaseBuffer() + { + in = null; + } + protected byte doGet() { return in.get(); diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Assembler.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Assembler.java index 357caa26e1..1a85ab88a5 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Assembler.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Assembler.java @@ -20,38 +20,36 @@ */ package org.apache.qpid.transport.network; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.nio.ByteBuffer; - -import org.apache.qpid.transport.codec.BBDecoder; -import org.apache.qpid.transport.codec.Decoder; - import org.apache.qpid.transport.Header; import org.apache.qpid.transport.Method; import org.apache.qpid.transport.ProtocolError; import org.apache.qpid.transport.ProtocolEvent; import org.apache.qpid.transport.ProtocolHeader; import org.apache.qpid.transport.Receiver; -import org.apache.qpid.transport.SegmentType; import org.apache.qpid.transport.Struct; - +import org.apache.qpid.transport.codec.BBDecoder; /** * Assembler * */ - public class Assembler implements Receiver, NetworkDelegate { + // Use a small array to store incomplete Methods for low-value channels, instead of allocating a huge + // array or always boxing the channelId and looking it up in the map. This value must be of the form 2^X - 1. + private static final int ARRAY_SIZE = 0xFF; + private final Method[] _incompleteMethodArray = new Method[ARRAY_SIZE + 1]; + private final Map _incompleteMethodMap = new HashMap(); private final Receiver receiver; private final Map> segments; - private final Method[] incomplete; - private final ThreadLocal decoder = new ThreadLocal() + private static final ThreadLocal _decoder = new ThreadLocal() { public BBDecoder initialValue() { @@ -63,7 +61,6 @@ public class Assembler implements Receiver, NetworkDelegate { this.receiver = receiver; segments = new HashMap>(); - incomplete = new Method[64*1024]; } private int segmentKey(Frame frame) @@ -169,7 +166,7 @@ public class Assembler implements Receiver, NetworkDelegate private void assemble(Frame frame, ByteBuffer segment) { - BBDecoder dec = decoder.get(); + BBDecoder dec = _decoder.get(); dec.init(segment); int channel = frame.getChannel(); @@ -192,7 +189,7 @@ public class Assembler implements Receiver, NetworkDelegate command.read(dec); if (command.hasPayload()) { - incomplete[channel] = command; + setIncompleteCommand(channel, command); } else { @@ -200,8 +197,8 @@ public class Assembler implements Receiver, NetworkDelegate } break; case HEADER: - command = incomplete[channel]; - List structs = new ArrayList(2); + command = getIncompleteCommand(channel); + List structs = new ArrayList(2); while (dec.hasRemaining()) { structs.add(dec.readStruct32()); @@ -209,19 +206,51 @@ public class Assembler implements Receiver, NetworkDelegate command.setHeader(new Header(structs)); if (frame.isLastSegment()) { - incomplete[channel] = null; + setIncompleteCommand(channel, null); emit(channel, command); } break; case BODY: - command = incomplete[channel]; + command = getIncompleteCommand(channel); command.setBody(segment); - incomplete[channel] = null; + setIncompleteCommand(channel, null); emit(channel, command); break; default: throw new IllegalStateException("unknown frame type: " + frame.getType()); } + + dec.releaseBuffer(); } + private void setIncompleteCommand(int channelId, Method incomplete) + { + if ((channelId & ARRAY_SIZE) == channelId) + { + _incompleteMethodArray[channelId] = incomplete; + } + else + { + if(incomplete != null) + { + _incompleteMethodMap.put(channelId, incomplete); + } + else + { + _incompleteMethodMap.remove(channelId); + } + } + } + + private Method getIncompleteCommand(int channelId) + { + if ((channelId & ARRAY_SIZE) == channelId) + { + return _incompleteMethodArray[channelId]; + } + else + { + return _incompleteMethodMap.get(channelId); + } + } } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java index ab174b00b3..685034d1a9 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java @@ -40,21 +40,15 @@ import static java.lang.Math.min; import java.nio.ByteBuffer; import java.nio.ByteOrder; - /** * Disassembler - * */ - -public final class Disassembler implements Sender, - ProtocolDelegate +public final class Disassembler implements Sender, ProtocolDelegate { - private final Sender sender; private final int maxPayload; - private final ByteBuffer header; private final Object sendlock = new Object(); - private final ThreadLocal encoder = new ThreadLocal() + private final static ThreadLocal _encoder = new ThreadLocal() { public BBEncoder initialValue() { @@ -66,14 +60,10 @@ public final class Disassembler implements Sender, { if (maxFrame <= HEADER_SIZE || maxFrame >= 64*1024) { - throw new IllegalArgumentException - ("maxFrame must be > HEADER_SIZE and < 64K: " + maxFrame); + throw new IllegalArgumentException("maxFrame must be > HEADER_SIZE and < 64K: " + maxFrame); } this.sender = sender; this.maxPayload = maxFrame - HEADER_SIZE; - this.header = ByteBuffer.allocate(HEADER_SIZE); - this.header.order(ByteOrder.BIG_ENDIAN); - } public void send(ProtocolEvent event) @@ -101,25 +91,27 @@ public final class Disassembler implements Sender, { synchronized (sendlock) { - header.put(0, flags); - header.put(1, type); - header.putShort(2, (short) (size + HEADER_SIZE)); - header.put(5, track); - header.putShort(6, (short) channel); - - header.rewind(); - - sender.send(header); + ByteBuffer data = ByteBuffer.allocate(size + HEADER_SIZE); + data.order(ByteOrder.BIG_ENDIAN); + + data.put(0, flags); + data.put(1, type); + data.putShort(2, (short) (size + HEADER_SIZE)); + data.put(5, track); + data.putShort(6, (short) channel); + data.position(HEADER_SIZE); int limit = buf.limit(); buf.limit(buf.position() + size); - sender.send(buf); + data.put(buf); buf.limit(limit); + + data.rewind(); + sender.send(data); } } - private void fragment(byte flags, SegmentType type, ProtocolEvent event, - ByteBuffer buf) + private void fragment(byte flags, SegmentType type, ProtocolEvent event, ByteBuffer buf) { byte typeb = (byte) type.getValue(); byte track = event.getEncodedTrack() == Frame.L4 ? (byte) 1 : (byte) 0; @@ -170,17 +162,9 @@ public final class Disassembler implements Sender, method(method, SegmentType.COMMAND); } - private ByteBuffer copy(ByteBuffer src) - { - ByteBuffer buf = ByteBuffer.allocate(src.remaining()); - buf.put(src); - buf.flip(); - return buf; - } - private void method(Method method, SegmentType type) { - BBEncoder enc = encoder.get(); + BBEncoder enc = _encoder.get(); enc.init(); enc.writeUint16(method.getEncodedType()); if (type == SegmentType.COMMAND) @@ -227,8 +211,7 @@ public final class Disassembler implements Sender, if (payload) { ByteBuffer body = method.getBody(); - fragment(body == null ? LAST_SEG : 0x0, SegmentType.HEADER, - method, headerSeg); + fragment(body == null ? LAST_SEG : 0x0, SegmentType.HEADER, method, headerSeg); if (body != null) { fragment(LAST_SEG, SegmentType.BODY, method, body); @@ -240,7 +223,7 @@ public final class Disassembler implements Sender, public void error(Void v, ProtocolError error) { - throw new IllegalArgumentException("" + error); + throw new IllegalArgumentException(String.valueOf(error)); } public void setIdleTimeout(int i) diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java index 6211dd8e70..74f50e8659 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java @@ -21,30 +21,18 @@ package org.apache.qpid.server.queue; -import junit.framework.TestCase; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; - -import org.apache.qpid.AMQException; -import org.apache.qpid.client.AMQDestination; -import org.apache.qpid.client.AMQSession; -import org.apache.qpid.client.transport.TransportConnection; -import org.apache.qpid.jndi.PropertiesFileInitialContextFactory; -import org.apache.qpid.server.registry.ApplicationRegistry; -import org.apache.qpid.server.util.InternalBrokerBaseCase; - import javax.jms.Connection; -import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.spi.InitialContextFactory; -import java.util.Hashtable; + +import org.apache.qpid.AMQException; +import org.apache.qpid.client.AMQDestination; +import org.apache.qpid.client.AMQSession; +import org.apache.qpid.test.utils.QpidBrokerTestCase; /** * Test Case to ensure that messages are correctly returned. @@ -52,19 +40,12 @@ import java.util.Hashtable; * - The message is returned. * - The broker doesn't leak memory. * - The broker's state is correct after test. - * - * Why is this hardcoded to InVM testing, should be converted to QTC. */ -public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase +public class QueueDepthWithSelectorTest extends QpidBrokerTestCase { - protected static final Logger _logger = Logger.getLogger(QueueDepthWithSelectorTest.class); - - protected final String BROKER = "vm://:"+ApplicationRegistry.DEFAULT_INSTANCE; protected final String VHOST = "test"; protected final String QUEUE = this.getClass().getName(); - protected Context _context; - protected Connection _clientConnection; protected Connection _producerConnection; private Session _clientSession; @@ -82,47 +63,21 @@ public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase public void setUp() throws Exception { super.setUp(); - TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); - - System.err.println("amqj.logging.level:" + System.getProperty("amqj.logging.level")); - System.err.println("_logger.level:" + _logger.getLevel()); - System.err.println("_logger.isE-Error:" + _logger.isEnabledFor(Level.ERROR)); - System.err.println("_logger.isE-Warn:" + _logger.isEnabledFor(Level.WARN)); - System.err.println("_logger.isInfo:" + _logger.isInfoEnabled() + ":" + _logger.isEnabledFor(Level.INFO)); - System.err.println("_logger.isDebug:" + _logger.isDebugEnabled() + ":" + _logger.isEnabledFor(Level.DEBUG)); - System.err.println("_logger.isTrace:" + _logger.isTraceEnabled() + ":" + _logger.isEnabledFor(Level.TRACE)); - - System.err.println(Logger.getRootLogger().getLoggerRepository()); - - InitialContextFactory factory = new PropertiesFileInitialContextFactory(); - - Hashtable env = new Hashtable(); - - env.put("connectionfactory.connection", "amqp://guest:guest@TTL_TEST_ID/" + VHOST + "?brokerlist='" + BROKER + "'"); - env.put("queue.queue", QUEUE); - - _context = factory.getInitialContext(env); _messages = new Message[MSG_COUNT]; - _queue = (Queue) _context.lookup("queue"); - init(); - } - - @Override - public void tearDown() throws Exception - { - if (_producerConnection != null) - { - _producerConnection.close(); - } - - if (_clientConnection != null) - { - _clientConnection.close(); - } + _queue = getTestQueue(); + + //Create Producer + _producerConnection = getConnection(); + _producerConnection.start(); + _producerSession = _producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); + _producer = _producerSession.createProducer(_queue); - TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); - super.tearDown(); + // Create consumer + _clientConnection = getConnection(); + _clientConnection.start(); + _clientSession = _clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); + _consumer = _clientSession.createConsumer(_queue, "key = 23"); } public void test() throws Exception @@ -139,7 +94,8 @@ public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase //Verify we get all the messages. _logger.info("Verifying messages"); - verifyAllMessagesRecevied(0); + verifyAllMessagesRecevied(50); + verifyBrokerState(0); //Close the connection.. .giving the broker time to clean up its state. _clientConnection.close(); @@ -149,39 +105,18 @@ public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase verifyBrokerState(0); } - protected void init() throws NamingException, JMSException, AMQException - { - //Create Producer - _producerConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection(); - _producerConnection.start(); - _producerSession = _producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - _producer = _producerSession.createProducer(_queue); - - // Create consumer - _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection(); - _clientConnection.start(); - _clientSession = _clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - _consumer = _clientSession.createConsumer(_queue, "key = 23"); - } - protected void verifyBrokerState(int expectedDepth) { try { - _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection(); - - _clientSession = _clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - } - catch (Exception e) - { - fail(e.getMessage()); - } + Connection connection = getConnection(); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - try - { Thread.sleep(2000); - long queueDepth = ((AMQSession) _clientSession).getQueueDepth((AMQDestination) _queue); + long queueDepth = ((AMQSession) session).getQueueDepth((AMQDestination) _queue); assertEquals("Session reports Queue depth not as expected", expectedDepth, queueDepth); + + connection.close(); } catch (InterruptedException e) { @@ -191,34 +126,22 @@ public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase { fail(e.getMessage()); } - finally + catch (Exception e) { - try - { - _clientConnection.close(); - } - catch (JMSException e) - { - fail(e.getMessage()); - } + fail(e.getMessage()); } - } protected void verifyAllMessagesRecevied(int expectedDepth) throws Exception { - boolean[] msgIdRecevied = new boolean[MSG_COUNT]; - for (int i = 0; i < MSG_COUNT; i++) + for (int i = 0; i < expectedDepth; i++) { _messages[i] = _consumer.receive(1000); assertNotNull("should have received a message but didn't", _messages[i]); } - - long queueDepth = ((AMQSession) _clientSession).getQueueDepth((AMQDestination) _queue); - assertEquals("Session reports Queue depth not as expected", expectedDepth, queueDepth); - + //Check received messages int msgId = 0; for (Message msg : _messages) @@ -231,7 +154,7 @@ public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase } //Check all received - for (msgId = 0; msgId < MSG_COUNT; msgId++) + for (msgId = 0; msgId < expectedDepth; msgId++) { assertTrue("Message " + msgId + " not received.", msgIdRecevied[msgId]); } @@ -241,9 +164,6 @@ public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase * Get the next message putting the given count into the intProperties as ID. * * @param msgNo the message count to store as ID. - * - * @return - * * @throws JMSException */ protected Message nextMessage(int msgNo) throws JMSException @@ -253,5 +173,4 @@ public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase send.setIntProperty("key", 23); return send; } - } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java index f54b022c09..97d825177c 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java @@ -20,8 +20,8 @@ */ package org.apache.qpid.test.client; -import org.apache.log4j.Logger; import org.apache.qpid.AMQException; +import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.AMQSession; import org.apache.qpid.test.utils.FailoverBaseCase; @@ -41,8 +41,6 @@ import java.util.Random; public class QueueBrowserAutoAckTest extends FailoverBaseCase { - private static final Logger _logger = Logger.getLogger(QueueBrowserAutoAckTest.class); - protected Connection _clientConnection; protected Session _clientSession; protected Queue _queue; @@ -53,10 +51,8 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase { super.setUp(); - //Create Client _clientConnection = getConnection(); - _clientConnection.start(); setupSession(); @@ -395,7 +391,6 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase closeBrowserBeforeAfterGetNext(10); validate(messages); - } /** @@ -454,19 +449,15 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase { int messages = 5; - sendMessages("connection1", messages); if (!CLUSTERED) { sendMessages("connection2", messages); } - checkQueueDepth(messages); - _logger.info("Creating Queue Browser"); - QueueBrowser queueBrowser = _clientSession.createBrowser(_queue); long queueDepth = 0; @@ -477,19 +468,17 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase } catch (AMQException e) { + fail("Caught exception getting queue depth: " + e.getMessage()); } assertEquals("Session reports Queue depth not as expected", messages, queueDepth); - int msgCount = 0; - int failPoint = 0; failPoint = new Random().nextInt(messages) + 1; Enumeration msgs = queueBrowser.getEnumeration(); - while (msgs.hasMoreElements()) { msgs.nextElement(); @@ -536,5 +525,4 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase //Validate all messages still on Broker 1 validate(messages); } - } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java index 81089a4dfc..fe929b4965 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/UTF8Test.java @@ -34,9 +34,8 @@ import java.io.*; /** - * @author Apache Software Foundation - * This test makes sure that utf8 characters can be used for - * specifying exchange, queue name and routing key. + * This test makes sure that utf8 characters can be used for + * specifying exchange, queue name and routing key. * * those tests are related to qpid-1384 */ @@ -44,7 +43,6 @@ public class UTF8Test extends QpidBrokerTestCase { private static final Logger _logger = LoggerFactory.getLogger(UTF8Test.class); - public void testPlainEn() throws Exception { invoke("UTF8En"); @@ -56,7 +54,6 @@ public class UTF8Test extends QpidBrokerTestCase invoke("UTF8Jp"); } - private void invoke(String name) throws Exception { String path = System.getProperties().getProperty("QPID_HOME"); @@ -65,6 +62,7 @@ public class UTF8Test extends QpidBrokerTestCase runTest(in.readLine(), in.readLine(), in.readLine(), in.readLine()); in.close(); } + private void runTest(String exchangeName, String queueName, String routingKey, String data) throws Exception { _logger.info("Running test for exchange: " + exchangeName @@ -89,26 +87,17 @@ public class UTF8Test extends QpidBrokerTestCase private void declareQueue(String exch, String routkey, String qname) throws Exception { - Connection conn = new Connection(); - if (!_broker.equals(QpidBrokerTestCase.EXTERNAL) && !isBroker08()) - { - conn.connect("localhost", QpidBrokerTestCase.DEFAULT_PORT, "test", "guest", "guest",false); - } - else - { - throw new Exception("unsupported test " + - "configuration. broker: " + _broker + " version > 0.10 "+ !isBroker08() + " This test must be run on a local broker using protocol 0.10 or higher."); - } - Session sess = conn.createSession(0); - sess.exchangeDeclare(exch, "direct", null, null); - sess.queueDeclare(qname, null, null); - sess.exchangeBind(qname, exch, routkey, null); - sess.sync(); - conn.close(); + Connection conn = new Connection(); + conn.connect("localhost", QpidBrokerTestCase.DEFAULT_PORT, "test", "guest", "guest",false); + Session sess = conn.createSession(0); + sess.exchangeDeclare(exch, "direct", null, null); + sess.queueDeclare(qname, null, null); + sess.exchangeBind(qname, exch, routkey, null); + sess.sync(); + conn.close(); } - private Destination getDestination(String exch, String routkey, String qname) - throws Exception + private Destination getDestination(String exch, String routkey, String qname) throws Exception { Properties props = new Properties(); props.setProperty("destination.directUTF8Queue", diff --git a/qpid/packaging/windows/INSTALL_NOTES.html b/qpid/packaging/windows/INSTALL_NOTES.html index 0eda0aa2fe..4aecce697a 100644 --- a/qpid/packaging/windows/INSTALL_NOTES.html +++ b/qpid/packaging/windows/INSTALL_NOTES.html @@ -1,11 +1,11 @@ -Apache Qpid C++ 0.6 Installation Notes +Apache Qpid C++ 0.9 Installation Notes -

Apache Qpid C++ 0.6 Installation Notes

+

Apache Qpid C++ 0.9 Installation Notes

-

Thank you for installing the Apache Qpid version 0.6 for Windows kit. +

Thank you for installing Apache Qpid version 0.9 for Windows. If the requisite features were installed, you can now run a broker, use the example programs, and design your own messaging programs while reading the Qpid C++ API reference documentation.

@@ -20,11 +20,10 @@ on the same system as the client, but it must be reachable using TCP/IP.

The broker executable is installed in the bin subdirectory of your Qpid installation directory. The broker program is -qpidd.exe. The simplest way to experiment with the -broker is to open a command prompt window, cd to the installation -directory, and execute the broker: +qpidd.exe. The installation procedure adds the Qpid bin +directory to the PATH environment variable, so the simplest way to experiment +with the broker is to open a command prompt window and execute the broker:

-cd "C:\Program Files\Apache\qpidc-0.6\bin"
 qpidd
 
A small amount of information will be displayed to let you know the broker @@ -65,60 +64,24 @@ channel (C++ Broker Compatible)."

Notes

Please read the following sections for important notes regarding this release.

-

WCF Channel

-

This release includes a new .NET WCF Channel implementation. The WCF DLL -is named Apache.Qpid.Channel.dll located in the bin -directory under the Qpid installation location.

-

WCF Channel programming examples are located in the -examples\Channel under the installation directory.

-

The WCF Channel DLLs are not loaded into the Global Assembly Cache (GAC) -at install time; therefore, they must be referenced explicitly from the install -location.

-

If you wish to install the WCF Channel DLLs into the GAC, you can use the -following commands (assuming the Qpid install location is -C:\Program Files\Apache\qpidc-0.6):

-
-gacutil -I "C:\Program Files\Apache\qpidc-0.6\bin\Apache.Qpid.Channel.dll"
-gacutil -I "C:\Program Files\Apache\qpidc-0.6\bin\Apache.Qpid.Interop.dll"
-
-

To remove the DLLs from the GAC:

-
-gacutil /u "Apache.Qpid.Channel"
-gacutil /u "Apache.Qpid.Interop"
-
-To use transactions with the WCF channel, you must enable the Microsoft Distributed Transaction Coordinator service and configure it to find and use the Qpid XA transaction module. -
    -
  • -Update the PATH environment variable for services: -right click Computer, select Properties > Advanced System -Settings > Environment Variables > System Variables and add -"C:\Program Files\Apache\qpidc-0.6\bin" to the PATH variable. -
  • -Following the instructions in - -http://support.microsoft.com/kb/817066, -update the MSDTC security settings to allow XA transactions, and -create an XADLL registry entry for "qpidxarm" with string (REG_SZ) -value "C:\Program Files\Apache\qpidc-0.6\bin\qpidxarm.dll" -
  • -Open Control Panel > Administrative Tools > Services and start -(or restart) the DTC service and make sure that the DTC service is set -to start automatically when the system reboots. -
-

Broker Persistence Module

-

This release includes a new persistence module. The broker can use this +

CLFS-Based Broker Persistence Module

+

This release includes a second persistence module. The broker can use this module to facilitate durable queues, exchanges, bindings, configuration, and -messages. The persistence module uses SQL Server Express (or SQL Server) 2005 -or newer. The persistence module is a Qpid broker plugin. It is not loaded by +messages. The new persistence module, like the SQL-based store introduced in +Qpid 0.6, uses SQL Server Express (or SQL Server) 2005 or newer. However, it +also used Common Log File System (CLFS) to store message and transaction-related +information. CLFS and, thus, the new store, is available on Windows Vista and +Server 2005 and newer. +The persistence module is a Qpid broker plugin. It is not loaded by default; therefore, to gain support for durable items the persistence plugin must be loaded into the broker. This can be done using the ---module-dir option to load all available plugins. For example: +--load-module option to load the needed plugins. For example:

-cd "C:\Program Files\Apache\qpidc-0.6"
-bin\qpidd.exe --module-dir plugins\broker
+cd "C:\Program Files\Apache\qpidc-0.9"
+qpidd.exe --load-module plugins\broker\store.dll --load-module plugins\broker\msclfs_store.dll
 
-The --module-dir option can also take a full path. The option +The --load-module option can also take a full path. The option can also be included in the broker configuration file. A sample is located in the conf\qpidd.conf file under the installation directory.

diff --git a/qpid/packaging/windows/installer.proj b/qpid/packaging/windows/installer.proj index de68b05626..7be5fda472 100644 --- a/qpid/packaging/windows/installer.proj +++ b/qpid/packaging/windows/installer.proj @@ -45,6 +45,7 @@ %22Visual Studio 9 2008 Win64%22 x64 x64 + x64 @@ -53,23 +54,32 @@ %22Visual Studio 9 2008%22 x86 Win32 + Win32 + + + + + + + + @@ -82,6 +92,20 @@ Exclude="$(source_root)\wcf\samples\**\.svn\**"/> + + + + + + + + + + + + + + @@ -142,13 +166,22 @@ + + + + + + DependsOnTargets="BuildCpp;BuildCppDebug;BuildWcf;BuildDocs;BuildDotNetBindings"> + + @@ -178,9 +217,9 @@ OutputFile="boost_dlls.wxs" /> + OutputFile="qpidc-0.9-x64.msi" /> --> @@ -194,9 +233,9 @@ + Command="candle -dqpidc_version=0.9 -dProgramFiles=$(ProgramFiles) -dstaging_dir=$(staging_dir) -dqpid_headers_dir=$(staging_dir)\include\qpid -dboost_headers_dir=$(staging_dir)\include\boost -dboost_dll_dir=$(staging_dir)\bin\boost -dexamples_dir=$(staging_dir)\examples -dapi_docs_dir=$(staging_dir)\docs\api -ext WiXNetFxExtension qpidc.wxs qpid_headers.wxs boost_headers.wxs boost_dlls.wxs examples.wxs api_docs.wxs -arch $(Architecture)" /> + Command="light -ext WiXNetFxExtension -ext WixUtilExtension -ext WixUIExtension -cultures:en-us -out qpidc-0.9-$(Architecture).msi qpidc.wixobj qpid_headers.wixobj boost_headers.wixobj boost_dlls.wixobj examples.wixobj api_docs.wixobj" /> diff --git a/qpid/packaging/windows/qpidc.wxs b/qpid/packaging/windows/qpidc.wxs index 924e92d20f..8e73ea0661 100644 --- a/qpid/packaging/windows/qpidc.wxs +++ b/qpid/packaging/windows/qpidc.wxs @@ -20,30 +20,39 @@ --> - - + + + UpgradeCode="{94677A0C-606C-49d8-BB63-DF2F6F6D780F}"> + + + + + - + + + @@ -62,6 +71,35 @@ + + + + + + + + + + + + + + + + + + + + @@ -81,15 +119,22 @@ - - + + + + + + + + + + @@ -100,9 +145,45 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -119,6 +200,18 @@ + + + + + + + + + + + + @@ -129,10 +222,19 @@ - + + + + + + + = 502)]]> + + + @@ -152,23 +254,44 @@ + + + + + + + + + + + + + + + + - + + + + + diff --git a/qpid/specs/management-schema.xml b/qpid/specs/management-schema.xml index 303668eb36..e52e3f23cf 100644 --- a/qpid/specs/management-schema.xml +++ b/qpid/specs/management-schema.xml @@ -102,6 +102,19 @@ + + + + + + + + + + + + +