summaryrefslogtreecommitdiff
path: root/qpid/cpp/bindings/qpid/dotnet/src
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/bindings/qpid/dotnet/src')
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Address.cpp252
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Address.h180
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/AssemblyInfo.cpp57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp381
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Connection.h120
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Duration.cpp107
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Duration.h115
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp82
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h64
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Message.cpp617
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Message.h369
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/QpidException.h42
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/QpidMarshal.h65
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/QpidTypeCheck.h86
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/ReadMe.txt40
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp323
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Receiver.h188
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp182
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Sender.h135
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Session.cpp635
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/Session.h156
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp455
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/TypeTranslator.h71
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/app.rc82
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.template.rc120
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj644
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/qpid.snkbin0 -> 596 bytes
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/resource1.h34
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/Properties/sessionreceiver-AssemblyInfo-template.cs55
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj133
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/qpid.snkbin0 -> 596 bytes
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs133
32 files changed, 5923 insertions, 0 deletions
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
new file mode 100644
index 0000000000..79a8021d9a
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Address.cpp
@@ -0,0 +1,252 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Address.h"
+
+#include "Address.h"
+#include "QpidMarshal.h"
+#include "QpidTypeCheck.h"
+#include "TypeTranslator.h"
+#include "QpidException.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Address is a managed wrapper for a qpid::messaging::Address
+ /// </summary>
+
+ // Create empty
+ Address::Address()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ addressp = new ::qpid::messaging::Address(QpidMarshal::ToNative(""));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Create string address
+ Address::Address(System::String ^ address)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ addressp = new ::qpid::messaging::Address(QpidMarshal::ToNative(address));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Create with options
+ Address::Address(System::String ^ name,
+ System::String ^ subject,
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ options)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ addressp = new ::qpid::messaging::Address();
+
+ Name = name;
+ Subject = subject;
+ Options = options;
+ Type = "";
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Create with options and type
+ Address::Address(System::String ^ name,
+ System::String ^ subject,
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ options,
+ System::String ^ type)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ addressp = new ::qpid::messaging::Address();
+
+ Name = name;
+ Subject = subject;
+ Options = options;
+ Type = type;
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Copy constructor look-alike (C#)
+ Address::Address(const Address ^ address)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ addressp = new ::qpid::messaging::Address(
+ *(const_cast<Address ^>(address)->NativeAddress));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Copy constructor implicitly dereferenced (C++)
+ Address::Address(const Address % address)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ addressp = new ::qpid::messaging::Address(
+ *(const_cast<Address %>(address).NativeAddress));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // unmanaged clone
+ Address::Address(const ::qpid::messaging::Address & addrp)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ addressp = new ::qpid::messaging::Address(addrp);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Destructor
+ Address::~Address()
+ {
+ this->!Address();
+ }
+
+
+ // Finalizer
+ Address::!Address()
+ {
+ msclr::lock lk(this);
+
+ if (NULL != addressp)
+ {
+ delete addressp;
+ addressp = NULL;
+ }
+ }
+
+ //
+ // ToString
+ //
+ System::String ^ Address::ToStr()
+ {
+ System::String ^ result = nullptr;
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ result = gcnew System::String(addressp->str().c_str());
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ return result;
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Address.h b/qpid/cpp/bindings/qpid/dotnet/src/Address.h
new file mode 100644
index 0000000000..8bbc207d4e
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Address.h
@@ -0,0 +1,180 @@
+/*
+* 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.
+*/
+
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Address.h"
+
+#include "QpidMarshal.h"
+#include "QpidTypeCheck.h"
+#include "TypeTranslator.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Address is a managed wrapper for a qpid::messaging::Address
+ /// </summary>
+
+ public ref class Address
+ {
+ private:
+ // The kept object in the Messaging C++ DLL
+ ::qpid::messaging::Address * addressp;
+
+ public:
+ Address();
+
+ Address(System::String ^ address);
+
+ Address(System::String ^ name,
+ System::String ^ subject,
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ options);
+
+ Address(System::String ^ name,
+ System::String ^ subject,
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ options,
+ System::String ^ type);
+
+ // copy constructor
+ Address(const Address ^ address);
+ Address(const Address % address);
+
+ // unmanaged clone
+ Address(const ::qpid::messaging::Address & addrp);
+
+ ~Address();
+ !Address();
+
+ // assignment operator
+ Address % operator=(const Address % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ if (NULL != addressp)
+ delete addressp;
+ addressp = new ::qpid::messaging::Address(
+ *(const_cast<Address %>(rhs).NativeAddress) );
+ }
+ return *this;
+ }
+
+ property ::qpid::messaging::Address * NativeAddress
+ {
+ ::qpid::messaging::Address * get () { return addressp; }
+ }
+
+ //
+ // name
+ //
+ property System::String ^ Name
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(addressp->getName().c_str());
+ }
+
+ void set (System::String ^ name)
+ {
+ addressp->::qpid::messaging::Address::setName(QpidMarshal::ToNative(name));
+ }
+ }
+
+
+ //
+ // subject
+ //
+ property System::String ^ Subject
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(addressp->getSubject().c_str());
+ }
+
+ void set (System::String ^ subject)
+ {
+ addressp->setSubject(QpidMarshal::ToNative(subject));
+ }
+ }
+
+
+ //
+ // options
+ //
+ property System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ Options
+ {
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ get ()
+ {
+ ::qpid::types::Variant::Map map;
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ newMap =
+ gcnew System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^>;
+ map = addressp->getOptions();
+ TypeTranslator::NativeToManaged(map, newMap);
+ return newMap;
+ }
+
+
+ void set (System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ options)
+ {
+ ::qpid::types::Variant::Map map;
+ TypeTranslator::ManagedToNative(options, map);
+ addressp->setOptions(map);
+ }
+ }
+
+
+ //
+ // type
+ //
+ property System::String ^ Type
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(addressp->getType().c_str());
+ }
+
+
+ void set (System::String ^ type)
+ {
+ addressp->setType(QpidMarshal::ToNative(type));
+ }
+ }
+
+ System::String ^ ToStr();
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/AssemblyInfo.cpp b/qpid/cpp/bindings/qpid/dotnet/src/AssemblyInfo.cpp
new file mode 100644
index 0000000000..08d2d4b4f9
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/AssemblyInfo.cpp
@@ -0,0 +1,57 @@
+/*
+* 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.
+*/
+
+using namespace System;
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+using namespace System::Security::Permissions;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly:AssemblyTitleAttribute("org.apache.qpid.messaging")];
+[assembly:AssemblyDescriptionAttribute("")];
+[assembly:AssemblyConfigurationAttribute("")];
+[assembly:AssemblyCompanyAttribute("")];
+[assembly:AssemblyProductAttribute("org.apache.qpid.messaging")];
+[assembly:AssemblyCopyrightAttribute("Copyright (c) 2010")];
+[assembly:AssemblyTrademarkAttribute("")];
+[assembly:AssemblyCultureAttribute("")];
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the value or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly:AssemblyVersionAttribute("1.0.*")];
+
+[assembly:ComVisible(false)];
+
+[assembly:CLSCompliantAttribute(true)];
+
+[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
new file mode 100644
index 0000000000..12c0e29f74
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp
@@ -0,0 +1,381 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Connection.h"
+#include "qpid/messaging/Session.h"
+#include "qpid/messaging/exceptions.h"
+
+#include "QpidMarshal.h"
+#include "Connection.h"
+#include "Session.h"
+#include "QpidException.h"
+#include "TypeTranslator.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Connection is a managed wrapper for a qpid::messaging::Connection
+ /// </summary>
+
+ // constructors
+ Connection::Connection(System::String ^ url)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ connectionp = new ::qpid::messaging::Connection(QpidMarshal::ToNative(url));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ Connection::Connection(System::String ^ url,
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ options)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ connectionp = new ::qpid::messaging::Connection(QpidMarshal::ToNative(url));
+
+ for each (System::Collections::Generic::KeyValuePair<System::String^, System::Object^> kvp in options)
+ {
+ SetOption(kvp.Key, kvp.Value);
+ }
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ Connection::Connection(System::String ^ url, System::String ^ options)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ connectionp = new ::qpid::messaging::Connection(QpidMarshal::ToNative(url),
+ QpidMarshal::ToNative(options));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ // Copy constructor look-alike (C#)
+ Connection::Connection(const Connection ^ connection)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ connectionp = new ::qpid::messaging::Connection(
+ *(const_cast<Connection ^>(connection)->NativeConnection));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Copy constructor implicitly dereferenced (C++)
+ Connection::Connection(const Connection % connection)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ connectionp = new ::qpid::messaging::Connection(
+ *(const_cast<Connection %>(connection).NativeConnection));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ // Destructor
+ Connection::~Connection()
+ {
+ this->!Connection();
+ }
+
+
+ // Finalizer
+ Connection::!Connection()
+ {
+ msclr::lock lk(this);
+
+ if (NULL != connectionp)
+ {
+ delete connectionp;
+ connectionp = NULL;
+ }
+ }
+
+
+ void Connection::SetOption(System::String ^ name, System::Object ^ value)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ ::qpid::types::Variant entryValue;
+ TypeTranslator::ManagedToNativeObject(value, entryValue);
+ std::string entryName = QpidMarshal::ToNative(name);
+ connectionp->::qpid::messaging::Connection::setOption(entryName, entryValue);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Connection::Open()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ connectionp->open();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Connection::Close()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ connectionp->close();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ //
+ // CreateTransactionalSession()
+ //
+ Session ^ Connection::CreateTransactionalSession()
+ {
+ return CreateTransactionalSession("");
+ }
+
+
+ Session ^ Connection::CreateTransactionalSession(System::String ^ name)
+ {
+ System::Exception ^ newException = nullptr;
+ Session ^ newSession = nullptr;
+
+ try
+ {
+ // create native session
+ ::qpid::messaging::Session sessionp =
+ connectionp->createTransactionalSession(QpidMarshal::ToNative(name));
+
+ // create managed session
+ newSession = gcnew Session(sessionp, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ // Clean up and throw on caught exceptions
+ if (newException != nullptr)
+ {
+ if (newSession != nullptr)
+ {
+ delete newSession;
+ }
+ }
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newSession;
+ }
+
+
+ //
+ // CreateSession()
+ //
+ Session ^ Connection::CreateSession()
+ {
+ return CreateSession("");
+ }
+
+
+ Session ^ Connection::CreateSession(System::String ^ name)
+ {
+ System::Exception ^ newException = nullptr;
+ Session ^ newSession = nullptr;
+
+ try
+ {
+ // create native session
+ ::qpid::messaging::Session sessionp =
+ connectionp->createSession(QpidMarshal::ToNative(name));
+
+ // create managed session
+ newSession = gcnew Session(sessionp, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ // Clean up and throw on caught exceptions
+ if (newException != nullptr)
+ {
+ if (newSession != nullptr)
+ {
+ delete newSession;
+ }
+ }
+ }
+
+ if (nullptr != newException)
+ {
+ throw newException;
+ }
+
+ return newSession;
+ }
+
+
+ Session ^ Connection::GetSession(System::String ^ name)
+ {
+ System::Exception ^ newException = nullptr;
+ Session ^ newSession = nullptr;
+
+ try
+ {
+ const std::string n = QpidMarshal::ToNative(name);
+
+ ::qpid::messaging::Session sess =
+ connectionp->::qpid::messaging::Connection::getSession(n);
+
+ newSession = gcnew Session(sess, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ // Clean up and throw on caught exceptions
+ if (newException != nullptr)
+ {
+ if (newSession != nullptr)
+ {
+ delete newSession;
+ }
+ }
+ }
+
+ if (nullptr != newException)
+ {
+ throw newException;
+ }
+
+ return newSession;
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Connection.h b/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
new file mode 100644
index 0000000000..0788f5d225
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Connection.h
@@ -0,0 +1,120 @@
+/*
+* 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.
+*/
+
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Connection.h"
+#include "qpid/messaging/Session.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Connection is a managed wrapper for a qpid::messaging::Connection
+ /// </summary>
+
+ ref class Session;
+
+ public ref class Connection
+ {
+ private:
+ // The kept object in the Messaging C++ DLL
+ ::qpid::messaging::Connection * connectionp;
+
+ public:
+ Connection(System::String ^ url);
+
+ Connection(System::String ^ url,
+ System::Collections::Generic::Dictionary<
+ System::String ^, System::Object ^> ^ options);
+
+ Connection(System::String ^ url, System::String ^ options);
+
+ // copy constructor
+ Connection(const Connection ^ connection);
+ Connection(const Connection % connection);
+
+ // unmanaged clone
+ // not defined
+
+ ~Connection();
+ !Connection();
+
+ // assignment operator
+ Connection % operator=(const Connection % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ if (NULL != connectionp)
+ delete connectionp;
+ connectionp = new ::qpid::messaging::Connection(
+ *(const_cast<Connection %>(rhs).NativeConnection) );
+ }
+ return *this;
+ }
+
+ property ::qpid::messaging::Connection * NativeConnection
+ {
+ ::qpid::messaging::Connection * get () { return connectionp; }
+ }
+
+ void SetOption(System::String ^ name, System::Object ^ value);
+
+ void Open();
+ void Close();
+
+ property System::Boolean IsOpen
+ {
+ System::Boolean get ()
+ {
+ return connectionp->isOpen();
+ }
+ }
+
+ // CreateTransactionalSession()
+ Session ^ CreateTransactionalSession();
+ Session ^ CreateTransactionalSession(System::String ^ name);
+
+ // CreateSession()
+ Session ^ CreateSession();
+ Session ^ CreateSession(System::String ^ name);
+
+ Session ^ GetSession(System::String ^ name);
+
+ property System::String ^ AuthenticatedUsername
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(connectionp->getAuthenticatedUsername().c_str());
+ }
+ }
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Duration.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Duration.cpp
new file mode 100644
index 0000000000..7daf803be8
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Duration.cpp
@@ -0,0 +1,107 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Duration.h"
+
+#include "Duration.h"
+
+namespace org {
+namespace apache {
+namespace qpid {
+namespace messaging {
+
+ /// <summary>
+ /// Duration is a time interval in milliseconds.
+ /// It is a managed wrapper for a ::qpid::messaging::Duration
+ /// </summary>
+
+ // Public constructor
+ Duration::Duration(System::UInt64 milliseconds) :
+ durationp(new ::qpid::messaging::Duration(milliseconds))
+ {
+ }
+
+ // Private experimental constructor
+ Duration::Duration(const ::qpid::messaging::Duration * d) :
+ durationp(d)
+ {
+ }
+
+
+ // Destructor
+ Duration::~Duration()
+ {
+ Cleanup();
+ }
+
+
+ // Finalizer
+ Duration::!Duration()
+ {
+ Cleanup();
+ }
+
+
+ // Returns the value from kept object
+ System::UInt64 Duration::getMilliseconds()
+ {
+ return durationp->getMilliseconds();
+ }
+
+
+ // Destroys kept object
+ // TODO: add lock
+ void Duration::Cleanup()
+ {
+ if (NULL != durationp)
+ {
+ delete durationp;
+ durationp = NULL;
+ }
+ }
+
+ // Return value(s) for constant durations
+ // NOTE: These return the duration mS and not a Duration
+ // object like the C++ code gets.
+ System::UInt64 Duration::FOREVER()
+ {
+ return ::qpid::messaging::Duration::FOREVER.getMilliseconds();
+ }
+
+ System::UInt64 Duration::IMMEDIATE()
+ {
+ return ::qpid::messaging::Duration::IMMEDIATE.getMilliseconds();
+ }
+
+ System::UInt64 Duration::SECOND()
+ {
+ return ::qpid::messaging::Duration::SECOND.getMilliseconds();
+ }
+
+ System::UInt64 Duration::MINUTE()
+ {
+ return ::qpid::messaging::Duration::MINUTE.getMilliseconds();
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Duration.h b/qpid/cpp/bindings/qpid/dotnet/src/Duration.h
new file mode 100644
index 0000000000..d4239fae88
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Duration.h
@@ -0,0 +1,115 @@
+/*
+* 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.
+*/
+
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Duration is a time interval in milliseconds.
+ /// It is a managed equivalent of ::qpid::messaging::Duration
+ /// </summary>
+
+ public ref class Duration sealed
+ {
+ private:
+ System::UInt64 milliseconds;
+
+ public:
+
+ Duration(const Duration % rhs) :
+ milliseconds(rhs.milliseconds)
+ {
+ }
+
+ explicit Duration(System::UInt64 mS) :
+ milliseconds(mS) {}
+
+ Duration() :
+ milliseconds(System::UInt64::MaxValue) {}
+
+ property System::UInt64 Milliseconds
+ {
+ System::UInt64 get () { return milliseconds; }
+ }
+
+ static Duration ^ operator * (Duration ^ dur, const System::UInt64 multiplier)
+ {
+ Duration ^ result = gcnew Duration(dur->Milliseconds * multiplier);
+ return result;
+ }
+
+ static Duration ^ operator * (const System::UInt64 multiplier, Duration ^ dur)
+ {
+ Duration ^ result = gcnew Duration(multiplier * dur->Milliseconds);
+ return result;
+ }
+
+ static Duration ^ Multiply (Duration ^ dur, const System::UInt64 multiplier)
+ {
+ Duration ^ result = gcnew Duration(dur->Milliseconds * multiplier);
+ return result;
+ }
+
+ static Duration ^ Multiply (const System::UInt64 multiplier, Duration ^ dur)
+ {
+ Duration ^ result = gcnew Duration(multiplier * dur->Milliseconds);
+ return result;
+ }
+
+ static bool operator == (Duration ^ a, Duration ^ b)
+ {
+ return a->Milliseconds == b->Milliseconds;
+ }
+
+ static bool operator != (Duration ^ a, Duration ^ b)
+ {
+ return a->Milliseconds != b->Milliseconds;
+ }
+};
+
+ public ref class DurationConstants sealed
+ {
+ private:
+ DurationConstants::DurationConstants() {}
+
+ public:
+ static Duration ^ FORVER;
+ static Duration ^ IMMEDIATE;
+ static Duration ^ SECOND;
+ static Duration ^ MINUTE;
+
+ static DurationConstants()
+ {
+ FORVER = gcnew Duration();
+ IMMEDIATE = gcnew Duration(0);
+ SECOND = gcnew Duration(1000);
+ MINUTE = gcnew Duration(60000);
+ }
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp b/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp
new file mode 100644
index 0000000000..d34474f2c4
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.cpp
@@ -0,0 +1,82 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/FailoverUpdates.h"
+
+#include "Connection.h"
+#include "FailoverUpdates.h"
+#include "QpidException.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// FailoverUpdates is a managed wrapper for a qpid::messaging::FailoverUpdates
+ /// </summary>
+
+ // constructors
+
+ FailoverUpdates::FailoverUpdates(Connection ^ connection)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ failoverupdatesp = new ::qpid::messaging::FailoverUpdates(*(connection->NativeConnection));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ // Destructor
+ FailoverUpdates::~FailoverUpdates()
+ {
+ this->!FailoverUpdates();
+ }
+
+
+ // Finalizer
+ FailoverUpdates::!FailoverUpdates()
+ {
+ msclr::lock lk(this);
+
+ if (NULL != failoverupdatesp)
+ {
+ delete failoverupdatesp;
+ failoverupdatesp = NULL;
+ }
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h b/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h
new file mode 100644
index 0000000000..1dd92b8688
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/FailoverUpdates.h
@@ -0,0 +1,64 @@
+/*
+* 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.
+*/
+
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// FailoverUpdates is a managed wrapper for a qpid::messaging::FailoverUpdates
+ /// </summary>
+
+ ref class Connection;
+
+ public ref class FailoverUpdates
+ {
+ private:
+ // The kept object in the Messaging C++ DLL
+ ::qpid::messaging::FailoverUpdates * failoverupdatesp;
+
+ public:
+ FailoverUpdates(Connection ^ connection);
+
+ ~FailoverUpdates();
+ !FailoverUpdates();
+
+ private:
+ // unmanaged clone
+ // not defined
+
+ // copy constructor
+ FailoverUpdates(const FailoverUpdates ^ failoverUpdates) {}
+
+ // assignment operator
+ FailoverUpdates % operator=(const FailoverUpdates % rhs)
+ {
+ return *this;
+ }
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
new file mode 100644
index 0000000000..e5dbf845b3
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp
@@ -0,0 +1,617 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <typeinfo.h>
+#include <string>
+#include <limits>
+#include <iostream>
+#include <stdlib.h>
+
+#include "qpid/messaging/Message.h"
+#include "qpid/types/Variant.h"
+
+#include "QpidMarshal.h"
+#include "Address.h"
+#include "Duration.h"
+#include "Message.h"
+#include "QpidTypeCheck.h"
+#include "QpidException.h"
+#include "TypeTranslator.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Message is a managed wrapper for a ::qpid::messaging::Message
+ /// </summary>
+
+ // Create empty message
+ Message::Message()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ messagep = new ::qpid::messaging::Message(QpidMarshal::ToNative(""));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Create from string
+ Message::Message(System::String ^ theStr)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ messagep = new ::qpid::messaging::Message(QpidMarshal::ToNative(theStr));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Create from object
+ Message::Message(System::Object ^ theValue)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ messagep = new ::qpid::messaging::Message(QpidMarshal::ToNative(""));
+
+ if (QpidTypeCheck::ObjectIsMap(theValue))
+ {
+ // Create a mapped message using given dictionary
+
+ // Allocate a map
+ ::qpid::types::Variant::Map newMap;
+
+ // Add the map variables to the map
+ TypeTranslator::ManagedToNative((QpidMap ^)theValue, newMap);
+
+ // Set message content type
+ messagep->setContentType("ampq/map");
+
+ // Insert the map into the message
+ ::qpid::messaging::encode(newMap, *messagep, QpidMarshal::ToNative("amqp/map"));
+ }
+ else if (QpidTypeCheck::ObjectIsList(theValue))
+ {
+ // Create a list message using given list
+
+ // Allocate a list
+ ::qpid::types::Variant::List newList;
+
+ // Add the list variables to the list
+ TypeTranslator::ManagedToNative((QpidList ^)theValue, newList);
+
+ // Set message content type
+ messagep->setContentType("ampq/list");
+
+ // Insert the list into the message
+ ::qpid::messaging::encode(newList, *messagep, QpidMarshal::ToNative("amqp/list"));
+ }
+ else
+ {
+ // Create a binary string message
+ messagep->setContent(QpidMarshal::ToNative(theValue->ToString()));
+ }
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ // Create from bytes
+ Message::Message(array<System::Byte> ^ bytes)
+ {
+ System::Exception ^ newException = nullptr;
+ try
+ {
+ pin_ptr<unsigned char> pBytes = &bytes[0];
+ messagep = new ::qpid::messaging::Message((char *)pBytes, bytes->Length);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Create from byte array slice
+ Message::Message(array<System::Byte> ^ bytes, int offset, int size)
+ {
+ if ((offset + size) > bytes->Length)
+ throw gcnew QpidException("Message::Message Create from byte array slice: buffer length exceeded");
+
+ System::Exception ^ newException = nullptr;
+ try
+ {
+ pin_ptr<unsigned char> pBytes = &bytes[offset];
+ messagep = new ::qpid::messaging::Message((char *)pBytes, size);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ // unmanaged clone
+ Message::Message(const ::qpid::messaging::Message & msgp)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ messagep = new ::qpid::messaging::Message(msgp);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ // Destructor
+ Message::~Message()
+ {
+ this->!Message();
+ }
+
+
+ // Finalizer
+ Message::!Message()
+ {
+ msclr::lock lk(this);
+
+ if (NULL != messagep)
+ {
+ delete messagep;
+ messagep = NULL;
+ }
+ }
+
+ // Copy constructor look-alike (C#)
+ Message::Message(const Message ^ message)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ messagep = new ::qpid::messaging::Message(
+ *(const_cast<Message ^>(message)->NativeMessage));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Copy constructor implicitly dereferenced (C++)
+ Message::Message(const Message % message)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ messagep = new ::qpid::messaging::Message(
+ *(const_cast<Message %>(message).NativeMessage));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Property
+ void Message::SetProperty(System::String ^ name, System::Object ^ value)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ ::qpid::types::Variant entryValue;
+ TypeTranslator::ManagedToNativeObject(value, entryValue);
+
+ messagep->getProperties()[QpidMarshal::ToNative(name)] = entryValue;
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Content
+ void Message::SetContent(System::String ^ content)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ messagep->setContent(QpidMarshal::ToNative(content));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ void Message::SetContent(cli::array<System::Byte> ^ bytes)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ pin_ptr<unsigned char> pBytes = &bytes[0];
+ messagep->setContent((char *)pBytes, bytes->Length);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ void Message::SetContent(cli::array<System::Byte> ^ bytes, int offset, int size)
+ {
+ if ((offset + size) > bytes->Length)
+ throw gcnew QpidException("Message::SetContent from byte array slice: buffer length exceeded");
+
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ pin_ptr<unsigned char> pBytes = &bytes[offset];
+ messagep->setContent((char *)pBytes, size);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ System::String ^ Message::GetContent()
+ {
+ System::String ^ result = nullptr;
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ result = gcnew String(messagep->getContent().c_str());
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return result;
+ }
+
+
+ //
+ // User wants to extract a Dictionary from the message
+ //
+ void Message::GetContent(System::Collections::Generic::Dictionary<
+ System::String^,
+ System::Object^> ^ dict)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ // Extract the message map from the message
+ ::qpid::types::Variant::Map map;
+
+ ::qpid::messaging::decode(*messagep, map, QpidMarshal::ToNative("amqp/map"));
+
+ TypeTranslator::NativeToManaged(map, dict);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ //
+ // User wants to extract a list from the message
+ //
+ void Message::GetContent(System::Collections::ObjectModel::Collection<
+ System::Object^> ^ list)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ // allocate a native messaging::List
+ ::qpid::types::Variant::List nativeList;
+
+ // Extract the list from the message in native format
+ ::qpid::messaging::decode(*messagep, nativeList, QpidMarshal::ToNative("amqp/list"));
+
+ // translate native list into user's managed list
+ TypeTranslator::NativeToManaged(nativeList, list);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ //
+ // Return message content to raw byte array.
+ // On entry message size must not be zero and
+ // caller's byte array must be equal to message size.
+ //
+ void Message::GetContent(array<System::Byte> ^ arr)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ System::UInt32 size = messagep->getContentSize();
+
+ if (0 == size)
+ throw gcnew QpidException("Message::GetRaw - message size is zero");
+
+ if (arr->Length != size)
+ throw gcnew QpidException("Message::GetRaw - receive buffer is wrong size");
+
+ const char * pMsgSrc = messagep->getContentPtr();
+ pin_ptr<unsigned char> pArr = &arr[0];
+ memcpy(pArr, pMsgSrc, size);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ System::String ^ Message::MapAsString(System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ dict)
+ {
+ System::Text::StringBuilder ^ sb = gcnew System::Text::StringBuilder("{");
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ System::String ^ leading = "";
+
+ for each (System::Collections::Generic::KeyValuePair
+ <System::String^, System::Object^> kvp in dict)
+ {
+ sb->Append(leading);
+ leading = ", ";
+
+ if (QpidTypeCheck::ObjectIsMap(kvp.Value))
+ {
+ sb->AppendFormat(
+ "{0}={1}",
+ kvp.Key,
+ MapAsString((System::Collections::Generic::Dictionary<System::String^, System::Object^> ^)kvp.Value));
+ }
+ else if (QpidTypeCheck::ObjectIsList(kvp.Value))
+ {
+ sb->AppendFormat(
+ "{0}={1}",
+ kvp.Key,
+ ListAsString((System::Collections::ObjectModel::Collection<
+ System::Object^> ^)kvp.Value));
+ }
+ else if (nullptr == kvp.Value)
+ {
+ sb->AppendFormat(
+ "{0}=",
+ kvp.Key);
+ }
+ else
+ sb->AppendFormat("{0}={1}", kvp.Key, kvp.Value);
+ }
+ sb->Append("}");
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ System::String ^ result = gcnew System::String(sb->ToString());
+ return result;
+ }
+
+ /// <summary>
+ /// A function to display a ampq/list message packaged as a List.
+ /// </summary>
+ /// <param name="list">The AMQP list</param>
+ System::String ^ Message::ListAsString(System::Collections::ObjectModel::Collection<System::Object^> ^ list)
+ {
+ System::Text::StringBuilder ^ sb = gcnew System::Text::StringBuilder("[");
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ System::String ^ leading = "";
+
+ for each (System::Object ^ obj in list)
+ {
+ sb->Append(leading);
+ leading = ", ";
+
+ if (QpidTypeCheck::ObjectIsMap(obj))
+ {
+ sb->Append(MapAsString((System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^)obj));
+ }
+ else if (QpidTypeCheck::ObjectIsList(obj))
+ {
+ sb->Append(ListAsString((System::Collections::ObjectModel::Collection<
+ System::Object^> ^)obj));
+ }
+ else if (nullptr == obj)
+ {
+ // no display for null objects
+ }
+ else
+ sb->Append(obj->ToString());
+ }
+ sb->Append("]");
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ System::String ^ result = gcnew System::String(sb->ToString());
+ return result;
+ }
+
+ System::String ^ Message::AsString(System::Object ^ obj)
+ {
+ if (QpidTypeCheck::ObjectIsMap(obj))
+ return MapAsString((System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^)obj);
+ else if (QpidTypeCheck::ObjectIsList(obj))
+ return ListAsString((System::Collections::ObjectModel::Collection<
+ System::Object^> ^)obj);
+ else
+ return obj->ToString();
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Message.h b/qpid/cpp/bindings/qpid/dotnet/src/Message.h
new file mode 100644
index 0000000000..ac7f285fe5
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Message.h
@@ -0,0 +1,369 @@
+/*
+* 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.
+*/
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Message.h"
+
+#include "QpidMarshal.h"
+#include "Address.h"
+#include "Duration.h"
+#include "TypeTranslator.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ ref class Address;
+ ref class Duration;
+
+ /// <summary>
+ /// Message is a managed wrapper for a ::qpid::messaging::Message
+ /// </summary>
+
+ public ref class Message
+ {
+
+ private:
+ // The kept object in the Messaging C++ DLL
+ ::qpid::messaging::Message * messagep;
+
+ public:
+ // Create empty message
+ Message();
+
+ // Create from String
+ Message(System::String ^ theStr);
+
+ // Create from object
+ Message(System::Object ^ theValue);
+
+ // Create from byte array
+ Message(array<System::Byte> ^ bytes);
+
+ // Create from byte array slice
+ Message(array<System::Byte> ^ bytes, int offset, int size);
+
+ ~Message();
+ !Message();
+
+ // Copy constructor
+ Message(const Message ^ message);
+ Message(const Message % message);
+
+ // unmanaged clone
+ Message(const ::qpid::messaging::Message & msgp);
+
+ // assignment operator
+ Message % operator=(const Message % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ if (NULL != messagep)
+ delete messagep;
+ messagep = new ::qpid::messaging::Message(
+ *(const_cast<Message %>(rhs).NativeMessage) );
+ }
+ return *this;
+ }
+
+ //
+ // NativeMessage
+ //
+ property ::qpid::messaging::Message * NativeMessage
+ {
+ ::qpid::messaging::Message * get () { return messagep; }
+ }
+
+ //
+ // ReplyTo
+ //
+ property Address ^ ReplyTo
+ {
+ void set (Address ^ address)
+ {
+ messagep->setReplyTo(*(address->NativeAddress));
+ }
+
+ Address ^ get ()
+ {
+ const ::qpid::messaging::Address & addrp =
+ messagep->::qpid::messaging::Message::getReplyTo();
+
+ return gcnew Address(addrp);
+ }
+ }
+
+ //
+ // Subject
+ //
+ property System::String ^ Subject
+ {
+ void set (System::String ^ subject)
+ {
+ messagep->setSubject(QpidMarshal::ToNative(subject));
+ }
+
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->getSubject().c_str());
+ }
+ }
+
+
+ //
+ // ContentType
+ //
+ property System::String ^ ContentType
+ {
+ void set (System::String ^ ct)
+ {
+ messagep->setContentType(QpidMarshal::ToNative(ct));
+ }
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->::qpid::messaging::Message::getContentType().c_str());
+ }
+ }
+
+
+ //
+ // MessageId
+ //
+ property System::String ^ MessageId
+ {
+ void set (System::String ^ messageId)
+ {
+ messagep->setMessageId(QpidMarshal::ToNative(messageId));
+ }
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->getMessageId().c_str());
+ }
+ }
+
+
+ //
+ // UserId
+ //
+ property System::String ^ UserId
+ {
+ void set (System::String ^ uId)
+ {
+ messagep->setUserId(QpidMarshal::ToNative(uId));
+ }
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->getUserId().c_str());
+ }
+ }
+
+
+ //
+ // CorrelationId
+ //
+ property System::String ^ CorrelationId
+ {
+ void set (System::String ^ correlationId)
+ {
+ messagep->setCorrelationId(QpidMarshal::ToNative(correlationId));
+ }
+
+ System::String ^ get ()
+ {
+ return gcnew String(messagep->getCorrelationId().c_str());
+ }
+ }
+
+
+ //
+ // Priority
+ //
+ property unsigned char Priority
+ {
+ void set (unsigned char priority)
+ {
+ messagep->setPriority(priority);
+ }
+
+ unsigned char get ()
+ {
+ return messagep->getPriority();
+ }
+ }
+
+
+ //
+ // Ttl
+ //
+ property Duration ^ Ttl
+ {
+ void set (Duration ^ ttl)
+ {
+ ::qpid::messaging::Duration dur(ttl->Milliseconds);
+
+ messagep->setTtl(dur);
+ }
+
+ Duration ^ get ()
+ {
+ Duration ^ dur = gcnew Duration(messagep->getTtl().getMilliseconds());
+
+ return dur;
+ }
+ }
+
+ //
+ // Durable
+ //
+ property bool Durable
+ {
+ void set (bool durable)
+ {
+ messagep->setDurable(durable);
+ }
+
+ bool get ()
+ {
+ return messagep->getDurable();
+ }
+ }
+
+ //
+ // Redelivered
+ //
+ property bool Redelivered
+ {
+ bool get ()
+ {
+ return messagep->getRedelivered();
+ }
+
+ void set (bool redelivered)
+ {
+ messagep->setRedelivered(redelivered);
+ }
+ }
+
+ //
+ // Property
+ //
+ void Message::SetProperty(System::String ^ name, System::Object ^ value);
+
+ //
+ // Properties
+ //
+ property System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ Properties
+ {
+ System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ get ()
+ {
+ ::qpid::types::Variant::Map map;
+
+ map = messagep->getProperties();
+
+ System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ dict =
+ gcnew System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ;
+
+
+ TypeTranslator::NativeToManaged(map, dict);
+
+ return dict;
+ }
+
+
+ void set (System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ properties)
+ {
+ for each (System::Collections::Generic::KeyValuePair
+ <System::String^, System::Object^> kvp in properties)
+ {
+ SetProperty(kvp.Key, kvp.Value);
+ }
+ }
+ }
+
+
+ void SetContent(System::String ^ content);
+
+ void SetContent(cli::array<System::Byte> ^ bytes);
+
+ void SetContent(cli::array<System::Byte> ^ bytes, int offset, int size);
+
+ //TODO:: void setContent(Bytes{} bytes, offset, length);
+
+ // get content as string
+ System::String ^ GetContent();
+
+ // get content as dictionary
+ void GetContent(System::Collections::Generic::Dictionary<
+ System::String^,
+ System::Object^> ^ dict);
+
+ // get content as map
+ void GetContent(System::Collections::ObjectModel::Collection<
+ System::Object^> ^);
+
+ // get content as bytes
+ void GetContent(cli::array<System::Byte> ^ arr);
+
+ //
+ // ContentSize
+ //
+ property System::UInt64 ContentSize
+ {
+ System::UInt64 get ()
+ {
+ return messagep->getContentSize();
+ }
+ }
+
+
+ // A message has been returned to managed code through GetContent().
+ // Display the content of that System::Object as a string.
+ System::String ^ AsString(System::Object ^ obj);
+
+ System::String ^ MapAsString(System::Collections::Generic::Dictionary<
+ System::String^, System::Object^> ^ dict);
+
+ System::String ^ ListAsString(System::Collections::ObjectModel::Collection<
+ System::Object^> ^ list);
+
+ //TODO: EncodingException
+
+ // Note: encode/decode functions are in TypeTranslator
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/QpidException.h b/qpid/cpp/bindings/qpid/dotnet/src/QpidException.h
new file mode 100644
index 0000000000..c63f245f74
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/QpidException.h
@@ -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.
+*/
+
+#pragma once
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+using namespace System;
+
+[Serializable]
+public ref class QpidException : System::Exception
+{
+ public:
+
+ QpidException()
+ : System::Exception() {}
+
+ QpidException(String^ estring)
+ : System::Exception(estring) {}
+
+};
+
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/QpidMarshal.h b/qpid/cpp/bindings/qpid/dotnet/src/QpidMarshal.h
new file mode 100644
index 0000000000..a8266ba5da
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/QpidMarshal.h
@@ -0,0 +1,65 @@
+/*
+* 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.
+*/
+
+#pragma once
+
+using namespace System;
+using namespace System::Text;
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+
+
+// Helper functions for marshaling.
+
+private ref class QpidMarshal
+{
+private:
+ QpidMarshal::QpidMarshal() {}
+
+public:
+
+ /// <summary>
+ /// Convert managed String into native UTF8-encoded string
+ /// TODO: figure out some encoding other that UTF-8
+ /// </summary>
+
+ static std::string ToNative (System::String^ managed)
+ {
+ if (managed->Length == 0)
+ {
+ return std::string();
+ }
+
+ array<unsigned char>^ mbytes = Encoding::UTF8->GetBytes(managed);
+ if (mbytes->Length == 0)
+ {
+ return std::string();
+ }
+
+ pin_ptr<unsigned char> pinnedBuf = &mbytes[0];
+ std::string native((char *) pinnedBuf, mbytes->Length);
+ return native;
+ }
+};
+
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/QpidTypeCheck.h b/qpid/cpp/bindings/qpid/dotnet/src/QpidTypeCheck.h
new file mode 100644
index 0000000000..d0f410b912
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/QpidTypeCheck.h
@@ -0,0 +1,86 @@
+/*
+* 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.
+*/
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// QpidTypeCheck determines if a given managed object represents
+ /// a qpid type per the scheme presented by the messaging DLL.
+ ///
+ // The supported mapping is:
+ /// * a managed Dictionary and a Qpid Messaging Map
+ /// * a managed Collection and a Qpid Messaging List
+ /// </summary>
+
+ typedef System::Collections::Generic::Dictionary<
+ System::String^,
+ System::Object^>
+ QpidMap;
+
+ typedef System::Collections::ObjectModel::Collection<
+ System::Object^>
+ QpidList;
+
+ private ref class QpidTypeCheckConstants sealed
+ {
+ private:
+ QpidTypeCheckConstants::QpidTypeCheckConstants() {}
+
+ public:
+ static System::Type const ^ const mapTypeP = System::Type::GetType(
+ "System.Collections.Generic.Dictionary`2[System.String,System.Object]");
+ static System::Type const ^ const listTypeP = System::Type::GetType(
+ "System.Collections.ObjectModel.Collection`1[System.Object]");
+ };
+
+
+ public ref class QpidTypeCheck sealed
+ {
+ private:
+ QpidTypeCheck::QpidTypeCheck() {}
+
+ public:
+
+ static bool ObjectIsMap (System::Object ^ theValue)
+ {
+ if (nullptr == theValue)
+ return false;
+ else
+ return (*theValue).GetType() == QpidTypeCheckConstants::mapTypeP;
+ }
+
+ static bool ObjectIsList(System::Object ^ theValue)
+ {
+ if (nullptr == theValue)
+ return false;
+ else
+ return (*theValue).GetType() == QpidTypeCheckConstants::listTypeP;
+ }
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/ReadMe.txt b/qpid/cpp/bindings/qpid/dotnet/src/ReadMe.txt
new file mode 100644
index 0000000000..a17f04325e
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/ReadMe.txt
@@ -0,0 +1,40 @@
+========================================================================
+ DYNAMIC LINK LIBRARY : Org.Apache.Qpid.Messaging Project Overview
+========================================================================
+
+AppWizard has created this Org.Apache.Qpid.Messaging DLL for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your Org.Apache.Qpid.Messaging application.
+
+Org.Apache.Qpid.Messaging.vcproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+Connection.[cpp h]
+Duration.[cpp h]
+Message.[cpp h]
+Receiver.[cpp h]
+Sender.[cpp h]
+Session.[cpp h]
+ Managed code Interop layer modules to provide access to functions exported by
+ qpidcommon.dll.
+
+AssemblyInfo.cpp
+ Contains custom attributes for modifying assembly metadata.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+Current TODOs include:
+
+ * Add locking as needed
+ * Add remaining modules and methods
+ * Capture and repackage exceptions emitted from messaging DLLs
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
new file mode 100644
index 0000000000..8aa77effbd
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp
@@ -0,0 +1,323 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Receiver.h"
+#include "qpid/messaging/Session.h"
+#include "qpid/messaging/Message.h"
+#include "qpid/messaging/exceptions.h"
+
+#include "Receiver.h"
+#include "Session.h"
+#include "Message.h"
+#include "Duration.h"
+#include "QpidException.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Receiver is a managed wrapper for a ::qpid::messaging::Receiver
+ /// </summary>
+
+ // unmanaged clone
+ Receiver::Receiver(const ::qpid::messaging::Receiver & r,
+ Org::Apache::Qpid::Messaging::Session ^ sessRef) :
+ parentSession(sessRef)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ receiverp = new ::qpid::messaging::Receiver (r);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // unmanaged clone
+ // undefined
+
+ // Destructor
+ Receiver::~Receiver()
+ {
+ this->!Receiver();
+ }
+
+
+ // Finalizer
+ Receiver::!Receiver()
+ {
+ msclr::lock lk(this);
+
+ if (NULL != receiverp)
+ {
+ delete receiverp;
+ receiverp = NULL;
+ }
+ }
+
+
+ // Copy constructor look-alike (C#)
+ Receiver::Receiver(const Receiver ^ receiver) :
+ parentSession(receiver->parentSession)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ receiverp = new ::qpid::messaging::Receiver(
+ *(const_cast<Receiver ^>(receiver)->NativeReceiver));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Copy constructor implicitly dereferenced (C++)
+ Receiver::Receiver(const Receiver % receiver) :
+ parentSession(receiver.parentSession)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ receiverp = new ::qpid::messaging::Receiver(
+ *(const_cast<Receiver %>(receiver).NativeReceiver));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ //
+ // Get(message)
+ //
+ bool Receiver::Get(Message ^% mmsgp)
+ {
+ return Get(mmsgp, DurationConstants::FORVER);
+ }
+
+ bool Receiver::Get(Message ^% mmsgp, Duration ^ durationp)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ ::qpid::messaging::Duration dur((*durationp).Milliseconds);
+
+ ::qpid::messaging::Message tmpMsg;
+
+ bool result = receiverp->Receiver::get(tmpMsg, dur);
+
+ if (result)
+ {
+ mmsgp = gcnew Message(tmpMsg);
+ }
+
+ return result;
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return false;
+ }
+
+ //
+ // message = Get()
+ //
+ Message ^ Receiver::Get()
+ {
+ return Get(DurationConstants::FORVER);
+ }
+
+
+ Message ^ Receiver::Get(Duration ^ durationp)
+ {
+ System::Exception ^ newException = nullptr;
+ Message ^ newMessage = nullptr;
+
+ try
+ {
+ // translate the duration
+ ::qpid::messaging::Duration dur((*durationp).Milliseconds);
+
+ // get the message
+ ::qpid::messaging::Message msg =
+ receiverp->::qpid::messaging::Receiver::get(dur);
+
+ // create new managed message with received message embedded in it
+ newMessage = gcnew Message(msg);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newMessage != nullptr)
+ {
+ delete newMessage;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newMessage;
+ }
+
+ //
+ // Fetch(message)
+ //
+ bool Receiver::Fetch(Message ^% mmsgp)
+ {
+ return Fetch(mmsgp, DurationConstants::FORVER);
+ }
+
+ bool Receiver::Fetch(Message ^% mmsgp, Duration ^ durationp)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ ::qpid::messaging::Duration dur((*durationp).Milliseconds);
+
+ ::qpid::messaging::Message tmpMsg;
+
+ bool result = receiverp->Receiver::fetch(tmpMsg, dur);
+
+ if (result)
+ {
+ mmsgp = gcnew Message(tmpMsg);
+ }
+
+ return result;
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return false;
+ }
+
+
+ //
+ // message = Fetch()
+ //
+
+ Message ^ Receiver::Fetch()
+ {
+ return Fetch(DurationConstants::FORVER);
+ }
+
+ Message ^ Receiver::Fetch(Duration ^ durationp)
+ {
+ System::Exception ^ newException = nullptr;
+ Message ^ newMessage = nullptr;
+
+ try
+ {
+ // translate the duration
+ ::qpid::messaging::Duration dur((*durationp).Milliseconds);
+
+ // get the message
+ ::qpid::messaging::Message msg =
+ receiverp->::qpid::messaging::Receiver::fetch(dur);
+
+ // create new managed message with received message embedded in it
+ newMessage = gcnew Message(msg);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newMessage != nullptr)
+ {
+ delete newMessage;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newMessage;
+ }
+
+ void Receiver::Close()
+ {
+ receiverp->close();
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
new file mode 100644
index 0000000000..8ddcc9ac01
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h
@@ -0,0 +1,188 @@
+/*
+* 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.
+*/
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Receiver.h"
+#include "qpid/messaging/Session.h"
+#include "qpid/messaging/Message.h"
+#include "qpid/messaging/Duration.h"
+
+namespace qpid {
+namespace messaging {
+ // Dummy class to satisfy linker
+ class ReceiverImpl {};
+}}
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Mreceiver is a managed wrapper for a ::qpid::messaging::Receiver
+ /// </summary>
+
+ ref class Session;
+ ref class Message;
+ ref class Duration;
+
+ public ref class Receiver
+ {
+ private:
+ // The session that created this Receiver
+ Session ^ parentSession;
+
+ // The kept object in the Messaging C++ DLL
+ ::qpid::messaging::Receiver * receiverp;
+
+ public:
+
+ // unmanaged clone
+ Receiver(const ::qpid::messaging::Receiver & r,
+ Session ^ sessRef);
+
+ // copy constructor
+ Receiver(const Receiver ^ receiver);
+ Receiver(const Receiver % receiver);
+
+ // unmanaged clone
+ // undefined
+
+ ~Receiver();
+ !Receiver();
+
+ // assignment operator
+ Receiver % operator=(const Receiver % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ if (NULL != receiverp)
+ delete receiverp;
+ receiverp = new ::qpid::messaging::Receiver(
+ *(const_cast<Receiver %>(rhs).NativeReceiver));
+ parentSession = rhs.parentSession;
+ }
+ return *this;
+ }
+
+ property ::qpid::messaging::Receiver * NativeReceiver
+ {
+ ::qpid::messaging::Receiver * get () { return receiverp; }
+ }
+
+ // Get(message)
+ bool Get(Message ^% mmsgp);
+ bool Get(Message ^% mmsgp, Duration ^ durationp);
+
+ // message = Get()
+ Message ^ Get();
+ Message ^ Get(Duration ^ durationp);
+
+ // Fetch(message)
+ bool Fetch(Message ^% mmsgp);
+ bool Fetch(Message ^% mmsgp, Duration ^ duration);
+
+ // message = Fetch()
+ Message ^ Fetch();
+ Message ^ Fetch(Duration ^ durationp);
+
+ //
+ // Capacity
+ //
+ property System::UInt32 Capacity
+ {
+ void set (System::UInt32 capacity)
+ {
+ receiverp->setCapacity(capacity);
+ }
+
+ System::UInt32 get ()
+ {
+ return receiverp->getCapacity();
+ }
+ }
+
+ //
+ // Available
+ //
+ property System::UInt32 Available
+ {
+ System::UInt32 get ()
+ {
+ return receiverp->getAvailable();
+ }
+ }
+
+ //
+ // Unsettled
+ //
+ property System::UInt32 Unsettled
+ {
+ System::UInt32 get ()
+ {
+ return receiverp->getUnsettled();
+ }
+ }
+
+ void Close();
+
+ //
+ // IsClosed
+ //
+ property System::Boolean IsClosed
+ {
+ System::Boolean get ()
+ {
+ return receiverp->isClosed();
+ }
+ }
+
+ //
+ // Name
+ //
+ property System::String ^ Name
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(receiverp->getName().c_str());
+ }
+ }
+
+ //
+ // Session
+ //
+ property Org::Apache::Qpid::Messaging::Session ^ Session
+ {
+ Org::Apache::Qpid::Messaging::Session ^ get ()
+ {
+ return parentSession;
+ }
+ }
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
new file mode 100644
index 0000000000..3225f1a6e1
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp
@@ -0,0 +1,182 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Sender.h"
+#include "qpid/messaging/Session.h"
+#include "qpid/messaging/Message.h"
+
+#include "Sender.h"
+#include "Message.h"
+#include "QpidException.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Sender a managed wrapper for a ::qpid::messaging::Sender
+ /// </summary>
+
+ // unmanaged clone
+ Sender::Sender(const ::qpid::messaging::Sender & s,
+ Org::Apache::Qpid::Messaging::Session ^ sessRef) :
+ parentSession(sessRef)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ senderp = new ::qpid::messaging::Sender (s);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ // Destructor
+ Sender::~Sender()
+ {
+ this->!Sender();
+ }
+
+
+ // Finalizer
+ Sender::!Sender()
+ {
+ msclr::lock lk(this);
+
+ if (NULL != senderp)
+ {
+ delete senderp;
+ senderp = NULL;
+ }
+ }
+
+
+ // Copy constructor look-alike (C#)
+ Sender::Sender(const Sender ^ sender)
+ : parentSession(sender->parentSession)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ senderp = new ::qpid::messaging::Sender(
+ *(const_cast<Sender ^>(sender)->NativeSender));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Copy constructor implicitly dereferenced (C++)
+ Sender::Sender(const Sender % sender)
+ : parentSession(sender.parentSession)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ senderp = new ::qpid::messaging::Sender(
+ *(const_cast<Sender %>(sender).NativeSender));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ //
+ // Send(msg)
+ //
+ void Sender::Send(Message ^ mmsgp)
+ {
+ Send(mmsgp, false);
+ }
+
+ void Sender::Send(Message ^ mmsgp, bool sync)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ senderp->::qpid::messaging::Sender::send(*((*mmsgp).NativeMessage), sync);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ void Sender::Close()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ senderp->close();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Sender.h b/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
new file mode 100644
index 0000000000..4054e87316
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Sender.h
@@ -0,0 +1,135 @@
+/*
+* 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.
+*/
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Sender.h"
+#include "qpid/messaging/Session.h"
+#include "qpid/messaging/Message.h"
+
+namespace qpid {
+namespace messaging {
+ // Dummy class to satisfy linker
+ class SenderImpl {};
+}}
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Sender is a managed wrapper for a ::qpid::messaging::Sender
+ /// </summary>
+
+ ref class Session;
+ ref class Message;
+
+ public ref class Sender
+ {
+ private:
+ // The kept object in the Messaging C++ DLL
+ ::qpid::messaging::Sender * senderp;
+
+ // The session that created this Sender
+ Session ^ parentSession;
+
+ public:
+ // unmanaged clone
+ Sender(const ::qpid::messaging::Sender & s,
+ Session ^ sessRef);
+
+ // copy constructor
+ Sender(const Sender ^ sender);
+ Sender(const Sender % sender);
+
+ ~Sender();
+ !Sender();
+
+ // assignment operator
+ Sender % operator=(const Sender % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ if (NULL != senderp)
+ delete senderp;
+ senderp = new ::qpid::messaging::Sender(
+ *(const_cast<Sender %>(rhs).NativeSender));
+ parentSession = rhs.parentSession;
+ }
+ return *this;
+ }
+
+ property ::qpid::messaging::Sender * NativeSender
+ {
+ ::qpid::messaging::Sender * get () { return senderp; }
+ }
+
+
+ // Send(message)
+ void Send(Message ^ mmsgp);
+ void Send(Message ^ mmsgp, bool sync);
+
+ void Close();
+
+ property System::UInt32 Capacity
+ {
+ System::UInt32 get () { return senderp->getCapacity(); }
+ void set (System::UInt32 capacity) { senderp->setCapacity(capacity); }
+ }
+
+ property System::UInt32 Unsettled
+ {
+ System::UInt32 get () { return senderp->getUnsettled(); }
+ }
+
+ property System::UInt32 Available
+ {
+ System::UInt32 get () { return senderp->getAvailable(); }
+ }
+
+ property System::String ^ Name
+ {
+ System::String ^ get ()
+ {
+ return gcnew System::String(senderp->getName().c_str());
+ }
+ }
+
+ //
+ // Session
+ //
+ property Org::Apache::Qpid::Messaging::Session ^ Session
+ {
+ Org::Apache::Qpid::Messaging::Session ^ get ()
+ {
+ return parentSession;
+ }
+ }
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp b/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
new file mode 100644
index 0000000000..4a6199f108
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp
@@ -0,0 +1,635 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Session.h"
+#include "qpid/messaging/exceptions.h"
+
+#include "QpidMarshal.h"
+#include "Address.h"
+#include "Session.h"
+#include "Connection.h"
+#include "Duration.h"
+#include "Receiver.h"
+#include "Sender.h"
+#include "Message.h"
+#include "QpidException.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Session is a managed wrapper for a ::qpid::messaging::Session
+ /// </summary>
+
+ // unmanaged clone
+ Session::Session(const ::qpid::messaging::Session & session,
+ Org::Apache::Qpid::Messaging::Connection ^ connRef) :
+ parentConnectionp(connRef)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp = new ::qpid::messaging::Session (session);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ // Destructor
+ Session::~Session()
+ {
+ this->!Session();
+ }
+
+
+ // Finalizer
+ Session::!Session()
+ {
+ msclr::lock lk(this);
+
+ if (NULL != sessionp)
+ {
+ delete sessionp;
+ sessionp = NULL;
+ }
+ }
+
+
+ // Copy constructor look-alike (C#)
+ Session::Session(const Session ^ session)
+ : parentConnectionp(session->parentConnectionp)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp = new ::qpid::messaging::Session(
+ *(const_cast<Session ^>(session)->NativeSession));
+
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // Copy constructor implicitly dereferenced (C++)
+ Session::Session(const Session % session)
+ : parentConnectionp(session.parentConnectionp)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp = new ::qpid::messaging::Session(
+ *(const_cast<Session %>(session).NativeSession));
+
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+
+ void Session::Close()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->close();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Session::Commit()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->commit();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Session::Rollback()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->rollback();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Session::Acknowledge()
+ {
+ Acknowledge(false);
+ }
+
+ void Session::Acknowledge(bool sync)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->acknowledge(sync);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Session::Acknowledge(Message ^ message)
+ {
+ Acknowledge(message, false);
+ }
+
+ void Session::Acknowledge(Message ^ message, bool sync)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->acknowledge(*(message->NativeMessage), sync);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Session::Reject(Message ^ message)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->::qpid::messaging::Session::reject(*(message->NativeMessage));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Session::Release(Message ^ message)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->::qpid::messaging::Session::release(*(message->NativeMessage));
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ void Session::Sync()
+ {
+ Sync(true);
+ }
+
+ void Session::Sync(bool block)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->sync(block);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+
+ // next(receiver)
+ bool Session::NextReceiver(Receiver ^ rcvr)
+ {
+ return NextReceiver(rcvr, DurationConstants::FORVER);
+ }
+
+ bool Session::NextReceiver(Receiver ^ rcvr, Duration ^ timeout)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ // create a duration object
+ ::qpid::messaging::Duration dur(timeout->Milliseconds);
+
+ // wait for the next received message
+ return sessionp->nextReceiver(*(rcvr->NativeReceiver), dur);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ if ("No message to fetch" == errmsg){
+ return false;
+ }
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return true;
+ }
+
+ // receiver = next()
+ Receiver ^ Session::NextReceiver()
+ {
+ return NextReceiver(DurationConstants::FORVER);
+ }
+
+ Receiver ^ Session::NextReceiver(Duration ^ timeout)
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ ::qpid::messaging::Duration dur(timeout->Milliseconds);
+
+ ::qpid::messaging::Receiver receiver = sessionp->::qpid::messaging::Session::nextReceiver(dur);
+
+ Receiver ^ newRcvr = gcnew Receiver(receiver, this);
+
+ return newRcvr;
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ if ("No message to fetch" == errmsg)
+ {
+ return nullptr;
+ }
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return nullptr;
+ }
+
+
+ Sender ^ Session::CreateSender (System::String ^ address)
+ {
+ System::Exception ^ newException = nullptr;
+ Sender ^ newSender = nullptr;
+
+ try
+ {
+ // create the sender
+ ::qpid::messaging::Sender sender =
+ sessionp->::qpid::messaging::Session::createSender(QpidMarshal::ToNative(address));
+
+ // create a managed sender
+ newSender = gcnew Sender(sender, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newSender != nullptr)
+ {
+ delete newSender;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newSender;
+ }
+
+
+ Sender ^ Session::CreateSender (Address ^ address)
+ {
+ System::Exception ^ newException = nullptr;
+ Sender ^ newSender = nullptr;
+
+ try
+ {
+ // allocate a native sender
+ ::qpid::messaging::Sender sender =
+ sessionp->::qpid::messaging::Session::createSender(*(address->NativeAddress));
+
+ // create a managed sender
+ newSender = gcnew Sender(sender, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newSender != nullptr)
+ {
+ delete newSender;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newSender;
+ }
+
+
+ Receiver ^ Session::CreateReceiver(System::String ^ address)
+ {
+ System::Exception ^ newException = nullptr;
+ Receiver ^ newReceiver = nullptr;
+
+ try
+ {
+ // create the receiver
+ ::qpid::messaging::Receiver receiver =
+ sessionp->createReceiver(QpidMarshal::ToNative(address));
+
+ // create a managed receiver
+ newReceiver = gcnew Receiver(receiver, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newReceiver != nullptr)
+ {
+ delete newReceiver;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newReceiver;
+ }
+
+
+ Receiver ^ Session::CreateReceiver(Address ^ address)
+ {
+ System::Exception ^ newException = nullptr;
+ Receiver ^ newReceiver = nullptr;
+
+ try
+ {
+ // create the receiver
+ ::qpid::messaging::Receiver receiver =
+ sessionp->createReceiver(*(address->NativeAddress));
+
+ // create a managed receiver
+ newReceiver = gcnew Receiver(receiver, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newReceiver != nullptr)
+ {
+ delete newReceiver;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newReceiver;
+ }
+
+
+ Sender ^ Session::GetSender(System::String ^ name)
+ {
+ System::Exception ^ newException = nullptr;
+ Sender ^ newSender = nullptr;
+
+ try
+ {
+ ::qpid::messaging::Sender senderp =
+ sessionp->::qpid::messaging::Session::getSender(QpidMarshal::ToNative(name));
+
+ newSender = gcnew Sender(senderp, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newSender != nullptr)
+ {
+ delete newSender;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newSender;
+ }
+
+
+
+ Receiver ^ Session::GetReceiver(System::String ^ name)
+ {
+ System::Exception ^ newException = nullptr;
+ Receiver ^ newReceiver = nullptr;
+
+ try
+ {
+ ::qpid::messaging::Receiver receiver =
+ sessionp->::qpid::messaging::Session::getReceiver(QpidMarshal::ToNative(name));
+
+ newReceiver = gcnew Receiver(receiver, this);
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+ finally
+ {
+ if (newException != nullptr)
+ {
+ if (newReceiver != nullptr)
+ {
+ delete newReceiver;
+ }
+ }
+ }
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+
+ return newReceiver;
+ }
+
+
+
+ void Session::CheckError()
+ {
+ System::Exception ^ newException = nullptr;
+
+ try
+ {
+ sessionp->checkError();
+ }
+ catch (const ::qpid::types::Exception & error)
+ {
+ String ^ errmsg = gcnew String(error.what());
+ newException = gcnew QpidException(errmsg);
+ }
+
+ if (newException != nullptr)
+ {
+ throw newException;
+ }
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/Session.h b/qpid/cpp/bindings/qpid/dotnet/src/Session.h
new file mode 100644
index 0000000000..4d4cad75c4
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/Session.h
@@ -0,0 +1,156 @@
+/*
+* 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.
+*/
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/messaging/Session.h"
+#include "qpid/messaging/Connection.h"
+#include "qpid/messaging/Duration.h"
+#include "qpid/messaging/Receiver.h"
+#include "qpid/messaging/Sender.h"
+
+namespace qpid {
+namespace messaging {
+ // Dummy class to satisfy linker
+ class SessionImpl {};
+}}
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Session is a managed wrapper for a ::qpid::messaging::Session
+ /// </summary>
+
+ ref class Address;
+ ref class Connection;
+ ref class Duration;
+ ref class Receiver;
+ ref class Sender;
+ ref class Message;
+
+ public ref class Session
+ {
+ private:
+ // The kept object in the Messaging C++ DLL
+ ::qpid::messaging::Session * sessionp;
+
+ // The connection that created this session
+ Connection ^ parentConnectionp;
+
+ public:
+
+ // unmanaged clone
+ Session(const ::qpid::messaging::Session & sessionp,
+ Connection ^ connRef);
+
+ // copy constructor
+ Session(const Session ^ session);
+ Session(const Session % session);
+
+ ~Session();
+ !Session();
+
+ // assignment operator
+ Session % operator=(const Session % rhs)
+ {
+ if (this == %rhs)
+ {
+ // Self assignment, do nothing
+ }
+ else
+ {
+ if (NULL != sessionp)
+ delete sessionp;
+ sessionp = new ::qpid::messaging::Session(
+ *(const_cast<Session %>(rhs).NativeSession) );
+ parentConnectionp = rhs.parentConnectionp;
+ }
+ return *this;
+ }
+
+ property ::qpid::messaging::Session * NativeSession
+ {
+ ::qpid::messaging::Session * get () { return sessionp; }
+ }
+
+ void Close();
+ void Commit();
+ void Rollback();
+ void Acknowledge();
+ void Acknowledge(bool sync);
+ void Acknowledge(Message ^ message);
+ void Acknowledge(Message ^ message, bool sync);
+ void Reject(Message ^);
+ void Release(Message ^);
+ void Sync();
+ void Sync(bool block);
+
+ property System::UInt32 Receivable
+ {
+ System::UInt32 get () { return sessionp->getReceivable(); }
+ }
+
+ property System::UInt32 UnsettledAcks
+ {
+ System::UInt32 get () { return sessionp->getUnsettledAcks(); }
+ }
+
+ // next(receiver)
+ bool NextReceiver(Receiver ^ rcvr);
+ bool NextReceiver(Receiver ^ rcvr, Duration ^ timeout);
+
+ // receiver = next()
+ Receiver ^ NextReceiver();
+ Receiver ^ NextReceiver(Duration ^ timeout);
+
+
+ Sender ^ CreateSender(System::String ^ address);
+ Sender ^ CreateSender(Address ^ address);
+
+ Receiver ^ CreateReceiver(System::String ^ address);
+ Receiver ^ CreateReceiver(Address ^ address);
+
+ Sender ^ GetSender(System::String ^ name);
+ Receiver ^ GetReceiver(System::String ^ name);
+
+ property Org::Apache::Qpid::Messaging::Connection ^ Connection
+ {
+ Org::Apache::Qpid::Messaging::Connection ^ get ()
+ {
+ return parentConnectionp;
+ }
+ }
+
+
+ property System::Boolean HasError
+ {
+ System::Boolean get () { return sessionp->hasError(); }
+ }
+
+ void CheckError();
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp b/qpid/cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp
new file mode 100644
index 0000000000..b515095323
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp
@@ -0,0 +1,455 @@
+/*
+* 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 <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <typeinfo.h>
+#include <string>
+#include <limits>
+#include <iostream>
+
+#include "TypeTranslator.h"
+#include "QpidTypeCheck.h"
+#include "QpidMarshal.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// Translate between managed and native types.
+ /// </summary>
+
+ //
+ // The given object is a Dictionary.
+ // Add its elements to the qpid map.
+ //
+ void TypeTranslator::ManagedToNative(QpidMap ^ theDictionary,
+ ::qpid::types::Variant::Map & qpidMap)
+ {
+ // iterate the items, converting each to a variant and adding to the map
+ for each (System::Collections::Generic::KeyValuePair
+ <System::String^, System::Object^> kvp in theDictionary)
+ {
+ if (QpidTypeCheck::ObjectIsMap(kvp.Value))
+ {
+ // Recurse on inner map
+ // Allocate a map
+ ::qpid::types::Variant::Map newMap;
+
+ // Add the map variables to the map
+ ManagedToNative((QpidMap ^)kvp.Value, newMap);
+
+ // Create a variant entry for the inner map
+ std::auto_ptr<::qpid::types::Variant> newVariantp(new ::qpid::types::Variant(newMap));
+
+ // Get map's name
+ std::string entryName = QpidMarshal::ToNative(kvp.Key);
+
+ // Add inner map to outer map
+ qpidMap.insert(std::make_pair<std::string, ::qpid::types::Variant>(entryName, *newVariantp));
+ }
+ else if (QpidTypeCheck::ObjectIsList(kvp.Value))
+ {
+ // Recurse on inner list
+ // Allocate a list
+ ::qpid::types::Variant::List newList;
+
+ // Add the List variables to the list
+ ManagedToNative((QpidList ^)kvp.Value, newList);
+
+ // Create a variant entry for the inner map
+ ::qpid::types::Variant::List newVariant(newList);
+
+ //std::auto_ptr<::qpid::types::Variant> newVariantp(new ::qpid::types::Variant(newList));
+
+ // Get list's name
+ std::string entryName = QpidMarshal::ToNative(kvp.Key);
+
+ // Add inner list to outer map
+ qpidMap.insert(std::make_pair<std::string, ::qpid::types::Variant>(entryName, newVariant));
+ }
+ else
+ {
+ // Add a simple native type to map
+ ::qpid::types::Variant entryValue;
+ if (nullptr != kvp.Value)
+ {
+ ManagedToNativeObject(kvp.Value, entryValue);
+ }
+ std::string entryName = QpidMarshal::ToNative(kvp.Key);
+ qpidMap.insert(std::make_pair<std::string, ::qpid::types::Variant>(entryName, entryValue));
+ }
+ }
+ }
+
+
+
+ //
+ // The given object is a List.
+ // Add its elements to the qpid list.
+ //
+ void TypeTranslator::ManagedToNative(QpidList ^ theList,
+ ::qpid::types::Variant::List & qpidList)
+ {
+ // iterate the items, converting each to a variant and adding to the map
+ for each (System::Object ^ listObj in theList)
+ {
+ if (QpidTypeCheck::ObjectIsMap(listObj))
+ {
+ // Recurse on inner map
+ // Allocate a map
+ ::qpid::types::Variant::Map newMap;
+
+ // Add the map variables to the map
+ ManagedToNative((QpidMap ^)listObj, newMap);
+
+ // Create a variant entry for the inner map
+ std::auto_ptr<::qpid::types::Variant> newVariantp(new ::qpid::types::Variant(newMap));
+
+ // Add inner map to outer list
+ qpidList.push_back(*newVariantp);
+ }
+ else if (QpidTypeCheck::ObjectIsList(listObj))
+ {
+ // Recurse on inner list
+ // Allocate a list
+ ::qpid::types::Variant::List newList;
+
+ // Add the List variables to the list
+ ManagedToNative((QpidList ^)listObj, newList);
+
+ // Create a variant entry for the inner list
+ std::auto_ptr<::qpid::types::Variant> newVariantp(new ::qpid::types::Variant(newList));
+
+ // Add inner list to outer list
+ qpidList.push_back(*newVariantp);
+ }
+ else
+ {
+ // Add a simple native type to list
+ ::qpid::types::Variant entryValue;
+ if (nullptr != listObj)
+ {
+ ManagedToNativeObject(listObj, entryValue);
+ }
+ qpidList.push_back(entryValue);
+ }
+ }
+ }
+
+
+
+ //
+ // Returns a variant representing simple native type object.
+ // Not to be called for Map/List objects.
+ //
+ void TypeTranslator::ManagedToNativeObject(System::Object ^ managedValue,
+ ::qpid::types::Variant & qpidVariant)
+ {
+ System::Type ^ typeP = (*managedValue).GetType();
+ System::TypeCode typeCode = System::Type::GetTypeCode( typeP );
+
+ switch (typeCode)
+ {
+ case System::TypeCode::Boolean :
+ qpidVariant = System::Convert::ToBoolean(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::Byte :
+ qpidVariant = System::Convert::ToByte(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::UInt16 :
+ qpidVariant = System::Convert::ToUInt16(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::UInt32 :
+ qpidVariant = System::Convert::ToUInt32(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::UInt64 :
+ qpidVariant = System::Convert::ToUInt64(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::Char :
+ case System::TypeCode::SByte :
+ qpidVariant = System::Convert::ToSByte(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::Int16 :
+ qpidVariant = System::Convert::ToInt16(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::Int32 :
+ qpidVariant = System::Convert::ToInt32(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::Int64 :
+ qpidVariant = System::Convert::ToInt64(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::Single :
+ qpidVariant = System::Convert::ToSingle(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::Double :
+ qpidVariant = System::Convert::ToDouble(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ break;
+
+ case System::TypeCode::String :
+ {
+ std::string rString;
+ System::String ^ rpString;
+
+ rpString = System::Convert::ToString(managedValue, System::Globalization::CultureInfo::InvariantCulture);
+ rString = QpidMarshal::ToNative(rpString);
+ qpidVariant = rString;
+ qpidVariant.setEncoding(QpidMarshal::ToNative("utf8"));
+ }
+ break;
+
+ case System::TypeCode::Object :
+ {
+ //
+ // Derived classes
+ //
+ if ("System.Guid" == typeP->ToString())
+ {
+ cli::array<System::Byte> ^ guidBytes = ((System::Guid)managedValue).ToByteArray();
+ pin_ptr<unsigned char> pinnedBuf = &guidBytes[0];
+ ::qpid::types::Uuid newUuid = ::qpid::types::Uuid(pinnedBuf);
+ qpidVariant = newUuid;
+ }
+ else
+ {
+ throw gcnew System::NotImplementedException();
+ }
+ }
+ break;
+
+ default:
+
+ throw gcnew System::NotImplementedException();
+
+ }
+ }
+
+
+ // Given a user Dictionary and a qpid map,
+ // extract the qpid elements and put them into the dictionary.
+ //
+ void TypeTranslator::NativeToManaged(::qpid::types::Variant::Map & qpidMap,
+ QpidMap ^ dict)
+ {
+ // For each object in the message map,
+ // create a .NET object and add it to the dictionary.
+ for (::qpid::types::Variant::Map::const_iterator i = qpidMap.begin(); i != qpidMap.end(); ++i) {
+ // Get the name
+ System::String ^ elementName = gcnew String(i->first.c_str());
+
+ ::qpid::types::Variant variant = i->second;
+ ::qpid::types::VariantType vType = variant.getType();
+
+ switch (vType)
+ {
+ case ::qpid::types::VAR_VOID:
+ dict[elementName] = nullptr;
+ break;
+
+ case ::qpid::types::VAR_BOOL:
+ dict[elementName] = variant.asBool();
+ break;
+
+ case ::qpid::types::VAR_UINT8:
+ dict[elementName] = variant.asUint8();
+ break;
+
+ case ::qpid::types::VAR_UINT16:
+ dict[elementName] = variant.asUint16();
+ break;
+
+ case ::qpid::types::VAR_UINT32:
+ dict[elementName] = variant.asUint32();
+ break;
+
+ case ::qpid::types::VAR_UINT64:
+ dict[elementName] = variant.asUint64();
+ break;
+
+ case ::qpid::types::VAR_INT8:
+ dict[elementName] = variant.asInt8();
+ break;
+
+ case ::qpid::types::VAR_INT16:
+ dict[elementName] = variant.asInt16();
+ break;
+
+ case ::qpid::types::VAR_INT32:
+ dict[elementName] = variant.asInt32();
+ break;
+
+ case ::qpid::types::VAR_INT64:
+ dict[elementName] = variant.asInt64();
+ break;
+
+ case ::qpid::types::VAR_FLOAT:
+ dict[elementName] = variant.asFloat();
+ break;
+
+ case ::qpid::types::VAR_DOUBLE:
+ dict[elementName] = variant.asDouble();
+ break;
+
+ case ::qpid::types::VAR_STRING:
+ {
+ System::String ^ elementValue = gcnew System::String(variant.asString().c_str());
+ dict[elementName] = elementValue;
+ break;
+ }
+ case ::qpid::types::VAR_MAP:
+ {
+ QpidMap ^ newDict = gcnew QpidMap();
+
+ NativeToManaged(variant.asMap(), newDict);
+
+ dict[elementName] = newDict;
+ break;
+ }
+
+ case ::qpid::types::VAR_LIST:
+ {
+ QpidList ^ newList = gcnew QpidList();
+
+ NativeToManaged(variant.asList(), newList);
+
+ dict[elementName] = newList;
+ break;
+ }
+
+ case ::qpid::types::VAR_UUID:
+ {
+ System::String ^ elementValue = gcnew System::String(variant.asUuid().str().c_str());
+ System::Guid ^ newGuid = System::Guid(elementValue);
+ dict[elementName] = newGuid;
+ }
+ break;
+ }
+ }
+ }
+
+
+ void TypeTranslator::NativeToManaged(::qpid::types::Variant::List & qpidList, QpidList ^ managedList)
+ {
+ // For each object in the qpidList
+ // create a .NET object and add it to the managed List.
+ for (::qpid::types::Variant::List::const_iterator i = qpidList.begin(); i != qpidList.end(); ++i)
+ {
+ ::qpid::types::Variant variant = *i;
+ ::qpid::types::VariantType vType = variant.getType();
+
+ switch (vType)
+ {
+ case ::qpid::types::VAR_VOID:
+ (*managedList).Add(nullptr);
+ break;
+
+ case ::qpid::types::VAR_BOOL:
+ (*managedList).Add(variant.asBool());
+ break;
+
+ case ::qpid::types::VAR_UINT8:
+ (*managedList).Add(variant.asUint8());
+ break;
+
+ case ::qpid::types::VAR_UINT16:
+ (*managedList).Add(variant.asUint16());
+ break;
+
+ case ::qpid::types::VAR_UINT32:
+ (*managedList).Add(variant.asUint32());
+ break;
+
+ case ::qpid::types::VAR_UINT64:
+ (*managedList).Add(variant.asUint64());
+ break;
+
+ case ::qpid::types::VAR_INT8:
+ (*managedList).Add(variant.asInt8());
+ break;
+
+ case ::qpid::types::VAR_INT16:
+ (*managedList).Add(variant.asInt16());
+ break;
+
+ case ::qpid::types::VAR_INT32:
+ (*managedList).Add(variant.asInt32());
+ break;
+
+ case ::qpid::types::VAR_INT64:
+ (*managedList).Add(variant.asInt64());
+ break;
+
+ case ::qpid::types::VAR_FLOAT:
+ (*managedList).Add(variant.asFloat());
+ break;
+
+ case ::qpid::types::VAR_DOUBLE:
+ (*managedList).Add(variant.asDouble());
+ break;
+
+ case ::qpid::types::VAR_STRING:
+ {
+ System::String ^ elementValue = gcnew System::String(variant.asString().c_str());
+ (*managedList).Add(elementValue);
+ break;
+ }
+ case ::qpid::types::VAR_MAP:
+ {
+ QpidMap ^ newDict = gcnew QpidMap();
+
+ NativeToManaged(variant.asMap(), newDict);
+
+ (*managedList).Add(newDict);
+ break;
+ }
+
+ case ::qpid::types::VAR_LIST:
+ {
+ QpidList ^ newList = gcnew QpidList();
+
+ NativeToManaged(variant.asList(), newList);
+
+ (*managedList).Add(newList);
+ break;
+ }
+
+ case ::qpid::types::VAR_UUID:
+ {
+ System::String ^ elementValue = gcnew System::String(variant.asUuid().str().c_str());
+ System::Guid ^ newGuid = System::Guid(elementValue);
+ (*managedList).Add(newGuid);
+ }
+ break;
+ }
+ }
+ }
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/TypeTranslator.h b/qpid/cpp/bindings/qpid/dotnet/src/TypeTranslator.h
new file mode 100644
index 0000000000..df12689cf8
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/TypeTranslator.h
@@ -0,0 +1,71 @@
+/*
+* 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.
+*/
+#pragma once
+
+#include <windows.h>
+#include <msclr\lock.h>
+#include <oletx2xa.h>
+#include <string>
+#include <limits>
+
+#include "qpid/types/Variant.h"
+
+#include "QpidTypeCheck.h"
+
+namespace Org {
+namespace Apache {
+namespace Qpid {
+namespace Messaging {
+
+ /// <summary>
+ /// TypeTranslator provides codec between .NET Dictionary/List and
+ /// qpid messaging Map/List.
+ /// </summary>
+ public ref class TypeTranslator sealed
+ {
+ private:
+ TypeTranslator::TypeTranslator() {}
+
+ public:
+ // The given object is a managed Dictionary.
+ // Add its elements to the qpid map.
+ static void ManagedToNative(QpidMap ^ theDictionary,
+ ::qpid::types::Variant::Map & qpidMap);
+
+ // The given object is a managed List.
+ // Add its elements to the qpid list.
+ static void ManagedToNative(QpidList ^ theList,
+ ::qpid::types::Variant::List & qpidList);
+
+ // The given object is a simple managed type (not a Dictionary or List)
+ // Returns a variant representing simple native type object.
+ static void ManagedToNativeObject(System::Object ^ managedValue,
+ ::qpid::types::Variant & qpidVariant);
+
+ // The given object is a qpid map.
+ // Add its elements to the managed Dictionary.
+ static void NativeToManaged(::qpid::types::Variant::Map & qpidMap,
+ QpidMap ^ dict);
+
+ // The given object is a qpid list.
+ // Add its elements to the managed List.
+ static void NativeToManaged(::qpid::types::Variant::List & qpidList,
+ QpidList ^ managedList);
+ };
+}}}}
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/app.rc b/qpid/cpp/bindings/qpid/dotnet/src/app.rc
new file mode 100644
index 0000000000..35b3d8df68
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/app.rc
@@ -0,0 +1,82 @@
+//
+// 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.
+//
+
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon placed first or with lowest ID value becomes application icon
+
+LANGUAGE 9, 1
+#pragma code_page(1252)
+1 ICON "app.ico"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+ "\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.template.rc b/qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.template.rc
new file mode 100644
index 0000000000..85b15646f3
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.template.rc
@@ -0,0 +1,120 @@
+//
+// 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.
+//
+
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource1.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource1.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION ${winver_FILE_VERSION_N1},${winver_FILE_VERSION_N2},${winver_FILE_VERSION_N3},${winver_FILE_VERSION_N4}
+ PRODUCTVERSION ${winver_PRODUCT_VERSION_N1},${winver_PRODUCT_VERSION_N2},${winver_PRODUCT_VERSION_N3},${winver_PRODUCT_VERSION_N4}
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "org.apache.qpid.messaging"
+ VALUE "FileVersion", "${winver_FILE_VERSION_N1}, ${winver_FILE_VERSION_N2}, ${winver_FILE_VERSION_N3}, ${winver_FILE_VERSION_N4}"
+ VALUE "InternalName", "org.apache.qpid.messaging"
+ VALUE "LegalCopyright", ""
+ VALUE "OriginalFilename", "org.apache.qpid.messaging"
+ VALUE "ProductName", "org.apache.qpid.messaging"
+ VALUE "ProductVersion", "${winver_PRODUCT_VERSION_N1}, ${winver_PRODUCT_VERSION_N2}, ${winver_PRODUCT_VERSION_N3}, ${winver_PRODUCT_VERSION_N4}"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj b/qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj
new file mode 100644
index 0000000000..f3a0071aeb
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj
@@ -0,0 +1,644 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<!--
+
+ 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.
+
+-->
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="Org.Apache.Qpid.Messaging"
+ ProjectGUID="{AA5A3B83-5F98-406D-A01C-5A921467A57D}"
+ RootNamespace="org.apache.qpid.messaging"
+ Keyword="ManagedCProj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ProjectDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ ManagedExtensions="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=" /Zm1000 /wd4244 /wd4800 /wd4355"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\..\..\include&quot;;&quot;$(ProjectDir)..\..\..\..\src&quot;"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;WIN32_LEAN_AND_MEAN"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" /STACK:10000000 /machine:I386"
+ AdditionalDependencies="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidclientd.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidcommond.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidmessagingd.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidtypesd.lib"
+ OutputFile="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\org.apache.qpid.messaging.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ TargetMachine="1"
+ KeyFile="qpid.snk"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(ProjectDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ ManagedExtensions="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=" /Zm1000 /wd4244 /wd4800 /wd4355"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\..\..\include&quot;;&quot;$(ProjectDir)..\..\..\..\src&quot;"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;WIN32_LEAN_AND_MEAN"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" /STACK:10000000"
+ AdditionalDependencies="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidclientd.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidcommond.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidmessagingd.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidtypesd.lib"
+ OutputFile="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\org.apache.qpid.messaging.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ TargetMachine="17"
+ KeyFile="qpid.snk"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ProjectDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ ManagedExtensions="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=" /Zm1000 /wd4244 /wd4800 /wd4355"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\..\..\include&quot;;&quot;$(ProjectDir)..\..\..\..\src&quot;"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WIN32_LEAN_AND_MEAN"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" /STACK:10000000 /machine:I386"
+ AdditionalDependencies="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidclient.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidcommon.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidmessaging.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidtypes.lib"
+ OutputFile="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\org.apache.qpid.messaging.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ TargetMachine="1"
+ KeyFile="qpid.snk"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(ProjectDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ ManagedExtensions="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=" /Zm1000 /wd4244 /wd4800 /wd4355"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\..\..\include&quot;;&quot;$(ProjectDir)..\..\..\..\src&quot;"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WIN32_LEAN_AND_MEAN"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" /STACK:10000000"
+ AdditionalDependencies="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidclient.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidcommon.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidmessaging.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidtypes.lib"
+ OutputFile="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\org.apache.qpid.messaging.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ TargetMachine="17"
+ KeyFile="qpid.snk"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="RelWithDebInfo|Win32"
+ OutputDirectory="$(ProjectDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ ManagedExtensions="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=" /Zm1000 /wd4244 /wd4800 /wd4355"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\..\..\include&quot;;&quot;$(ProjectDir)..\..\..\..\src&quot;"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WIN32_LEAN_AND_MEAN"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" /STACK:10000000 /machine:I386"
+ AdditionalDependencies="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidclient.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidcommon.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidmessaging.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidtypes.lib"
+ OutputFile="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\org.apache.qpid.messaging.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ TargetMachine="1"
+ KeyFile="qpid.snk"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="RelWithDebInfo|x64"
+ OutputDirectory="$(ProjectDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ ManagedExtensions="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=" /Zm1000 /wd4244 /wd4800 /wd4355"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\..\..\include&quot;;&quot;$(ProjectDir)..\..\..\..\src&quot;"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;WIN32_LEAN_AND_MEAN"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" /STACK:10000000"
+ AdditionalDependencies="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidclient.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidcommon.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidmessaging.lib $(QPID_BUILD_ROOT)\src\$(ConfigurationName)\qpidtypes.lib"
+ OutputFile="$(QPID_BUILD_ROOT)\src\$(ConfigurationName)\org.apache.qpid.messaging.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ TargetMachine="17"
+ KeyFile="qpid.snk"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ <AssemblyReference
+ RelativePath="System.dll"
+ AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
+ MinFrameworkVersion="131072"
+ />
+ <AssemblyReference
+ RelativePath="System.Data.dll"
+ AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
+ MinFrameworkVersion="131072"
+ />
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\Address.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AssemblyInfo.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Connection.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\FailoverUpdates.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Message.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Receiver.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Sender.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Session.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\TypeTranslator.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\Address.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Connection.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Duration.h"
+ >
+ </File>
+ <File
+ RelativePath=".\FailoverUpdates.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Message.h"
+ >
+ </File>
+ <File
+ RelativePath=".\QpidException.h"
+ >
+ </File>
+ <File
+ RelativePath=".\QpidMarshal.h"
+ >
+ </File>
+ <File
+ RelativePath=".\QpidTypeCheck.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Receiver.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Sender.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Session.h"
+ >
+ </File>
+ <File
+ RelativePath=".\TypeTranslator.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\app.ico"
+ >
+ </File>
+ <File
+ RelativePath="$(QPID_BUILD_ROOT)\src\windows\resources\org.apache.qpid.messaging.rc"
+ >
+ </File>
+ <File
+ RelativePath=".\resource1.h"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/qpid.snk b/qpid/cpp/bindings/qpid/dotnet/src/qpid.snk
new file mode 100644
index 0000000000..9faafd8f8b
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/qpid.snk
Binary files differ
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/resource1.h b/qpid/cpp/bindings/qpid/dotnet/src/resource1.h
new file mode 100644
index 0000000000..98830aba70
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/resource1.h
@@ -0,0 +1,34 @@
+//{{NO_DEPENDENCIES}}
+
+//
+// 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.
+//
+
+// Microsoft Visual C++ generated include file.
+// Used by org.apache.qpid.messaging.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/Properties/sessionreceiver-AssemblyInfo-template.cs b/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/Properties/sessionreceiver-AssemblyInfo-template.cs
new file mode 100644
index 0000000000..de057ce9be
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/Properties/sessionreceiver-AssemblyInfo-template.cs
@@ -0,0 +1,55 @@
+/*
+* 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.
+*/
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Org.Apache.Qpid.Messaging.SessionReceiver")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Org.Apache.Qpid.Messaging.SessionReceiver")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e18f363a-a9b0-4251-8f3c-de0e9d9d6827")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("${winver_PRODUCT_VERSION_N1}.${winver_PRODUCT_VERSION_N2}.${winver_PRODUCT_VERSION_N3}.${winver_PRODUCT_VERSION_N4}")]
+[assembly: AssemblyFileVersion("${winver_FILE_VERSION_N1}.${winver_FILE_VERSION_N2}.${winver_FILE_VERSION_N3}.${winver_FILE_VERSION_N4}")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj b/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj
new file mode 100644
index 0000000000..bc3ce57cf3
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>org.apache.qpid.messaging.sessionreceiver</RootNamespace>
+ <AssemblyName>org.apache.qpid.messaging.sessionreceiver</AssemblyName>
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <SignAssembly>true</SignAssembly>
+ <AssemblyOriginatorKeyFile>qpid.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RelWithDebInfo|AnyCPU' ">
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RelWithDebInfo|x86' ">
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RelWithDebInfo|x64' ">
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="sessionreceiver.cs" />
+ <Compile Include="$(QPID_BUILD_ROOT)\src\windows\generated_src\sessionreceiver-AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="qpid.snk" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/qpid.snk b/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/qpid.snk
new file mode 100644
index 0000000000..9faafd8f8b
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/qpid.snk
Binary files differ
diff --git a/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs b/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs
new file mode 100644
index 0000000000..680732068f
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/src/sessionreceiver/sessionreceiver.cs
@@ -0,0 +1,133 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging.SessionReceiver
+{
+ /// <summary>
+ /// ISessionReceiver interface defines the callback for users to supply.
+ /// Once established this callback will receive all messages for all
+ /// receivers defined by the current session.
+ /// Users are expected not to 'fetch' or 'get' messages by any other means.
+ /// Users must acknowledge() the Session's messages either in the callback
+ /// function or by some other scheme.
+ /// </summary>
+
+ public interface ISessionReceiver
+ {
+ void SessionReceiver(Receiver receiver, Message message);
+ }
+
+
+ /// <summary>
+ /// EventEngine - wait for messages from the underlying C++ code.
+ /// When available get them and deliver them via callback to our
+ /// client through the ISessionReceiver interface.
+ /// This class consumes the thread that calls the Run() function.
+ /// </summary>
+
+ internal class EventEngine
+ {
+ private Session session;
+ private ISessionReceiver callback;
+ private bool keepRunning;
+
+ public EventEngine(Session theSession, ISessionReceiver thecallback)
+ {
+ this.session = theSession;
+ this.callback = thecallback;
+ }
+
+ /// <summary>
+ /// Function to call Session's nextReceiver, discover messages,
+ /// and to deliver messages through the callback.
+ /// </summary>
+ public void Open()
+ {
+ Receiver rcvr;
+ Message msg;
+
+ keepRunning = true;
+ while (keepRunning)
+ {
+ rcvr = session.NextReceiver(DurationConstants.SECOND);
+
+ if (null != rcvr)
+ {
+ if (keepRunning)
+ {
+ msg = rcvr.Fetch(DurationConstants.SECOND);
+ this.callback.SessionReceiver(rcvr, msg);
+ }
+ }
+ //else
+ // receive timed out
+ // EventEngine exits the nextReceiver() function periodically
+ // in order to test the keepRunning flag
+ }
+ // Private thread is now exiting.
+ }
+
+ /// <summary>
+ /// Function to stop the EventEngine. Private thread will exit within
+ /// one second.
+ /// </summary>
+ public void Close()
+ {
+ keepRunning = false;
+ }
+ }
+
+
+ /// <summary>
+ /// server is the class that users instantiate to connect a SessionReceiver
+ /// callback to the stream of received messages received on a Session.
+ /// </summary>
+ public class CallbackServer
+ {
+ private EventEngine ee;
+
+ /// <summary>
+ /// Constructor for the server.
+ /// </summary>
+ /// <param name="session">The Session whose messages are collected.</param>
+ /// <param name="callback">The user function call with each message.</param>
+ ///
+ public CallbackServer(Session session, ISessionReceiver callback)
+ {
+ ee = new EventEngine(session, callback);
+
+ new System.Threading.Thread(
+ new System.Threading.ThreadStart(ee.Open)).Start();
+ }
+
+ /// <summary>
+ /// Function to stop the server.
+ /// </summary>
+ public void Close()
+ {
+ ee.Close();
+ }
+ }
+}