From a6e5e1fa9e750c8667cabfb752f0d5174eba70a5 Mon Sep 17 00:00:00 2001 From: "Charles E. Rolke" Date: Wed, 15 Jan 2014 19:41:38 +0000 Subject: QPID-5481: Messaging API Update - r1460198 QPID-4586 Receiver and Sender 'Address getAddress()' added git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1558549 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp | 41 +++++++++++++++++++++++++ qpid/cpp/bindings/qpid/dotnet/src/Receiver.h | 7 +++++ qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp | 42 ++++++++++++++++++++++++++ qpid/cpp/bindings/qpid/dotnet/src/Sender.h | 7 +++++ 4 files changed, 97 insertions(+) (limited to 'qpid/cpp/bindings') diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp index 5dbc83dcbf..2d6b2f56c3 100644 --- a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp +++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp @@ -29,6 +29,7 @@ #include "qpid/messaging/exceptions.h" #include "Receiver.h" +#include "Address.h" #include "Session.h" #include "Message.h" #include "Duration.h" @@ -374,4 +375,44 @@ namespace Messaging { throw newException; } } + + Org::Apache::Qpid::Messaging::Address ^ Receiver::GetAddress() + { + msclr::lock lk(privateLock); + ThrowIfDisposed(); + + System::Exception ^ newException = nullptr; + Messaging::Address ^ newAddress = nullptr; + + try + { + // fetch unmanaged Address + ::qpid::messaging::Address addr = + nativeObjPtr->getAddress(); + + // create a managed Address + newAddress = gcnew Address(addr); + } + catch (const ::qpid::types::Exception & error) + { + String ^ errmsg = gcnew String(error.what()); + newException = gcnew QpidException(errmsg); + } + finally + { + if (newException != nullptr) + { + if (newAddress != nullptr) + { + delete newAddress; + } + } + } + if (newException != nullptr) + { + throw newException; + } + + return newAddress; + } }}}} diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h index 77b361851e..c38590c1b0 100644 --- a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h +++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h @@ -25,6 +25,7 @@ #include #include "qpid/messaging/Receiver.h" +#include "qpid/messaging/Address.h" #include "qpid/messaging/Session.h" #include "qpid/messaging/Message.h" #include "qpid/messaging/Duration.h" @@ -44,6 +45,7 @@ namespace Messaging { /// Receiver is a managed wrapper for a ::qpid::messaging::Receiver /// + ref class Address; ref class Session; ref class Message; ref class Duration; @@ -232,5 +234,10 @@ namespace Messaging { return parentSession; } } + + // + // Address + // + Org::Apache::Qpid::Messaging::Address ^ GetAddress(); }; }}}} diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp index 8600d0fd8c..3d863eb7c7 100644 --- a/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp +++ b/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp @@ -23,11 +23,13 @@ #include #include +#include "qpid/messaging/Address.h" #include "qpid/messaging/Sender.h" #include "qpid/messaging/Session.h" #include "qpid/messaging/Message.h" #include "Sender.h" +#include "Address.h" #include "Message.h" #include "QpidException.h" @@ -199,4 +201,44 @@ namespace Messaging { throw newException; } } + + Org::Apache::Qpid::Messaging::Address ^ Sender::GetAddress() + { + msclr::lock lk(privateLock); + ThrowIfDisposed(); + + System::Exception ^ newException = nullptr; + Messaging::Address ^ newAddress = nullptr; + + try + { + // fetch unmanaged Address + ::qpid::messaging::Address addr = + nativeObjPtr->getAddress(); + + // create a managed Address + newAddress = gcnew Address(addr); + } + catch (const ::qpid::types::Exception & error) + { + String ^ errmsg = gcnew String(error.what()); + newException = gcnew QpidException(errmsg); + } + finally + { + if (newException != nullptr) + { + if (newAddress != nullptr) + { + delete newAddress; + } + } + } + if (newException != nullptr) + { + throw newException; + } + + return newAddress; + } }}}} diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Sender.h b/qpid/cpp/bindings/qpid/dotnet/src/Sender.h index 0d477b795f..3ecc615608 100644 --- a/qpid/cpp/bindings/qpid/dotnet/src/Sender.h +++ b/qpid/cpp/bindings/qpid/dotnet/src/Sender.h @@ -25,6 +25,7 @@ #include #include "qpid/messaging/Sender.h" +#include "qpid/messaging/Address.h" #include "qpid/messaging/Session.h" #include "qpid/messaging/Message.h" @@ -43,6 +44,7 @@ namespace Messaging { /// Sender is a managed wrapper for a ::qpid::messaging::Sender /// + ref class Address; ref class Session; ref class Message; @@ -188,5 +190,10 @@ namespace Messaging { return parentSession; } } + + // + // Address + // + Org::Apache::Qpid::Messaging::Address ^ GetAddress(); }; }}}} -- cgit v1.2.1