summaryrefslogtreecommitdiff
path: root/qpid/cpp/bindings
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2011-05-27 15:44:23 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2011-05-27 15:44:23 +0000
commit66765100f4257159622cefe57bed50125a5ad017 (patch)
treea88ee23bb194eb91f0ebb2d9b23ff423e3ea8e37 /qpid/cpp/bindings
parent1aeaa7b16e5ce54f10c901d75c4d40f9f88b9db6 (diff)
parent88b98b2f4152ef59a671fad55a0d08338b6b78ca (diff)
downloadqpid-python-rajith_jms_client.tar.gz
Creating a branch for experimenting with some ideas for JMS client.rajith_jms_client
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/rajith_jms_client@1128369 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bindings')
-rw-r--r--qpid/cpp/bindings/qmf/Makefile.am33
-rw-r--r--qpid/cpp/bindings/qmf/python/Makefile.am51
-rw-r--r--qpid/cpp/bindings/qmf/python/python.i143
-rw-r--r--qpid/cpp/bindings/qmf/python/qmf.py1680
-rw-r--r--qpid/cpp/bindings/qmf/qmfengine.i59
-rw-r--r--qpid/cpp/bindings/qmf/ruby/Makefile.am45
-rw-r--r--qpid/cpp/bindings/qmf/ruby/qmf.rb1522
-rw-r--r--qpid/cpp/bindings/qmf/ruby/ruby.i106
-rw-r--r--qpid/cpp/bindings/qmf/tests/Makefile.am27
-rwxr-xr-xqpid/cpp/bindings/qmf/tests/agent_ruby.rb279
-rw-r--r--qpid/cpp/bindings/qmf/tests/python_agent.py326
-rwxr-xr-xqpid/cpp/bindings/qmf/tests/python_console.py311
-rwxr-xr-xqpid/cpp/bindings/qmf/tests/ruby_console.rb174
-rwxr-xr-xqpid/cpp/bindings/qmf/tests/ruby_console_test.rb397
-rwxr-xr-xqpid/cpp/bindings/qmf/tests/run_interop_tests135
-rw-r--r--qpid/cpp/bindings/qmf/tests/test_base.rb82
-rw-r--r--qpid/cpp/bindings/qmf2/Makefile.am33
-rw-r--r--qpid/cpp/bindings/qmf2/examples/cpp/Makefile.am33
-rw-r--r--qpid/cpp/bindings/qmf2/examples/cpp/agent.cpp250
-rw-r--r--qpid/cpp/bindings/qmf2/examples/cpp/list_agents.cpp73
-rw-r--r--qpid/cpp/bindings/qmf2/examples/cpp/print_events.cpp64
-rwxr-xr-xqpid/cpp/bindings/qmf2/examples/python/agent.py196
-rw-r--r--qpid/cpp/bindings/qmf2/examples/python/find_agents.py57
-rw-r--r--qpid/cpp/bindings/qmf2/examples/ruby/agent_external.rb84
-rw-r--r--qpid/cpp/bindings/qmf2/examples/ruby/agent_internal.rb77
-rw-r--r--qpid/cpp/bindings/qmf2/examples/ruby/find_agents.rb63
-rw-r--r--qpid/cpp/bindings/qmf2/python/Makefile.am49
-rw-r--r--qpid/cpp/bindings/qmf2/python/python.i41
-rw-r--r--qpid/cpp/bindings/qmf2/python/qmf2.py933
-rw-r--r--qpid/cpp/bindings/qmf2/qmf2.i66
-rw-r--r--qpid/cpp/bindings/qmf2/ruby/Makefile.am44
-rw-r--r--qpid/cpp/bindings/qmf2/ruby/qmf2.rb855
-rw-r--r--qpid/cpp/bindings/qmf2/ruby/ruby.i35
-rw-r--r--qpid/cpp/bindings/qpid/CMakeLists.txt41
-rw-r--r--qpid/cpp/bindings/qpid/Makefile.am38
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/Makefile.am126
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/ReadMe.txt94
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/configure-windows.ps1522
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.cs79
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.cs80
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/csharp.example.client.cs75
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/csharp.example.client.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/csharp.example.declare_queues.cs60
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/Options.cs175
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs88
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.csproj103
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs55
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/csharp.example.server.cs66
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/csharp.example.server.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/Options.cs185
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/csharp.example.spout.cs120
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/csharp.example.spout.csproj106
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/Properties/AssemblyInfo.cs54
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs286
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj109
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/Properties/AssemblyInfo.cs54
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.cs194
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj107
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/csharp.map.receiver.cs87
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/csharp.map.receiver.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.cs146
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/powershell.example.helloworld/powershell.example.helloworld.ps134
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Application.Designer.vb32
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Application.myapp28
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/AssemblyInfo.vb54
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Resources.Designer.vb82
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Resources.resx135
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Settings.Designer.vb92
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Settings.settings25
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vb72
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vbproj176
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sessionreceiver.sln76
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln348
-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
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/test/messaging.test/Properties/AssemblyInfo.cs57
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.address.cs157
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs100
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs76
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj180
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.duration.cs99
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs294
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.direct.receiver/csharp.direct.receiver.csproj101
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.direct.sender/csharp.direct.sender.csproj84
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.client/csharp.example.client.csproj101
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj101
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.drain/csharp.example.drain.csproj102
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.helloworld/csharp.example.helloworld.csproj101
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.server/csharp.example.server.csproj101
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.spout/csharp.example.spout.csproj103
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj106
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj105
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.receiver/csharp.map.receiver.csproj101
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.sender/csharp.map.sender.csproj101
-rw-r--r--qpid/cpp/bindings/qpid/dotnet/winsdk_sources/winsdk_dotnet_examples.sln178
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/README26
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/client.pl66
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/drain.pl98
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/hello_world.pl56
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl76
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl47
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/map_sender.pl50
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/server.pl62
-rw-r--r--qpid/cpp/bindings/qpid/examples/perl/spout.pl136
-rw-r--r--qpid/cpp/bindings/qpid/perl/CMakeLists.txt38
-rw-r--r--qpid/cpp/bindings/qpid/perl/Makefile.am42
-rw-r--r--qpid/cpp/bindings/qpid/perl/perl.i35
-rw-r--r--qpid/cpp/bindings/qpid/python/CMakeLists.txt45
-rw-r--r--qpid/cpp/bindings/qpid/python/Makefile.am49
-rw-r--r--qpid/cpp/bindings/qpid/python/python.i41
-rw-r--r--qpid/cpp/bindings/qpid/qpid.i70
-rw-r--r--qpid/cpp/bindings/qpid/ruby/CMakeLists.txt38
-rw-r--r--qpid/cpp/bindings/qpid/ruby/Makefile.am44
-rw-r--r--qpid/cpp/bindings/qpid/ruby/ruby.i36
-rw-r--r--qpid/cpp/bindings/swig_perl_typemaps.i330
-rw-r--r--qpid/cpp/bindings/swig_python_typemaps.i400
-rw-r--r--qpid/cpp/bindings/swig_ruby_typemaps.i348
162 files changed, 24317 insertions, 0 deletions
diff --git a/qpid/cpp/bindings/qmf/Makefile.am b/qpid/cpp/bindings/qmf/Makefile.am
new file mode 100644
index 0000000000..eebb4b94de
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/Makefile.am
@@ -0,0 +1,33 @@
+#
+# 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.
+#
+
+if HAVE_SWIG
+
+EXTRA_DIST = qmfengine.i
+SUBDIRS = tests
+
+if HAVE_RUBY_DEVEL
+SUBDIRS += ruby
+endif
+
+if HAVE_PYTHON_DEVEL
+SUBDIRS += python
+endif
+
+endif
diff --git a/qpid/cpp/bindings/qmf/python/Makefile.am b/qpid/cpp/bindings/qmf/python/Makefile.am
new file mode 100644
index 0000000000..8abad32959
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/python/Makefile.am
@@ -0,0 +1,51 @@
+#
+# 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.
+#
+
+if HAVE_PYTHON_DEVEL
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src/qmf -I$(top_srcdir)/src -I$(top_builddir)/src
+
+generated_file_list = \
+ qmfengine.cpp \
+ qmfengine.py
+
+EXTRA_DIST = python.i
+BUILT_SOURCES = $(generated_file_list)
+SWIG_FLAGS = -w362,401
+
+$(generated_file_list): $(srcdir)/python.i $(srcdir)/../qmfengine.i
+ $(SWIG) -c++ -python $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I$(top_srcdir)/src/qmf -I/usr/include -o qmfengine.cpp $(srcdir)/python.i
+
+pylibdir = $(PYTHON_LIB)
+
+lib_LTLIBRARIES = _qmfengine.la
+qenginedir = $(pyexecdir)
+qengine_PYTHON = qmfengine.py qmf.py
+
+#_qmfengine_la_LDFLAGS = -avoid-version -module -shrext "$(PYTHON_SO)"
+#_qmfengine_la_LDFLAGS = -avoid-version -module -shrext ".so"
+_qmfengine_la_LDFLAGS = -avoid-version -module -shared
+_qmfengine_la_LIBADD = $(PYTHON_LIBS) -L$(top_builddir)/src/.libs -lqpidclient $(top_builddir)/src/libqmf.la
+_qmfengine_la_CXXFLAGS = $(INCLUDES) -I$(srcdir)/qmf -I$(PYTHON_INC) -fno-strict-aliasing
+nodist__qmfengine_la_SOURCES = qmfengine.cpp
+
+CLEANFILES = $(generated_file_list)
+
+endif # HAVE_PYTHON_DEVEL
+
diff --git a/qpid/cpp/bindings/qmf/python/python.i b/qpid/cpp/bindings/qmf/python/python.i
new file mode 100644
index 0000000000..5e25d155f9
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/python/python.i
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+%module qmfengine
+
+
+/* unsigned32 Convert from Python --> C */
+%typemap(in) uint32_t {
+ if (PyInt_Check($input)) {
+ $1 = (uint32_t) PyInt_AsUnsignedLongMask($input);
+ } else if (PyLong_Check($input)) {
+ $1 = (uint32_t) PyLong_AsUnsignedLong($input);
+ } else {
+ SWIG_exception_fail(SWIG_ValueError, "unknown integer type");
+ }
+}
+
+/* unsinged32 Convert from C --> Python */
+%typemap(out) uint32_t {
+ $result = PyInt_FromLong((long)$1);
+}
+
+
+/* unsigned16 Convert from Python --> C */
+%typemap(in) uint16_t {
+ if (PyInt_Check($input)) {
+ $1 = (uint16_t) PyInt_AsUnsignedLongMask($input);
+ } else if (PyLong_Check($input)) {
+ $1 = (uint16_t) PyLong_AsUnsignedLong($input);
+ } else {
+ SWIG_exception_fail(SWIG_ValueError, "unknown integer type");
+ }
+}
+
+/* unsigned16 Convert from C --> Python */
+%typemap(out) uint16_t {
+ $result = PyInt_FromLong((long)$1);
+}
+
+
+/* signed32 Convert from Python --> C */
+%typemap(in) int32_t {
+ if (PyInt_Check($input)) {
+ $1 = (int32_t) PyInt_AsLong($input);
+ } else if (PyLong_Check($input)) {
+ $1 = (int32_t) PyLong_AsLong($input);
+ } else {
+ SWIG_exception_fail(SWIG_ValueError, "unknown integer type");
+ }
+}
+
+/* signed32 Convert from C --> Python */
+%typemap(out) int32_t {
+ $result = PyInt_FromLong((long)$1);
+}
+
+
+/* unsigned64 Convert from Python --> C */
+%typemap(in) uint64_t {
+%#ifdef HAVE_LONG_LONG
+ if (PyLong_Check($input)) {
+ $1 = (uint64_t)PyLong_AsUnsignedLongLong($input);
+ } else if (PyInt_Check($input)) {
+ $1 = (uint64_t)PyInt_AsUnsignedLongLongMask($input);
+ } else
+%#endif
+ {
+ SWIG_exception_fail(SWIG_ValueError, "unsupported integer size - uint64_t input too large");
+ }
+}
+
+/* unsigned64 Convert from C --> Python */
+%typemap(out) uint64_t {
+%#ifdef HAVE_LONG_LONG
+ $result = PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)$1);
+%#else
+ SWIG_exception_fail(SWIG_ValueError, "unsupported integer size - uint64_t output too large");
+%#endif
+}
+
+/* signed64 Convert from Python --> C */
+%typemap(in) int64_t {
+%#ifdef HAVE_LONG_LONG
+ if (PyLong_Check($input)) {
+ $1 = (int64_t)PyLong_AsLongLong($input);
+ } else if (PyInt_Check($input)) {
+ $1 = (int64_t)PyInt_AsLong($input);
+ } else
+%#endif
+ {
+ SWIG_exception_fail(SWIG_ValueError, "unsupported integer size - int64_t input too large");
+ }
+}
+
+/* signed64 Convert from C --> Python */
+%typemap(out) int64_t {
+%#ifdef HAVE_LONG_LONG
+ $result = PyLong_FromLongLong((PY_LONG_LONG)$1);
+%#else
+ SWIG_exception_fail(SWIG_ValueError, "unsupported integer size - int64_t output too large");
+%#endif
+}
+
+
+/* Convert from Python --> C */
+%typemap(in) void * {
+ $1 = (void *)$input;
+}
+
+/* Convert from C --> Python */
+%typemap(out) void * {
+ $result = (PyObject *) $1;
+ Py_INCREF($result);
+}
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_UINT64) uint64_t {
+ $1 = PyLong_Check($input) ? 1 : 0;
+}
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_UINT32) uint32_t {
+ $1 = PyInt_Check($input) ? 1 : 0;
+}
+
+
+
+%include "../qmfengine.i"
+
diff --git a/qpid/cpp/bindings/qmf/python/qmf.py b/qpid/cpp/bindings/qmf/python/qmf.py
new file mode 100644
index 0000000000..06d3070841
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/python/qmf.py
@@ -0,0 +1,1680 @@
+#
+# 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.
+#
+import sys
+import socket
+import os
+import logging
+from threading import Thread
+from threading import RLock
+from threading import Condition
+import qmfengine
+from qmfengine import (ACCESS_READ_CREATE, ACCESS_READ_ONLY, ACCESS_READ_WRITE)
+from qmfengine import (CLASS_EVENT, CLASS_OBJECT)
+from qmfengine import (DIR_IN, DIR_IN_OUT, DIR_OUT)
+from qmfengine import (TYPE_ABSTIME, TYPE_ARRAY, TYPE_BOOL, TYPE_DELTATIME,
+ TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT16, TYPE_INT32, TYPE_INT64,
+ TYPE_INT8, TYPE_LIST, TYPE_LSTR, TYPE_MAP, TYPE_OBJECT,
+ TYPE_REF, TYPE_SSTR, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64,
+ TYPE_UINT8, TYPE_UUID)
+from qmfengine import (O_EQ, O_NE, O_LT, O_LE, O_GT, O_GE, O_RE_MATCH, O_RE_NOMATCH,
+ E_NOT, E_AND, E_OR, E_XOR)
+from qmfengine import (SEV_EMERG, SEV_ALERT, SEV_CRIT, SEV_ERROR, SEV_WARN, SEV_NOTICE,
+ SEV_INFORM, SEV_DEBUG)
+
+
+def qmf_to_native(val):
+ typecode = val.getType()
+ if typecode == TYPE_UINT8: return val.asUint()
+ elif typecode == TYPE_UINT16: return val.asUint()
+ elif typecode == TYPE_UINT32: return val.asUint()
+ elif typecode == TYPE_UINT64: return val.asUint64()
+ elif typecode == TYPE_SSTR: return val.asString()
+ elif typecode == TYPE_LSTR: return val.asString()
+ elif typecode == TYPE_ABSTIME: return val.asInt64()
+ elif typecode == TYPE_DELTATIME: return val.asUint64()
+ elif typecode == TYPE_REF: return ObjectId(val.asObjectId())
+ elif typecode == TYPE_BOOL: return val.asBool()
+ elif typecode == TYPE_FLOAT: return val.asFloat()
+ elif typecode == TYPE_DOUBLE: return val.asDouble()
+ elif typecode == TYPE_UUID: return val.asUuid()
+ elif typecode == TYPE_INT8: return val.asInt()
+ elif typecode == TYPE_INT16: return val.asInt()
+ elif typecode == TYPE_INT32: return val.asInt()
+ elif typecode == TYPE_INT64: return val.asInt64()
+ elif typecode == TYPE_MAP: return value_to_dict(val)
+ elif typecode == TYPE_LIST: return value_to_list(val)
+ else:
+ # when TYPE_OBJECT
+ logging.error( "Unsupported type for get_attr? '%s'" % str(val.getType()) )
+ return None
+
+
+def native_to_qmf(target, value):
+ val = None
+ typecode = None
+ if target.__class__ == qmfengine.Value:
+ val = target
+ typecode = val.getType()
+ else:
+ typecode = target
+ val = qmfengine.Value(typecode)
+
+ if typecode == TYPE_UINT8: val.setUint(value)
+ elif typecode == TYPE_UINT16: val.setUint(value)
+ elif typecode == TYPE_UINT32: val.setUint(value)
+ elif typecode == TYPE_UINT64: val.setUint64(value)
+ elif typecode == TYPE_SSTR:
+ if value: val.setString(value)
+ else: val.setString('')
+ elif typecode == TYPE_LSTR:
+ if value: val.setString(value)
+ else: val.setString('')
+ elif typecode == TYPE_ABSTIME: val.setInt64(value)
+ elif typecode == TYPE_DELTATIME: val.setUint64(value)
+ elif typecode == TYPE_REF: val.setObjectId(value.impl)
+ elif typecode == TYPE_BOOL: val.setBool(value)
+ elif typecode == TYPE_FLOAT: val.setFloat(value)
+ elif typecode == TYPE_DOUBLE: val.setDouble(value)
+ elif typecode == TYPE_UUID: val.setUuid(value)
+ elif typecode == TYPE_INT8: val.setInt(value)
+ elif typecode == TYPE_INT16: val.setInt(value)
+ elif typecode == TYPE_INT32: val.setInt(value)
+ elif typecode == TYPE_INT64: val.setInt64(value)
+ elif typecode == TYPE_MAP: dict_to_value(val, value)
+ elif typecode == TYPE_LIST: list_to_value(val, value)
+ else:
+ # when TYPE_OBJECT
+ logging.error("Unsupported type for get_attr? '%s'" % str(val.getType()))
+ return None
+ return val
+
+
+def pick_qmf_type(value):
+ if value.__class__ == int:
+ if value >= 0:
+ if value < 0x100000000: return TYPE_UINT32
+ return TYPE_UINT64
+ else:
+ if value > -0xffffffff: return TYPE_INT32
+ return TYPE_INT64
+
+ if value.__class__ == long:
+ if value >= 0: return TYPE_UINT64
+ return TYPE_INT64
+
+ if value.__class__ == str:
+ if len(value) < 256: return TYPE_SSTR
+ return TYPE_LSTR
+
+ if value.__class__ == float: return TYPE_DOUBLE
+ if value.__class__ == bool: return TYPE_BOOL
+ if value == None: return TYPE_BOOL
+ if value.__class__ == dict: return TYPE_MAP
+ if value.__class__ == list: return TYPE_LIST
+
+ raise "QMF type not known for native type %s" % value.__class__
+
+
+def value_to_dict(val):
+ if not val.isMap(): raise "value_to_dict must be given a map value"
+ mymap = {}
+ for i in range(val.keyCount()):
+ key = val.key(i)
+ mymap[key] = qmf_to_native(val.byKey(key))
+ return mymap
+
+
+def dict_to_value(val, mymap):
+ for key, value in mymap.items():
+ if key.__class__ != str: raise "QMF map key must be a string"
+ typecode = pick_qmf_type(value)
+ val.insert(key, native_to_qmf(typecode, value))
+
+
+def value_to_list(val):
+ mylist = []
+ if val.isList():
+ for i in range(val.listItemCount()):
+ mylist.append(qmf_to_native(val.listItem(i)))
+ return mylist
+ #if val.isArray():
+ # for i in range(val.arrayItemCount()):
+ # mylist.append(qmf_to_native(val.arrayItem(i)))
+ # return mylist
+
+ raise "value_to_list must be given a list value"
+
+
+def list_to_value(val, mylist):
+ for item in mylist:
+ typecode = pick_qmf_type(item)
+ val.appendToList(native_to_qmf(typecode, item))
+
+
+ ##==============================================================================
+ ## CONNECTION
+ ##==============================================================================
+
+class ConnectionSettings(object):
+ #attr_reader :impl
+ def __init__(self, url=None):
+ if url:
+ self.impl = qmfengine.ConnectionSettings(url)
+ else:
+ self.impl = qmfengine.ConnectionSettings()
+
+
+ def set_attr(self, key, val):
+ if type(val) == str:
+ _v = qmfengine.Value(TYPE_LSTR)
+ _v.setString(val)
+ elif type(val) == int:
+ _v = qmfengine.Value(TYPE_UINT32)
+ _v.setUint(val)
+ elif type(val) == bool:
+ _v = qmfengine.Value(TYPE_BOOL)
+ _v.setBool(val)
+ else:
+ raise Exception("Argument error: value for attribute '%s' has unsupported type: %s" % ( key, type(val)))
+
+ good = self.impl.setAttr(key, _v)
+ if not good:
+ raise Exception("Argument error: unsupported attribute '%s'" % key )
+
+
+ def get_attr(self, key):
+ _v = self.impl.getAttr(key)
+ if _v.isString():
+ return _v.asString()
+ elif _v.isUint():
+ return _v.asUint()
+ elif _v.isBool():
+ return _v.asBool()
+ else:
+ raise Exception("Argument error: value for attribute '%s' has unsupported type: %s" % ( key, str(_v.getType())))
+
+
+ def __getattr__(self, name):
+ return self.get_attr(name)
+
+
+ def __setattr__(self, name, value):
+ if name == "impl":
+ return super.__setattr__(self, name, value)
+ return self.set_attr(name, value)
+
+
+
+class ConnectionHandler:
+ def conn_event_connected(self): None
+ def conn_event_disconnected(self, error): None
+ def conn_event_visit(self): None
+ def sess_event_session_closed(self, context, error): None
+ def sess_event_recv(self, context, message): None
+
+
+
+class Connection(Thread):
+ def __init__(self, settings):
+ Thread.__init__(self)
+ self._lock = RLock()
+ self.impl = qmfengine.ResilientConnection(settings.impl)
+ self._sockEngine, self._sock = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
+ self.impl.setNotifyFd(self._sockEngine.fileno())
+ self._new_conn_handlers = []
+ self._conn_handlers_to_delete = []
+ self._conn_handlers = []
+ self._connected = False
+ self._operational = True
+ self.start()
+
+
+ def destroy(self, timeout=None):
+ logging.debug("Destroying Connection...")
+ self._operational = False
+ self.kick()
+ self.join(timeout)
+ logging.debug("... Conn Destroyed!" )
+ if self.isAlive():
+ logging.error("Error: Connection thread '%s' is hung..." % self.getName())
+
+
+ def connected(self):
+ return self._connected
+
+
+ def kick(self):
+ self.impl.notify()
+
+
+ def add_conn_handler(self, handler):
+ self._lock.acquire()
+ try:
+ self._new_conn_handlers.append(handler)
+ finally:
+ self._lock.release()
+ self.kick()
+
+
+ def del_conn_handler(self, handler):
+ self._lock.acquire()
+ try:
+ self._conn_handlers_to_delete.append(handler)
+ finally:
+ self._lock.release()
+ self.kick()
+
+
+ def run(self):
+ eventImpl = qmfengine.ResilientConnectionEvent()
+ new_handlers = []
+ del_handlers = []
+ bt_count = 0
+
+ while self._operational:
+ logging.debug("Connection thread waiting for socket data...")
+ self._sock.recv(1)
+
+ self._lock.acquire()
+ try:
+ new_handlers = self._new_conn_handlers
+ del_handlers = self._conn_handlers_to_delete
+ self._new_conn_handlers = []
+ self._conn_handlers_to_delete = []
+ finally:
+ self._lock.release()
+
+ for nh in new_handlers:
+ self._conn_handlers.append(nh)
+ if self._connected:
+ nh.conn_event_connected()
+ new_handlers = []
+
+ for dh in del_handlers:
+ if dh in self._conn_handlers:
+ self._conn_handlers.remove(dh)
+ del_handlers = []
+
+ valid = self.impl.getEvent(eventImpl)
+ while valid:
+ try:
+ if eventImpl.kind == qmfengine.ResilientConnectionEvent.CONNECTED:
+ logging.debug("Connection thread: CONNECTED event received.")
+ self._connected = True
+ for h in self._conn_handlers:
+ h.conn_event_connected()
+
+ elif eventImpl.kind == qmfengine.ResilientConnectionEvent.DISCONNECTED:
+ logging.debug("Connection thread: DISCONNECTED event received.")
+ self._connected = False
+ for h in self._conn_handlers:
+ h.conn_event_disconnected(eventImpl.errorText)
+
+ elif eventImpl.kind == qmfengine.ResilientConnectionEvent.SESSION_CLOSED:
+ logging.debug("Connection thread: SESSION_CLOSED event received.")
+ eventImpl.sessionContext.handler.sess_event_session_closed(eventImpl.sessionContext, eventImpl.errorText)
+
+ elif eventImpl.kind == qmfengine.ResilientConnectionEvent.RECV:
+ logging.debug("Connection thread: RECV event received.")
+ eventImpl.sessionContext.handler.sess_event_recv(eventImpl.sessionContext, eventImpl.message)
+ else:
+ logging.debug("Connection thread received unknown event: '%s'" % str(eventImpl.kind))
+
+ except:
+ import traceback
+ logging.error( "Exception occurred during Connection event processing:" )
+ logging.error( str(sys.exc_info()) )
+ if bt_count < 2:
+ traceback.print_exc()
+ traceback.print_stack()
+ bt_count += 1
+
+ self.impl.popEvent()
+ valid = self.impl.getEvent(eventImpl)
+
+ for h in self._conn_handlers:
+ h.conn_event_visit()
+
+ logging.debug("Shutting down Connection thread")
+
+
+
+class Session:
+ def __init__(self, conn, label, handler):
+ self._conn = conn
+ self._label = label
+ self.handler = handler
+ self.handle = qmfengine.SessionHandle()
+ result = self._conn.impl.createSession(label, self, self.handle)
+
+
+ def destroy(self):
+ self._conn.impl.destroySession(self.handle)
+
+
+
+ ##==============================================================================
+ ## OBJECTS and EVENTS
+ ##==============================================================================
+
+class QmfEvent(object):
+ # attr_reader :impl, :event_class
+ def __init__(self, cls, kwargs={}):
+ self._allow_sets = True
+ if kwargs.has_key("broker"):
+ self._broker = kwargs["broker"]
+ else:
+ self._broker = None
+ if cls:
+ self.event_class = cls
+ self.impl = qmfengine.Event(self.event_class.impl)
+ elif kwargs.has_key("impl"):
+ self.impl = qmfengine.Event(kwargs["impl"])
+ self.event_class = SchemaEventClass(None, None, 0,
+ {"impl":self.impl.getClass()})
+ else:
+ raise Exception("Argument error: required parameter ('impl') not supplied")
+
+
+ def arguments(self):
+ list = []
+ for arg in self.event_class.arguments:
+ list.append([arg, self.get_attr(arg.name())])
+ return list
+
+
+ def get_attr(self, name):
+ val = self._value(name)
+ return qmf_to_native(val)
+
+
+ def set_attr(self, name, v):
+ val = self._value(name)
+ native_to_qmf(val, v)
+
+
+ def __getitem__(self, name):
+ return self.get_attr(name)
+
+
+ def __setitem__(self, name, value):
+ self.set_attr(name, value)
+
+
+ def __setattr__(self, name, value):
+ #
+ # Ignore the internal attributes, set them normally...
+ #
+ if (name[0] == '_' or
+ name == 'impl' or
+ name == 'event_class'):
+ return super.__setattr__(self, name, value)
+
+ if not self._allow_sets:
+ raise Exception("'Set' operations not permitted on this object")
+
+ #
+ # If the name matches an argument name, set the value of the argument.
+ #
+ # print "set name=%s" % str(name)
+ for arg in self.event_class.arguments:
+ if arg.name() == name:
+ return self.set_attr(name, value)
+
+ # unrecognized name? should I raise an exception?
+ super.__setattr__(self, name, value)
+
+
+ def __getattr__(self, name, *args):
+ #
+ # If the name matches an argument name, return the value of the argument.
+ #
+ for arg in self.event_class.arguments:
+ if arg.name() == name:
+ return self.get_attr(name)
+
+ #
+ # This name means nothing to us, pass it up the line to the parent
+ # class's handler.
+ #
+ # print "__getattr__=%s" % str(name)
+ super.__getattr__(self, name)
+
+
+ def _value(self, name):
+ val = self.impl.getValue(name)
+ if not val:
+ raise Exception("Argument error: attribute named '%s' not defined for package %s, class %s" %
+ (name,
+ self.event_class.impl.getClassKey().getPackageName(),
+ self.event_class.impl.getClassKey().getClassName()))
+ return val
+
+
+class QmfObject(object):
+ # attr_reader :impl, :object_class
+ def __init__(self, cls, kwargs={}):
+ self._cv = Condition()
+ self._sync_count = 0
+ self._sync_result = None
+ self._allow_sets = False
+ if kwargs.has_key("broker"):
+ self._broker = kwargs["broker"]
+ else:
+ self._broker = None
+ if cls:
+ self.object_class = cls
+ self.impl = qmfengine.Object(self.object_class.impl)
+ elif kwargs.has_key("impl"):
+ self.impl = qmfengine.Object(kwargs["impl"])
+ self.object_class = SchemaObjectClass(None,
+ None,
+ {"impl":self.impl.getClass()})
+ else:
+ raise Exception("Argument error: required parameter ('impl') not supplied")
+
+
+ def destroy(self):
+ self.impl.destroy()
+
+
+ def object_id(self):
+ return ObjectId(self.impl.getObjectId())
+
+
+ def set_object_id(self, oid):
+ self.impl.setObjectId(oid.impl)
+
+
+ def properties(self):
+ list = []
+ for prop in self.object_class.properties:
+ list.append([prop, self.get_attr(prop.name())])
+ return list
+
+
+ def statistics(self):
+ list = []
+ for stat in self.object_class.statistics:
+ list.append([stat, self.get_attr(stat.name())])
+ return list
+
+
+ def get_attr(self, name):
+ val = self._value(name)
+ return qmf_to_native(val)
+
+
+ def set_attr(self, name, v):
+ val = self._value(name)
+ native_to_qmf(val, v)
+
+
+ def __getitem__(self, name):
+ return self.get_attr(name)
+
+
+ def __setitem__(self, name, value):
+ self.set_attr(name, value)
+
+
+ def inc_attr(self, name, by=1):
+ self.set_attr(name, self.get_attr(name) + by)
+
+
+ def dec_attr(self, name, by=1):
+ self.set_attr(name, self.get_attr(name) - by)
+
+
+ def __setattr__(self, name, value):
+ #
+ # Ignore the internal attributes, set them normally...
+ #
+ if (name[0] == '_' or
+ name == 'impl' or
+ name == 'object_class'):
+ return super.__setattr__(self, name, value)
+
+ if not self._allow_sets:
+ raise Exception("'Set' operations not permitted on this object")
+ #
+ # If the name matches a property name, set the value of the property.
+ #
+ # print "set name=%s" % str(name)
+ for prop in self.object_class.properties:
+ if prop.name() == name:
+ return self.set_attr(name, value)
+ #
+ # otherwise, check for a statistic set...
+ #
+ for stat in self.object_class.statistics:
+ if stat.name() == name:
+ return self.set_attr(name, value)
+
+ # unrecognized name? should I raise an exception?
+ super.__setattr__(self, name, value)
+
+
+ def __getattr__(self, name, *args):
+ #
+ # If the name matches a property name, return the value of the property.
+ #
+ for prop in self.object_class.properties:
+ if prop.name() == name:
+ return self.get_attr(name)
+ #
+ # Do the same for statistics
+ #
+ for stat in self.object_class.statistics:
+ if stat.name() == name:
+ return self.get_attr(name)
+ #
+ # If we still haven't found a match for the name, check to see if
+ # it matches a method name. If so, marshall up the arguments into
+ # a map, and invoke the method.
+ #
+ for method in self.object_class.methods:
+ if method.name() == name:
+ argMap = self._marshall(method, args)
+ return lambda name, argMap : self._invokeMethod(name, argMap)
+
+ #
+ # This name means nothing to us, pass it up the line to the parent
+ # class's handler.
+ #
+ # print "__getattr__=%s" % str(name)
+ super.__getattr__(self, name)
+
+
+ def _invokeMethod(self, name, argMap):
+ """
+ Private: Helper function that invokes an object's method, and waits for the result.
+ """
+ self._cv.acquire()
+ try:
+ timeout = 30
+ self._sync_count = 1
+ self.impl.invokeMethod(name, argMap, self)
+ if self._broker:
+ self._broker.conn.kick()
+ self._cv.wait(timeout)
+ if self._sync_count == 1:
+ raise Exception("Timed out: waiting for response to method call.")
+ finally:
+ self._cv.release()
+
+ return self._sync_result
+
+
+ def _method_result(self, result):
+ """
+ Called to return the result of a method call on an object
+ """
+ self._cv.acquire();
+ try:
+ self._sync_result = result
+ self._sync_count -= 1
+ self._cv.notify()
+ finally:
+ self._cv.release()
+
+
+ def _marshall(schema, args):
+ '''
+ Private: Convert a list of arguments (positional) into a Value object of type "map".
+ Used to create the argument parameter for an object's method invokation.
+ '''
+ # Build a map of the method's arguments
+ map = qmfengine.Value(TYPE_MAP)
+ for arg in schema.arguments:
+ if arg.direction == DIR_IN or arg.direction == DIR_IN_OUT:
+ map.insert(arg.name, qmfengine.Value(arg.typecode))
+
+ # install each argument's value into the map
+ marshalled = Arguments(map)
+ idx = 0
+ for arg in schema.arguments:
+ if arg.direction == DIR_IN or arg.direction == DIR_IN_OUT:
+ if args[idx]:
+ marshalled[arg.name] = args[idx]
+ idx += 1
+
+ return marshalled.map
+
+
+ def _value(self, name):
+ val = self.impl.getValue(name)
+ if not val:
+ raise Exception("Argument error: attribute named '%s' not defined for package %s, class %s" %
+ (name,
+ self.object_class.impl.getClassKey().getPackageName(),
+ self.object_class.impl.getClassKey().getClassName()))
+ return val
+
+
+
+class AgentObject(QmfObject):
+ def __init__(self, cls, kwargs={}):
+ QmfObject.__init__(self, cls, kwargs)
+ self._allow_sets = True
+
+
+ def destroy(self):
+ self.impl.destroy()
+
+
+ def set_object_id(self, oid):
+ self.impl.setObjectId(oid.impl)
+
+
+
+class ConsoleObject(QmfObject):
+ # attr_reader :current_time, :create_time, :delete_time
+ def __init__(self, cls, kwargs={}):
+ QmfObject.__init__(self, cls, kwargs)
+
+
+ def update(self):
+ if not self._broker:
+ raise Exception("No linkage to broker")
+ newer = self._broker.console.objects(Query({"object_id":object_id}))
+ if newer.size != 1:
+ raise Exception("Expected exactly one update for this object, %d present" % int(newer.size))
+ self.merge_update(newer[0])
+
+
+ def merge_update(self, newObject):
+ self.impl.merge(new_object.impl)
+
+
+ def is_deleted(self):
+ return self.impl.isDeleted()
+
+
+ def key(self): pass
+
+
+
+class ObjectId:
+ def __init__(self, impl=None):
+ if impl:
+ self.impl = impl
+ else:
+ self.impl = qmfengine.ObjectId()
+ self.agent_key = "%d.%d" % (self.impl.getBrokerBank(), self.impl.getAgentBank())
+
+
+ def object_num_high(self):
+ return self.impl.getObjectNumHi()
+
+
+ def object_num_low(self):
+ return self.impl.getObjectNumLo()
+
+
+ def agent_key(self):
+ self.agent_key
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__): return False
+ return self.impl == other.impl
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __repr__(self):
+ return self.impl.str()
+
+
+
+class Arguments(object):
+ def __init__(self, map):
+ self.map = map
+ self._by_hash = {}
+ key_count = self.map.keyCount()
+ a = 0
+ while a < key_count:
+ key = self.map.key(a)
+ self._by_hash[key] = qmf_to_native(self.map.byKey(key))
+ a += 1
+
+
+ def __getitem__(self, key):
+ return self._by_hash[key]
+
+
+ def __setitem__(self, key, value):
+ self._by_hash[key] = value
+ self.set(key, value)
+
+
+ def __iter__(self):
+ return self._by_hash.__iter__
+
+
+ def __getattr__(self, name):
+ if name in self._by_hash:
+ return self._by_hash[name]
+ return super.__getattr__(self, name)
+
+
+ def __setattr__(self, name, value):
+ #
+ # ignore local data members
+ #
+ if (name[0] == '_' or
+ name == 'map'):
+ return super.__setattr__(self, name, value)
+
+ if name in self._by_hash:
+ self._by_hash[name] = value
+ return self.set(name, value)
+
+ return super.__setattr__(self, name, value)
+
+
+ def set(self, key, value):
+ val = self.map.byKey(key)
+ native_to_qmf(val, value)
+
+
+
+class MethodResponse(object):
+ def __init__(self, impl):
+ self.impl = qmfengine.MethodResponse(impl)
+
+
+ def status(self):
+ return self.impl.getStatus()
+
+
+ def exception(self):
+ return self.impl.getException()
+
+
+ def text(self):
+ return exception().asString()
+
+
+ def args(self):
+ return Arguments(self.impl.getArgs())
+
+
+ def __getattr__(self, name):
+ myArgs = self.args()
+ return myArgs.__getattr__(name)
+
+
+ def __setattr__(self, name, value):
+ if name == 'impl':
+ return super.__setattr__(self, name, value)
+
+ myArgs = self.args()
+ return myArgs.__setattr__(name, value)
+
+
+
+ ##==============================================================================
+ ## QUERY
+ ##==============================================================================
+
+
+class Query:
+ def __init__(self, kwargs={}):
+ if "impl" in kwargs:
+ self.impl = kwargs["impl"]
+ else:
+ package = ''
+ if "key" in kwargs:
+ # construct using SchemaClassKey:
+ self.impl = qmfengine.Query(kwargs["key"])
+ elif "object_id" in kwargs:
+ self.impl = qmfengine.Query(kwargs["object_id"].impl)
+ else:
+ if "package" in kwargs:
+ package = kwargs["package"]
+ if "class" in kwargs:
+ self.impl = qmfengine.Query(kwargs["class"], package)
+ else:
+ raise Exception("Argument error: invalid arguments, use 'key', 'object_id' or 'class'[,'package']")
+
+
+ def package_name(self): return self.impl.getPackage()
+ def class_name(self): return self.impl.getClass()
+ def object_id(self):
+ _objid = self.impl.getObjectId()
+ if _objid:
+ return ObjectId(_objid)
+ else:
+ return None
+
+
+ ##==============================================================================
+ ## SCHEMA
+ ##==============================================================================
+
+
+
+class SchemaArgument:
+ #attr_reader :impl
+ def __init__(self, name, typecode, kwargs={}):
+ if "impl" in kwargs:
+ self.impl = kwargs["impl"]
+ else:
+ self.impl = qmfengine.SchemaArgument(name, typecode)
+ if kwargs.has_key("dir"): self.impl.setDirection(kwargs["dir"])
+ if kwargs.has_key("unit"): self.impl.setUnit(kwargs["unit"])
+ if kwargs.has_key("desc"): self.impl.setDesc(kwargs["desc"])
+
+
+ def name(self):
+ return self.impl.getName()
+
+
+ def direction(self):
+ return self.impl.getDirection()
+
+
+ def typecode(self):
+ return self.impl.getType()
+
+
+ def __repr__(self):
+ return self.name()
+
+
+
+class SchemaMethod:
+ # attr_reader :impl, arguments
+ def __init__(self, name, kwargs={}):
+ self.arguments = []
+ if "impl" in kwargs:
+ self.impl = kwargs["impl"]
+ for i in range(self.impl.getArgumentCount()):
+ self.arguments.append(SchemaArgument(None,None,{"impl":self.impl.getArgument(i)}))
+ else:
+ self.impl = qmfengine.SchemaMethod(name)
+ if kwargs.has_key("desc"): self.impl.setDesc(kwargs["desc"])
+
+
+ def add_argument(self, arg):
+ self.arguments.append(arg)
+ self.impl.addArgument(arg.impl)
+
+ def name(self):
+ return self.impl.getName()
+
+ def __repr__(self):
+ return self.name()
+
+
+
+class SchemaProperty:
+ #attr_reader :impl
+ def __init__(self, name, typecode, kwargs={}):
+ if "impl" in kwargs:
+ self.impl = kwargs["impl"]
+ else:
+ self.impl = qmfengine.SchemaProperty(name, typecode)
+ if kwargs.has_key("access"): self.impl.setAccess(kwargs["access"])
+ if kwargs.has_key("index"): self.impl.setIndex(kwargs["index"])
+ if kwargs.has_key("optional"): self.impl.setOptional(kwargs["optional"])
+ if kwargs.has_key("unit"): self.impl.setUnit(kwargs["unit"])
+ if kwargs.has_key("desc"): self.impl.setDesc(kwargs["desc"])
+
+
+ def name(self):
+ return self.impl.getName()
+
+ def __repr__(self):
+ return self.name()
+
+
+
+class SchemaStatistic:
+ # attr_reader :impl
+ def __init__(self, name, typecode, kwargs={}):
+ if "impl" in kwargs:
+ self.impl = kwargs["impl"]
+ else:
+ self.impl = qmfengine.SchemaStatistic(name, typecode)
+ if kwargs.has_key("unit"): self.impl.setUnit(kwargs["unit"])
+ if kwargs.has_key("desc"): self.impl.setDesc(kwargs["desc"])
+
+
+ def name(self):
+ return self.impl.getName()
+
+ def __repr__(self):
+ return self.name()
+
+
+
+class SchemaClassKey:
+ #attr_reader :impl
+ def __init__(self, i):
+ self.impl = i
+
+
+ def package_name(self):
+ return self.impl.getPackageName()
+
+
+ def class_name(self):
+ return self.impl.getClassName()
+
+ def __repr__(self):
+ return self.impl.asString()
+
+
+
+class SchemaObjectClass:
+ # attr_reader :impl, :properties, :statistics, :methods
+ def __init__(self, package, name, kwargs={}):
+ self.properties = []
+ self.statistics = []
+ self.methods = []
+ if "impl" in kwargs:
+ self.impl = kwargs["impl"]
+
+ for i in range(self.impl.getPropertyCount()):
+ self.properties.append(SchemaProperty(None, None, {"impl":self.impl.getProperty(i)}))
+
+ for i in range(self.impl.getStatisticCount()):
+ self.statistics.append(SchemaStatistic(None, None, {"impl":self.impl.getStatistic(i)}))
+
+ for i in range(self.impl.getMethodCount()):
+ self.methods.append(SchemaMethod(None, {"impl":self.impl.getMethod(i)}))
+ else:
+ self.impl = qmfengine.SchemaObjectClass(package, name)
+
+
+ def add_property(self, prop):
+ self.properties.append(prop)
+ self.impl.addProperty(prop.impl)
+
+
+ def add_statistic(self, stat):
+ self.statistics.append(stat)
+ self.impl.addStatistic(stat.impl)
+
+
+ def add_method(self, meth):
+ self.methods.append(meth)
+ self.impl.addMethod(meth.impl)
+
+
+ def class_key(self):
+ return SchemaClassKey(self.impl.getClassKey())
+
+
+ def package_name(self):
+ return self.impl.getClassKey().getPackageName()
+
+
+ def class_name(self):
+ return self.impl.getClassKey().getClassName()
+
+
+
+class SchemaEventClass:
+ # attr_reader :impl :arguments
+ def __init__(self, package, name, sev, kwargs={}):
+ self.arguments = []
+ if "impl" in kwargs:
+ self.impl = kwargs["impl"]
+ for i in range(self.impl.getArgumentCount()):
+ self.arguments.append(SchemaArgument(nil, nil, {"impl":self.impl.getArgument(i)}))
+ else:
+ self.impl = qmfengine.SchemaEventClass(package, name, sev)
+ if kwargs.has_key("desc"): self.impl.setDesc(kwargs["desc"])
+
+
+ def add_argument(self, arg):
+ self.arguments.append(arg)
+ self.impl.addArgument(arg.impl)
+
+
+ def name(self):
+ return self.impl.getClassKey().getClassName()
+
+ def class_key(self):
+ return SchemaClassKey(self.impl.getClassKey())
+
+
+ def package_name(self):
+ return self.impl.getClassKey().getPackageName()
+
+
+ def class_name(self):
+ return self.impl.getClassKey().getClassName()
+
+
+ ##==============================================================================
+ ## CONSOLE
+ ##==============================================================================
+
+
+
+class ConsoleHandler:
+ def agent_added(self, agent): pass
+ def agent_deleted(self, agent): pass
+ def new_package(self, package): pass
+ def new_class(self, class_key): pass
+ def object_update(self, obj, hasProps, hasStats): pass
+ def event_received(self, event): pass
+ def agent_heartbeat(self, agent, timestamp): pass
+ def method_response(self, resp): pass
+ def broker_info(self, broker): pass
+
+
+
+class Console(Thread):
+ # attr_reader :impl
+ def __init__(self, handler=None, kwargs={}):
+ Thread.__init__(self)
+ self._handler = handler
+ self.impl = qmfengine.Console()
+ self._event = qmfengine.ConsoleEvent()
+ self._broker_list = []
+ self._cv = Condition()
+ self._sync_count = 0
+ self._sync_result = None
+ self._select = {}
+ self._cb_cond = Condition()
+ self._operational = True
+ self.start()
+
+
+ def destroy(self, timeout=None):
+ logging.debug("Destroying Console...")
+ self._operational = False
+ self.start_console_events() # wake thread up
+ self.join(timeout)
+ logging.debug("... Console Destroyed!")
+ if self.isAlive():
+ logging.error( "Console thread '%s' is hung..." % self.getName() )
+
+
+ def add_connection(self, conn):
+ broker = Broker(self, conn)
+ self._cv.acquire()
+ try:
+ self._broker_list.append(broker)
+ finally:
+ self._cv.release()
+ return broker
+
+
+ def del_connection(self, broker):
+ logging.debug("shutting down broker...")
+ broker.shutdown()
+ logging.debug("...broker down.")
+ self._cv.acquire()
+ try:
+ self._broker_list.remove(broker)
+ finally:
+ self._cv.release()
+ logging.debug("del_connection() finished")
+
+
+ def packages(self):
+ plist = []
+ for i in range(self.impl.packageCount()):
+ plist.append(self.impl.getPackageName(i))
+ return plist
+
+
+ def classes(self, package, kind=CLASS_OBJECT):
+ clist = []
+ for i in range(self.impl.classCount(package)):
+ key = self.impl.getClass(package, i)
+ class_kind = self.impl.getClassKind(key)
+ if class_kind == kind:
+ if kind == CLASS_OBJECT:
+ clist.append(SchemaObjectClass(None, None, {"impl":self.impl.getObjectClass(key)}))
+ elif kind == CLASS_EVENT:
+ clist.append(SchemaEventClass(None, None, 0, {"impl":self.impl.getEventClass(key)}))
+ return clist
+
+
+ def bind_package(self, package):
+ return self.impl.bindPackage(package)
+
+
+ def bind_class(self, kwargs = {}):
+ if "key" in kwargs:
+ self.impl.bindClass(kwargs["key"])
+ elif "package" in kwargs:
+ package = kwargs["package"]
+ if "class" in kwargs:
+ self.impl.bindClass(package, kwargs["class"])
+ else:
+ self.impl.bindClass(package, "*")
+ else:
+ raise Exception("Argument error: invalid arguments, use 'key' or 'package'[,'class']")
+
+
+ def bind_event(self, kwargs = {}):
+ if "key" in kwargs:
+ self.impl.bindEvent(kwargs["key"])
+ elif "package" in kwargs:
+ package = kwargs["package"]
+ if "event" in kwargs:
+ self.impl.bindEvent(package, kwargs["event"])
+ else:
+ self.impl.bindEvent(package, "*")
+ else:
+ raise Exception("Argument error: invalid arguments, use 'key' or 'package'[,'event']")
+
+
+ def agents(self, broker=None):
+ blist = []
+ if broker:
+ blist.append(broker)
+ else:
+ self._cv.acquire()
+ try:
+ # copy while holding lock
+ blist = self._broker_list[:]
+ finally:
+ self._cv.release()
+
+ agents = []
+ for b in blist:
+ for idx in range(b.impl.agentCount()):
+ agents.append(AgentProxy(b.impl.getAgent(idx), b))
+
+ return agents
+
+
+ def objects(self, query, kwargs = {}):
+ timeout = 30
+ agent = None
+ temp_args = kwargs.copy()
+ if type(query) == type({}):
+ temp_args.update(query)
+
+ if "_timeout" in temp_args:
+ timeout = temp_args["_timeout"]
+ temp_args.pop("_timeout")
+
+ if "_agent" in temp_args:
+ agent = temp_args["_agent"]
+ temp_args.pop("_agent")
+
+ if type(query) == type({}):
+ query = Query(temp_args)
+
+ self._select = {}
+ for k in temp_args.iterkeys():
+ if type(k) == str:
+ self._select[k] = temp_args[k]
+
+ self._cv.acquire()
+ try:
+ self._sync_count = 1
+ self._sync_result = []
+ broker = self._broker_list[0]
+ broker.send_query(query.impl, None, agent)
+ self._cv.wait(timeout)
+ if self._sync_count == 1:
+ raise Exception("Timed out: waiting for query response")
+ finally:
+ self._cv.release()
+
+ return self._sync_result
+
+
+ def object(self, query, kwargs = {}):
+ '''
+ Return one and only one object or None.
+ '''
+ objs = objects(query, kwargs)
+ if len(objs) == 1:
+ return objs[0]
+ else:
+ return None
+
+
+ def first_object(self, query, kwargs = {}):
+ '''
+ Return the first of potentially many objects.
+ '''
+ objs = objects(query, kwargs)
+ if objs:
+ return objs[0]
+ else:
+ return None
+
+
+ # Check the object against select to check for a match
+ def _select_match(self, object):
+ schema_props = object.properties()
+ for key in self._select.iterkeys():
+ for prop in schema_props:
+ if key == p[0].name() and self._select[key] != p[1]:
+ return False
+ return True
+
+
+ def _get_result(self, list, context):
+ '''
+ Called by Broker proxy to return the result of a query.
+ '''
+ self._cv.acquire()
+ try:
+ for item in list:
+ if self._select_match(item):
+ self._sync_result.append(item)
+ self._sync_count -= 1
+ self._cv.notify()
+ finally:
+ self._cv.release()
+
+
+ def start_sync(self, query): pass
+
+
+ def touch_sync(self, sync): pass
+
+
+ def end_sync(self, sync): pass
+
+
+ def run(self):
+ while self._operational:
+ self._cb_cond.acquire()
+ try:
+ self._cb_cond.wait(1)
+ while self._do_console_events():
+ pass
+ finally:
+ self._cb_cond.release()
+ logging.debug("Shutting down Console thread")
+
+
+ def start_console_events(self):
+ self._cb_cond.acquire()
+ try:
+ self._cb_cond.notify()
+ finally:
+ self._cb_cond.release()
+
+
+ def _do_console_events(self):
+ '''
+ Called by the Console thread to poll for events. Passes the events
+ onto the ConsoleHandler associated with this Console. Is called
+ periodically, but can also be kicked by Console.start_console_events().
+ '''
+ count = 0
+ valid = self.impl.getEvent(self._event)
+ while valid:
+ count += 1
+ try:
+ if self._event.kind == qmfengine.ConsoleEvent.AGENT_ADDED:
+ logging.debug("Console Event AGENT_ADDED received")
+ if self._handler:
+ self._handler.agent_added(AgentProxy(self._event.agent, None))
+ elif self._event.kind == qmfengine.ConsoleEvent.AGENT_DELETED:
+ logging.debug("Console Event AGENT_DELETED received")
+ if self._handler:
+ self._handler.agent_deleted(AgentProxy(self._event.agent, None))
+ elif self._event.kind == qmfengine.ConsoleEvent.NEW_PACKAGE:
+ logging.debug("Console Event NEW_PACKAGE received")
+ if self._handler:
+ self._handler.new_package(self._event.name)
+ elif self._event.kind == qmfengine.ConsoleEvent.NEW_CLASS:
+ logging.debug("Console Event NEW_CLASS received")
+ if self._handler:
+ self._handler.new_class(SchemaClassKey(self._event.classKey))
+ elif self._event.kind == qmfengine.ConsoleEvent.OBJECT_UPDATE:
+ logging.debug("Console Event OBJECT_UPDATE received")
+ if self._handler:
+ self._handler.object_update(ConsoleObject(None, {"impl":self._event.object}),
+ self._event.hasProps, self._event.hasStats)
+ elif self._event.kind == qmfengine.ConsoleEvent.EVENT_RECEIVED:
+ logging.debug("Console Event EVENT_RECEIVED received")
+ elif self._event.kind == qmfengine.ConsoleEvent.AGENT_HEARTBEAT:
+ logging.debug("Console Event AGENT_HEARTBEAT received")
+ if self._handler:
+ self._handler.agent_heartbeat(AgentProxy(self._event.agent, None), self._event.timestamp)
+ elif self._event.kind == qmfengine.ConsoleEvent.METHOD_RESPONSE:
+ logging.debug("Console Event METHOD_RESPONSE received")
+ else:
+ logging.debug("Console thread received unknown event: '%s'" % str(self._event.kind))
+ except e:
+ print "Exception caught in callback thread:", e
+ self.impl.popEvent()
+ valid = self.impl.getEvent(self._event)
+ return count
+
+
+
+class AgentProxy:
+ # attr_reader :broker
+ def __init__(self, impl, broker):
+ self.impl = impl
+ self.broker = broker
+ self.key = "%d.%d" % (self.impl.getBrokerBank(), self.impl.getAgentBank())
+
+
+ def label(self):
+ return self.impl.getLabel()
+
+
+ def key(self):
+ return self.key
+
+
+class Broker(ConnectionHandler):
+ # attr_reader :impl :conn, :console, :broker_bank
+ def __init__(self, console, conn):
+ self.broker_bank = 1
+ self.console = console
+ self.conn = conn
+ self._session = None
+ self._cv = Condition()
+ self._stable = None
+ self._event = qmfengine.BrokerEvent()
+ self._xmtMessage = qmfengine.Message()
+ self.impl = qmfengine.BrokerProxy(self.console.impl)
+ self.console.impl.addConnection(self.impl, self)
+ self.conn.add_conn_handler(self)
+ self._operational = True
+
+
+ def shutdown(self):
+ logging.debug("broker.shutdown() called.")
+ self.console.impl.delConnection(self.impl)
+ self.conn.del_conn_handler(self)
+ if self._session:
+ self.impl.sessionClosed()
+ logging.debug("broker.shutdown() sessionClosed done.")
+ self._session.destroy()
+ logging.debug("broker.shutdown() session destroy done.")
+ self._session = None
+ self._operational = False
+ logging.debug("broker.shutdown() done.")
+
+
+ def wait_for_stable(self, timeout = None):
+ self._cv.acquire()
+ try:
+ if self._stable:
+ return
+ if timeout:
+ self._cv.wait(timeout)
+ if not self._stable:
+ raise Exception("Timed out: waiting for broker connection to become stable")
+ else:
+ while not self._stable:
+ self._cv.wait()
+ finally:
+ self._cv.release()
+
+
+ def send_query(self, query, ctx, agent):
+ agent_impl = None
+ if agent:
+ agent_impl = agent.impl
+ self.impl.sendQuery(query, ctx, agent_impl)
+ self.conn.kick()
+
+
+ def _do_broker_events(self):
+ count = 0
+ valid = self.impl.getEvent(self._event)
+ while valid:
+ count += 1
+ if self._event.kind == qmfengine.BrokerEvent.BROKER_INFO:
+ logging.debug("Broker Event BROKER_INFO received");
+ elif self._event.kind == qmfengine.BrokerEvent.DECLARE_QUEUE:
+ logging.debug("Broker Event DECLARE_QUEUE received");
+ self.conn.impl.declareQueue(self._session.handle, self._event.name)
+ elif self._event.kind == qmfengine.BrokerEvent.DELETE_QUEUE:
+ logging.debug("Broker Event DELETE_QUEUE received");
+ self.conn.impl.deleteQueue(self._session.handle, self._event.name)
+ elif self._event.kind == qmfengine.BrokerEvent.BIND:
+ logging.debug("Broker Event BIND received");
+ self.conn.impl.bind(self._session.handle, self._event.exchange, self._event.name, self._event.bindingKey)
+ elif self._event.kind == qmfengine.BrokerEvent.UNBIND:
+ logging.debug("Broker Event UNBIND received");
+ self.conn.impl.unbind(self._session.handle, self._event.exchange, self._event.name, self._event.bindingKey)
+ elif self._event.kind == qmfengine.BrokerEvent.SETUP_COMPLETE:
+ logging.debug("Broker Event SETUP_COMPLETE received");
+ self.impl.startProtocol()
+ elif self._event.kind == qmfengine.BrokerEvent.STABLE:
+ logging.debug("Broker Event STABLE received");
+ self._cv.acquire()
+ try:
+ self._stable = True
+ self._cv.notify()
+ finally:
+ self._cv.release()
+ elif self._event.kind == qmfengine.BrokerEvent.QUERY_COMPLETE:
+ result = []
+ for idx in range(self._event.queryResponse.getObjectCount()):
+ result.append(ConsoleObject(None, {"impl":self._event.queryResponse.getObject(idx), "broker":self}))
+ self.console._get_result(result, self._event.context)
+ elif self._event.kind == qmfengine.BrokerEvent.METHOD_RESPONSE:
+ obj = self._event.context
+ obj._method_result(MethodResponse(self._event.methodResponse()))
+
+ self.impl.popEvent()
+ valid = self.impl.getEvent(self._event)
+
+ return count
+
+
+ def _do_broker_messages(self):
+ count = 0
+ valid = self.impl.getXmtMessage(self._xmtMessage)
+ while valid:
+ count += 1
+ logging.debug("Broker: sending msg on connection")
+ self.conn.impl.sendMessage(self._session.handle, self._xmtMessage)
+ self.impl.popXmt()
+ valid = self.impl.getXmtMessage(self._xmtMessage)
+
+ return count
+
+
+ def _do_events(self):
+ while True:
+ self.console.start_console_events()
+ bcnt = self._do_broker_events()
+ mcnt = self._do_broker_messages()
+ if bcnt == 0 and mcnt == 0:
+ break;
+
+
+ def conn_event_connected(self):
+ logging.debug("Broker: Connection event CONNECTED")
+ self._session = Session(self.conn, "qmfc-%s.%d" % (socket.gethostname(), os.getpid()), self)
+ self.impl.sessionOpened(self._session.handle)
+ self._do_events()
+
+
+ def conn_event_disconnected(self, error):
+ logging.debug("Broker: Connection event DISCONNECTED")
+ pass
+
+
+ def conn_event_visit(self):
+ self._do_events()
+
+
+ def sess_event_session_closed(self, context, error):
+ logging.debug("Broker: Session event CLOSED")
+ self.impl.sessionClosed()
+
+
+ def sess_event_recv(self, context, message):
+ logging.debug("Broker: Session event MSG_RECV")
+ if not self._operational:
+ logging.warning("Unexpected session event message received by Broker proxy: context='%s'" % str(context))
+ self.impl.handleRcvMessage(message)
+ self._do_events()
+
+
+
+ ##==============================================================================
+ ## AGENT
+ ##==============================================================================
+
+
+
+class AgentHandler:
+ def get_query(self, context, query, userId): None
+ def method_call(self, context, name, object_id, args, userId): None
+
+
+
+class Agent(ConnectionHandler):
+ def __init__(self, handler, label=""):
+ if label == "":
+ self._agentLabel = "rb-%s.%d" % (socket.gethostname(), os.getpid())
+ else:
+ self._agentLabel = label
+ self._conn = None
+ self._handler = handler
+ self.impl = qmfengine.Agent(self._agentLabel)
+ self._event = qmfengine.AgentEvent()
+ self._xmtMessage = qmfengine.Message()
+
+
+ def set_connection(self, conn):
+ self._conn = conn
+ self._conn.add_conn_handler(self)
+
+
+ def register_class(self, cls):
+ self.impl.registerClass(cls.impl)
+
+
+ def alloc_object_id(self, low = 0, high = 0):
+ return ObjectId(self.impl.allocObjectId(low, high))
+
+
+ def raise_event(self, event):
+ self.impl.raiseEvent(event.impl)
+
+ def query_response(self, context, obj):
+ self.impl.queryResponse(context, obj.impl)
+
+
+ def query_complete(self, context):
+ self.impl.queryComplete(context)
+
+
+ def method_response(self, context, status, text, arguments):
+ self.impl.methodResponse(context, status, text, arguments.map)
+
+
+ def do_agent_events(self):
+ count = 0
+ valid = self.impl.getEvent(self._event)
+ while valid:
+ count += 1
+ if self._event.kind == qmfengine.AgentEvent.GET_QUERY:
+ self._handler.get_query(self._event.sequence,
+ Query({"impl":self._event.query}),
+ self._event.authUserId)
+
+ elif self._event.kind == qmfengine.AgentEvent.START_SYNC:
+ pass
+ elif self._event.kind == qmfengine.AgentEvent.END_SYNC:
+ pass
+ elif self._event.kind == qmfengine.AgentEvent.METHOD_CALL:
+ args = Arguments(self._event.arguments)
+ self._handler.method_call(self._event.sequence, self._event.name,
+ ObjectId(self._event.objectId),
+ args, self._event.authUserId)
+
+ elif self._event.kind == qmfengine.AgentEvent.DECLARE_QUEUE:
+ self._conn.impl.declareQueue(self._session.handle, self._event.name)
+
+ elif self._event.kind == qmfengine.AgentEvent.DELETE_QUEUE:
+ self._conn.impl.deleteQueue(self._session.handle, self._event.name)
+
+ elif self._event.kind == qmfengine.AgentEvent.BIND:
+ self._conn.impl.bind(self._session.handle, self._event.exchange,
+ self._event.name, self._event.bindingKey)
+
+ elif self._event.kind == qmfengine.AgentEvent.UNBIND:
+ self._conn.impl.unbind(self._session.handle, self._event.exchange,
+ self._event.name, self._event.bindingKey)
+
+ elif self._event.kind == qmfengine.AgentEvent.SETUP_COMPLETE:
+ self.impl.startProtocol()
+
+ self.impl.popEvent()
+ valid = self.impl.getEvent(self._event)
+ return count
+
+
+ def do_agent_messages(self):
+ count = 0
+ valid = self.impl.getXmtMessage(self._xmtMessage)
+ while valid:
+ count += 1
+ self._conn.impl.sendMessage(self._session.handle, self._xmtMessage)
+ self.impl.popXmt()
+ valid = self.impl.getXmtMessage(self._xmtMessage)
+ return count
+
+
+ def do_events(self):
+ while True:
+ ecnt = self.do_agent_events()
+ mcnt = self.do_agent_messages()
+ if ecnt == 0 and mcnt == 0:
+ break
+
+
+ def conn_event_connected(self):
+ logging.debug("Agent Connection Established...")
+ self._session = Session(self._conn,
+ "qmfa-%s.%d" % (socket.gethostname(), os.getpid()),
+ self)
+ self.impl.newSession()
+ self.do_events()
+
+
+ def conn_event_disconnected(self, error):
+ logging.debug("Agent Connection Lost")
+ pass
+
+
+ def conn_event_visit(self):
+ self.do_events()
+
+
+ def sess_event_session_closed(self, context, error):
+ logging.debug("Agent Session Lost")
+ pass
+
+
+ def sess_event_recv(self, context, message):
+ self.impl.handleRcvMessage(message)
+ self.do_events()
+
+
diff --git a/qpid/cpp/bindings/qmf/qmfengine.i b/qpid/cpp/bindings/qmf/qmfengine.i
new file mode 100644
index 0000000000..eb350115a3
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/qmfengine.i
@@ -0,0 +1,59 @@
+/*
+ * 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 "qmf/engine/Agent.h"
+#include "qmf/engine/Console.h"
+#include "qmf/engine/ResilientConnection.h"
+
+%}
+
+%include <qmf/engine/QmfEngineImportExport.h>
+%include <qmf/engine/Query.h>
+%include <qmf/engine/Message.h>
+%include <qmf/engine/Agent.h>
+%include <qmf/engine/Console.h>
+%include <qmf/engine/ConnectionSettings.h>
+%include <qmf/engine/ResilientConnection.h>
+%include <qmf/engine/Typecode.h>
+%include <qmf/engine/Schema.h>
+%include <qmf/engine/Value.h>
+%include <qmf/engine/ObjectId.h>
+%include <qmf/engine/Object.h>
+%include <qmf/engine/Event.h>
+
+
+%inline {
+
+using namespace std;
+using namespace qmf::engine;
+
+namespace qmf {
+namespace engine {
+
+}
+}
+}
+
+
+%{
+
+%};
+
diff --git a/qpid/cpp/bindings/qmf/ruby/Makefile.am b/qpid/cpp/bindings/qmf/ruby/Makefile.am
new file mode 100644
index 0000000000..de8c4d10d5
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/ruby/Makefile.am
@@ -0,0 +1,45 @@
+#
+# 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.
+#
+
+if HAVE_RUBY_DEVEL
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src -I$(top_builddir)/src
+
+EXTRA_DIST = ruby.i
+BUILT_SOURCES = qmfengine.cpp
+SWIG_FLAGS = -w362,401
+
+rubylibdir = $(RUBY_LIB)
+
+dist_rubylib_DATA = qmf.rb
+
+qmfengine.cpp: $(srcdir)/ruby.i $(srcdir)/../qmfengine.i
+ $(SWIG) -ruby -c++ $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I/usr/include -o qmfengine.cpp $(srcdir)/ruby.i
+
+rubylibarchdir = $(RUBY_LIB_ARCH)
+rubylibarch_LTLIBRARIES = qmfengine.la
+
+qmfengine_la_LDFLAGS = -avoid-version -module -shared -shrext ".$(RUBY_DLEXT)"
+qmfengine_la_LIBADD = $(RUBY_LIBS) -L$(top_builddir)/src/.libs -lqpidclient $(top_builddir)/src/libqmfengine.la
+qmfengine_la_CXXFLAGS = $(INCLUDES) -I$(RUBY_INC) -I$(RUBY_INC_ARCH) -fno-strict-aliasing
+nodist_qmfengine_la_SOURCES = qmfengine.cpp
+
+CLEANFILES = qmfengine.cpp
+
+endif # HAVE_RUBY_DEVEL
diff --git a/qpid/cpp/bindings/qmf/ruby/qmf.rb b/qpid/cpp/bindings/qmf/ruby/qmf.rb
new file mode 100644
index 0000000000..34d3255d8d
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/ruby/qmf.rb
@@ -0,0 +1,1522 @@
+#
+# 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.
+#
+
+require 'qmfengine'
+require 'thread'
+require 'socket'
+require 'monitor'
+
+module Qmf
+
+ # Pull all the TYPE_* constants into Qmf namespace. Maybe there's an easier way?
+ Qmfengine.constants.each do |c|
+ if c.index('TYPE_') == 0 or c.index('ACCESS_') == 0 or c.index('DIR_') == 0 or
+ c.index('CLASS_') == 0 or c.index('SEV_') == 0
+ const_set(c, Qmfengine.const_get(c))
+ end
+ end
+
+ class Util
+ def qmf_to_native(val)
+ case val.getType
+ when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.asUint
+ when TYPE_UINT64 then val.asUint64
+ when TYPE_SSTR, TYPE_LSTR then val.asString
+ when TYPE_ABSTIME then val.asInt64
+ when TYPE_DELTATIME then val.asUint64
+ when TYPE_REF then ObjectId.new(val.asObjectId)
+ when TYPE_BOOL then val.asBool
+ when TYPE_FLOAT then val.asFloat
+ when TYPE_DOUBLE then val.asDouble
+ when TYPE_UUID then val.asUuid
+ when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.asInt
+ when TYPE_INT64 then val.asInt64
+ when TYPE_MAP then value_to_dict(val)
+ when TYPE_LIST then value_to_list(val)
+ when TYPE_OBJECT
+ when TYPE_ARRAY
+ end
+ end
+
+ def native_to_qmf(target, value)
+ if target.class == Qmfengine::Value
+ val = target
+ typecode = val.getType
+ else
+ typecode = target
+ val = Qmfengine::Value.new(typecode)
+ end
+
+ case typecode
+ when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.setUint(value)
+ when TYPE_UINT64 then val.setUint64(value)
+ when TYPE_SSTR, TYPE_LSTR then value ? val.setString(value) : val.setString('')
+ when TYPE_ABSTIME then val.setInt64(value)
+ when TYPE_DELTATIME then val.setUint64(value)
+ when TYPE_REF then val.setObjectId(value.impl)
+ when TYPE_BOOL then value ? val.setBool(value) : val.setBool(0)
+ when TYPE_FLOAT then val.setFloat(value)
+ when TYPE_DOUBLE then val.setDouble(value)
+ when TYPE_UUID then val.setUuid(value)
+ when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.setInt(value)
+ when TYPE_INT64 then val.setInt64(value)
+ when TYPE_MAP then dict_to_value(val, value)
+ when TYPE_LIST then list_to_value(val, value)
+ when TYPE_OBJECT
+ when TYPE_ARRAY
+ end
+ return val
+ end
+
+ def pick_qmf_type(value)
+ if value.class == Fixnum
+ if value >= 0
+ return TYPE_UINT32 if value < 0x100000000
+ return TYPE_UINT64
+ else
+ return TYPE_INT32 if value > -0xffffffff
+ return TYPE_INT64
+ end
+ end
+
+ if value.class == Bignum
+ return TYPE_UINT64 if value >= 0
+ return TYPE_INT64
+ end
+
+ if value.class == String
+ return TYPE_SSTR if value.length < 256
+ return TYPE_LSTR
+ end
+
+ return TYPE_DOUBLE if value.class == Float
+
+ return TYPE_BOOL if value.class == TrueClass
+ return TYPE_BOOL if value.class == FalseClass
+ return TYPE_BOOL if value.class == NilClass
+
+ return TYPE_MAP if value.class == Hash
+ return TYPE_LIST if value.class == Array
+
+ raise ArgumentError, "QMF type not known for native type #{value.class}"
+ end
+
+ def value_to_dict(val)
+ # Assume val is of type Qmfengine::Value
+ raise ArgumentError, "value_to_dict must be given a map value" if !val.isMap
+ map = {}
+ for i in 0...val.keyCount
+ key = val.key(i)
+ map[key] = qmf_to_native(val.byKey(key))
+ end
+ return map
+ end
+
+ def dict_to_value(val, map)
+ map.each do |key, value|
+ raise ArgumentError, "QMF map key must be a string" if key.class != String
+ typecode = pick_qmf_type(value)
+ val.insert(key, native_to_qmf(typecode, value))
+ end
+ end
+
+ def value_to_list(val)
+ # Assume val is of type Qmfengine::Value
+ raise ArgumentError, "value_to_dict must be given a map value" if !val.isList
+ list = []
+ for i in 0...val.listItemCount
+ list.push(qmf_to_native(val.listItem(i)))
+ end
+ return list
+ end
+
+ def list_to_value(val, list)
+ list.each do |value|
+ typecode = pick_qmf_type(value)
+ val.appendToList(native_to_qmf(typecode, value))
+ end
+ end
+ end
+
+ $util = Util.new
+
+ ##==============================================================================
+ ## CONNECTION
+ ##==============================================================================
+
+ class ConnectionSettings
+ attr_reader :impl
+
+ def initialize(url = nil)
+ if url
+ @impl = Qmfengine::ConnectionSettings.new(url)
+ else
+ @impl = Qmfengine::ConnectionSettings.new()
+ end
+ end
+
+ def set_attr(key, val)
+ if val.class == String
+ v = Qmfengine::Value.new(TYPE_LSTR)
+ v.setString(val)
+ elsif val.class == TrueClass or val.class == FalseClass
+ v = Qmfengine::Value.new(TYPE_BOOL)
+ v.setBool(val)
+ elsif val.class == Fixnum
+ v = Qmfengine::Value.new(TYPE_UINT32)
+ v.setUint(val)
+ else
+ raise ArgumentError, "Value for attribute '#{key}' has unsupported type: #{val.class}"
+ end
+
+ good = @impl.setAttr(key, v)
+ raise "Invalid attribute '#{key}'" unless good
+ end
+
+ def get_attr(key)
+ _v = @impl.getAttr(key)
+ if _v.isString()
+ return _v.asString()
+ elsif _v.isUint()
+ return _v.asUint()
+ elsif _v.isBool()
+ return _v.asBool()
+ else
+ raise Exception("Argument error: value for attribute '#{key}' has unsupported type: #{_v.getType()}")
+ end
+ end
+
+
+ def method_missing(name_in, *args)
+ name = name_in.to_s
+ if name[name.length - 1] == 61
+ attr = name[0..name.length - 2]
+ set_attr(attr, args[0])
+ return
+ else
+ return get_attr(name)
+ end
+ end
+ end
+
+ class ConnectionHandler
+ def conn_event_connected(); end
+ def conn_event_disconnected(error); end
+ def conn_event_visit(); end
+ def sess_event_session_closed(context, error); end
+ def sess_event_recv(context, message); end
+ end
+
+ class Connection
+ include MonitorMixin
+
+ attr_reader :impl
+
+ def initialize(settings)
+ super()
+ @impl = Qmfengine::ResilientConnection.new(settings.impl)
+ @sockEngine, @sock = Socket::socketpair(Socket::PF_UNIX, Socket::SOCK_STREAM, 0)
+ @impl.setNotifyFd(@sockEngine.fileno)
+ @new_conn_handlers = []
+ @conn_handlers_to_delete = []
+ @conn_handlers = []
+ @connected = nil
+
+ @thread = Thread.new do
+ run
+ end
+ end
+
+ def connected?
+ @connected
+ end
+
+ def kick
+ @impl.notify
+ end
+
+ def add_conn_handler(handler)
+ synchronize do
+ @new_conn_handlers << handler
+ end
+ kick
+ end
+
+ def del_conn_handler(handler)
+ synchronize do
+ @conn_handlers_to_delete << handler
+ end
+ kick
+ end
+
+ def run()
+ eventImpl = Qmfengine::ResilientConnectionEvent.new
+ new_handlers = nil
+ del_handlers = nil
+ bt_count = 0
+
+ while :true
+ @sock.read(1)
+
+ synchronize do
+ new_handlers = @new_conn_handlers
+ del_handlers = @conn_handlers_to_delete
+ @new_conn_handlers = []
+ @conn_handlers_to_delete = []
+ end
+
+ new_handlers.each do |nh|
+ @conn_handlers << nh
+ nh.conn_event_connected() if @connected
+ end
+ new_handlers = nil
+
+ del_handlers.each do |dh|
+ d = @conn_handlers.delete(dh)
+ end
+ del_handlers = nil
+
+ valid = @impl.getEvent(eventImpl)
+ while valid
+ begin
+ case eventImpl.kind
+ when Qmfengine::ResilientConnectionEvent::CONNECTED
+ @connected = :true
+ @conn_handlers.each { |h| h.conn_event_connected() }
+ when Qmfengine::ResilientConnectionEvent::DISCONNECTED
+ @connected = nil
+ @conn_handlers.each { |h| h.conn_event_disconnected(eventImpl.errorText) }
+ when Qmfengine::ResilientConnectionEvent::SESSION_CLOSED
+ eventImpl.sessionContext.handler.sess_event_session_closed(eventImpl.sessionContext, eventImpl.errorText)
+ when Qmfengine::ResilientConnectionEvent::RECV
+ eventImpl.sessionContext.handler.sess_event_recv(eventImpl.sessionContext, eventImpl.message)
+ end
+ rescue Exception => ex
+ puts "Event Exception: #{ex}"
+ if bt_count < 2
+ puts ex.backtrace
+ bt_count += 1
+ end
+ end
+ @impl.popEvent
+ valid = @impl.getEvent(eventImpl)
+ end
+ @conn_handlers.each { |h| h.conn_event_visit }
+ end
+ end
+ end
+
+ class Session
+ attr_reader :handle, :handler
+
+ def initialize(conn, label, handler)
+ @conn = conn
+ @label = label
+ @handler = handler
+ @handle = Qmfengine::SessionHandle.new
+ result = @conn.impl.createSession(label, self, @handle)
+ end
+
+ def destroy()
+ @conn.impl.destroySession(@handle)
+ end
+ end
+
+ ##==============================================================================
+ ## OBJECTS and EVENTS
+ ##==============================================================================
+
+ class QmfEvent
+ attr_reader :impl, :event_class
+ def initialize(cls, kwargs={})
+ @broker = kwargs[:broker] if kwargs.include?(:broker)
+ @allow_sets = :true
+
+ if cls:
+ @event_class = cls
+ @impl = Qmfengine::Event.new(@event_class.impl)
+ elsif kwargs.include?(:impl)
+ @impl = Qmfengine::Event.new(kwargs[:impl])
+ @event_class = SchemaEventClass.new(nil, nil, nil, :impl => @impl.getClass)
+ end
+ end
+
+ def arguments
+ list = []
+ @event_class.arguments.each do |arg|
+ list << [arg, get_attr(arg.name)]
+ end
+ return list
+ end
+
+ def get_attr(name)
+ val = value(name)
+ $util.qmf_to_native(val)
+ end
+
+ def set_attr(name, v)
+ val = value(name)
+ $util.native_to_qmf(val, v)
+ end
+
+ def [](name)
+ get_attr(name)
+ end
+
+ def []=(name, value)
+ set_attr(name, value)
+ end
+
+ def method_missing(name_in, *args)
+ #
+ # Convert the name to a string and determine if it represents an
+ # attribute assignment (i.e. "attr=")
+ #
+ name = name_in.to_s
+ attr_set = (name[name.length - 1] == 61)
+ name = name[0..name.length - 2] if attr_set
+ raise "Sets not permitted on this object" if attr_set && !@allow_sets
+
+ #
+ # If the name matches an argument name, set or return the value of the argument.
+ #
+ @event_class.arguments.each do |arg|
+ if arg.name == name
+ if attr_set
+ return set_attr(name, args[0])
+ else
+ return get_attr(name)
+ end
+ end
+ end
+
+ #
+ # This name means nothing to us, pass it up the line to the parent
+ # class's handler.
+ #
+ super.method_missing(name_in, args)
+ end
+
+ private
+ def value(name)
+ val = @impl.getValue(name.to_s)
+ if val.nil?
+ raise ArgumentError, "Attribute '#{name}' not defined for event #{@event_class.impl.getClassKey.getPackageName}:#{@object_class.impl.getClassKey.getClassName}"
+ end
+ return val
+ end
+ end
+
+ class QmfObject
+ include MonitorMixin
+ attr_reader :impl, :object_class
+ def initialize(cls, kwargs={})
+ super()
+ @cv = new_cond
+ @sync_count = 0
+ @sync_result = nil
+ @allow_sets = :false
+ @broker = kwargs[:broker] if kwargs.include?(:broker)
+
+ if cls:
+ @object_class = cls
+ @impl = Qmfengine::Object.new(@object_class.impl)
+ elsif kwargs.include?(:impl)
+ @impl = Qmfengine::Object.new(kwargs[:impl])
+ @object_class = SchemaObjectClass.new(nil, nil, :impl => @impl.getClass)
+ end
+ end
+
+ def object_id
+ return ObjectId.new(@impl.getObjectId)
+ end
+
+ def properties
+ list = []
+ @object_class.properties.each do |prop|
+ list << [prop, get_attr(prop.name)]
+ end
+ return list
+ end
+
+ def statistics
+ list = []
+ @object_class.statistics.each do |stat|
+ list << [stat, get_attr(stat.name)]
+ end
+ return list
+ end
+
+ def get_attr(name)
+ val = value(name)
+ $util.qmf_to_native(val)
+ end
+
+ def set_attr(name, v)
+ val = value(name)
+ $util.native_to_qmf(val, v)
+ end
+
+ def [](name)
+ get_attr(name)
+ end
+
+ def []=(name, value)
+ set_attr(name, value)
+ end
+
+ def inc_attr(name, by=1)
+ set_attr(name, get_attr(name) + by)
+ end
+
+ def dec_attr(name, by=1)
+ set_attr(name, get_attr(name) - by)
+ end
+
+ def method_missing(name_in, *args)
+ #
+ # Convert the name to a string and determine if it represents an
+ # attribute assignment (i.e. "attr=")
+ #
+ name = name_in.to_s
+ attr_set = (name[name.length - 1] == 61)
+ name = name[0..name.length - 2] if attr_set
+ raise "Sets not permitted on this object" if attr_set && !@allow_sets
+
+ #
+ # If the name matches a property name, set or return the value of the property.
+ #
+ @object_class.properties.each do |prop|
+ if prop.name == name
+ if attr_set
+ return set_attr(name, args[0])
+ else
+ return get_attr(name)
+ end
+ end
+ end
+
+ #
+ # Do the same for statistics
+ #
+ @object_class.statistics.each do |stat|
+ if stat.name == name
+ if attr_set
+ return set_attr(name, args[0])
+ else
+ return get_attr(name)
+ end
+ end
+ end
+
+ #
+ # If we still haven't found a match for the name, check to see if
+ # it matches a method name. If so, marshall the arguments and invoke
+ # the method.
+ #
+ @object_class.methods.each do |method|
+ if method.name == name
+ raise "Sets not permitted on methods" if attr_set
+ timeout = 30
+ synchronize do
+ @sync_count = 1
+ @impl.invokeMethod(name, _marshall(method, args), self)
+ @broker.conn.kick if @broker
+ unless @cv.wait(timeout) { @sync_count == 0 }
+ raise "Timed out waiting for response"
+ end
+ end
+
+ return @sync_result
+ end
+ end
+
+ #
+ # This name means nothing to us, pass it up the line to the parent
+ # class's handler.
+ #
+ super.method_missing(name_in, args)
+ end
+
+ def _method_result(result)
+ synchronize do
+ @sync_result = result
+ @sync_count -= 1
+ @cv.signal
+ end
+ end
+
+ #
+ # Convert a Ruby array of arguments (positional) into a Value object of type "map".
+ #
+ private
+ def _marshall(schema, args)
+ map = Qmfengine::Value.new(TYPE_MAP)
+ schema.arguments.each do |arg|
+ if arg.direction == DIR_IN || arg.direction == DIR_IN_OUT
+ map.insert(arg.name, Qmfengine::Value.new(arg.typecode))
+ end
+ end
+
+ marshalled = Arguments.new(map)
+ idx = 0
+ schema.arguments.each do |arg|
+ if arg.direction == DIR_IN || arg.direction == DIR_IN_OUT
+ marshalled[arg.name] = args[idx] unless args[idx] == nil
+ idx += 1
+ end
+ end
+
+ return marshalled.map
+ end
+
+ private
+ def value(name)
+ val = @impl.getValue(name.to_s)
+ if val.nil?
+ raise ArgumentError, "Attribute '#{name}' not defined for class #{@object_class.impl.getClassKey.getPackageName}:#{@object_class.impl.getClassKey.getClassName}"
+ end
+ return val
+ end
+ end
+
+ class AgentObject < QmfObject
+ def initialize(cls, kwargs={})
+ super(cls, kwargs)
+ @allow_sets = :true
+ end
+
+ def destroy
+ @impl.destroy
+ end
+
+ def set_object_id(oid)
+ @impl.setObjectId(oid.impl)
+ end
+ end
+
+ class ConsoleObject < QmfObject
+ attr_reader :current_time, :create_time, :delete_time
+
+ def initialize(cls, kwargs={})
+ super(cls, kwargs)
+ end
+
+ def update()
+ raise "No linkage to broker" unless @broker
+ newer = @broker.console.objects(Query.new(:object_id => object_id))
+ raise "Expected exactly one update for this object" unless newer.size == 1
+ merge_update(newer[0])
+ end
+
+ def merge_update(new_object)
+ @impl.merge(new_object.impl)
+ end
+
+ def deleted?()
+ @impl.isDeleted
+ end
+
+ def key()
+ end
+ end
+
+ class ObjectId
+ attr_reader :impl, :agent_key
+ def initialize(impl=nil)
+ if impl
+ @impl = Qmfengine::ObjectId.new(impl)
+ else
+ @impl = Qmfengine::ObjectId.new
+ end
+ @agent_key = "#{@impl.getBrokerBank}.#{@impl.getAgentBank}"
+ end
+
+ def object_num_high
+ @impl.getObjectNumHi
+ end
+
+ def object_num_low
+ @impl.getObjectNumLo
+ end
+
+ def ==(other)
+ return @impl == other.impl
+ end
+
+ def to_s
+ @impl.str
+ end
+ end
+
+ class Arguments
+ attr_reader :map
+ def initialize(map)
+ @map = map
+ @by_hash = {}
+ key_count = @map.keyCount
+ a = 0
+ while a < key_count
+ key = @map.key(a)
+ @by_hash[key] = $util.qmf_to_native(@map.byKey(key))
+ a += 1
+ end
+ end
+
+ def [] (key)
+ return @by_hash[key]
+ end
+
+ def []= (key, value)
+ @by_hash[key] = value
+ set(key, value)
+ end
+
+ def each
+ @by_hash.each { |k, v| yield(k, v) }
+ end
+
+ def method_missing(name, *args)
+ if @by_hash.include?(name.to_s)
+ return @by_hash[name.to_s]
+ end
+
+ super.method_missing(name, args)
+ end
+
+ def set(key, value)
+ val = @map.byKey(key)
+ $util.native_to_qmf(val, value)
+ end
+ end
+
+ class MethodResponse
+ def initialize(impl)
+ @impl = Qmfengine::MethodResponse.new(impl)
+ end
+
+ def status
+ @impl.getStatus
+ end
+
+ def exception
+ @impl.getException
+ end
+
+ def text
+ exception.asString
+ end
+
+ def args
+ Arguments.new(@impl.getArgs)
+ end
+
+ def method_missing(name, *extra_args)
+ args.__send__(name, extra_args)
+ end
+ end
+
+ ##==============================================================================
+ ## QUERY
+ ##==============================================================================
+
+ class Query
+ attr_reader :impl
+ def initialize(kwargs = {})
+ if kwargs.include?(:impl)
+ @impl = Qmfengine::Query.new(kwargs[:impl])
+ else
+ package = ''
+ if kwargs.include?(:key)
+ @impl = Qmfengine::Query.new(kwargs[:key])
+ elsif kwargs.include?(:object_id)
+ @impl = Qmfengine::Query.new(kwargs[:object_id].impl)
+ else
+ package = kwargs[:package] if kwargs.include?(:package)
+ if kwargs.include?(:class)
+ @impl = Qmfengine::Query.new(kwargs[:class], package)
+ else
+ raise ArgumentError, "Invalid arguments, use :key, :object_id or :class[,:package]"
+ end
+ end
+ end
+ end
+
+ def package_name
+ @impl.getPackage
+ end
+
+ def class_name
+ @impl.getClass
+ end
+
+ def object_id
+ objid = @impl.getObjectId
+ if objid.class == NilClass
+ return nil
+ end
+ return ObjectId.new(objid)
+ end
+ end
+
+ ##==============================================================================
+ ## SCHEMA
+ ##==============================================================================
+
+ class SchemaArgument
+ attr_reader :impl
+ def initialize(name, typecode, kwargs={})
+ if kwargs.include?(:impl)
+ @impl = kwargs[:impl]
+ else
+ @impl = Qmfengine::SchemaArgument.new(name, typecode)
+ @impl.setDirection(kwargs[:dir]) if kwargs.include?(:dir)
+ @impl.setUnit(kwargs[:unit]) if kwargs.include?(:unit)
+ @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+ end
+ end
+
+ def name
+ @impl.getName
+ end
+
+ def direction
+ @impl.getDirection
+ end
+
+ def typecode
+ @impl.getType
+ end
+
+ def to_s
+ name
+ end
+ end
+
+ class SchemaMethod
+ attr_reader :impl, :arguments
+ def initialize(name, kwargs={})
+ @arguments = []
+ if kwargs.include?(:impl)
+ @impl = kwargs[:impl]
+ arg_count = @impl.getArgumentCount
+ for i in 0...arg_count
+ @arguments << SchemaArgument.new(nil, nil, :impl => @impl.getArgument(i))
+ end
+ else
+ @impl = Qmfengine::SchemaMethod.new(name)
+ @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+ end
+ end
+
+ def add_argument(arg)
+ @arguments << arg
+ @impl.addArgument(arg.impl)
+ end
+
+ def name
+ @impl.getName
+ end
+
+ def to_s
+ name
+ end
+ end
+
+ class SchemaProperty
+ attr_reader :impl
+ def initialize(name, typecode, kwargs={})
+ if kwargs.include?(:impl)
+ @impl = kwargs[:impl]
+ else
+ @impl = Qmfengine::SchemaProperty.new(name, typecode)
+ @impl.setAccess(kwargs[:access]) if kwargs.include?(:access)
+ @impl.setIndex(kwargs[:index]) if kwargs.include?(:index)
+ @impl.setOptional(kwargs[:optional]) if kwargs.include?(:optional)
+ @impl.setUnit(kwargs[:unit]) if kwargs.include?(:unit)
+ @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+ end
+ end
+
+ def name
+ @impl.getName
+ end
+
+ def to_s
+ name
+ end
+ end
+
+ class SchemaStatistic
+ attr_reader :impl
+ def initialize(name, typecode, kwargs={})
+ if kwargs.include?(:impl)
+ @impl = kwargs[:impl]
+ else
+ @impl = Qmfengine::SchemaStatistic.new(name, typecode)
+ @impl.setUnit(kwargs[:unit]) if kwargs.include?(:unit)
+ @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+ end
+ end
+
+ def name
+ @impl.getName
+ end
+
+ def to_s
+ name
+ end
+ end
+
+ class SchemaClassKey
+ attr_reader :impl
+ def initialize(i)
+ @impl = Qmfengine::SchemaClassKey.new(i)
+ end
+
+ def package_name
+ @impl.getPackageName
+ end
+
+ def class_name
+ @impl.getClassName
+ end
+
+ def to_s
+ @impl.asString
+ end
+ end
+
+ class SchemaObjectClass
+ attr_reader :impl, :properties, :statistics, :methods
+ def initialize(package, name, kwargs={})
+ @properties = []
+ @statistics = []
+ @methods = []
+ if kwargs.include?(:impl)
+ @impl = kwargs[:impl]
+
+ @impl.getPropertyCount.times do |i|
+ @properties << SchemaProperty.new(nil, nil, :impl => @impl.getProperty(i))
+ end
+
+ @impl.getStatisticCount.times do |i|
+ @statistics << SchemaStatistic.new(nil, nil, :impl => @impl.getStatistic(i))
+ end
+
+ @impl.getMethodCount.times do |i|
+ @methods << SchemaMethod.new(nil, :impl => @impl.getMethod(i))
+ end
+ else
+ @impl = Qmfengine::SchemaObjectClass.new(package, name)
+ end
+ end
+
+ def add_property(prop)
+ @properties << prop
+ @impl.addProperty(prop.impl)
+ end
+
+ def add_statistic(stat)
+ @statistics << stat
+ @impl.addStatistic(stat.impl)
+ end
+
+ def add_method(meth)
+ @methods << meth
+ @impl.addMethod(meth.impl)
+ end
+
+ def class_key
+ SchemaClassKey.new(@impl.getClassKey)
+ end
+
+ def package_name
+ @impl.getClassKey.getPackageName
+ end
+
+ def class_name
+ @impl.getClassKey.getClassName
+ end
+ end
+
+ class SchemaEventClass
+ attr_reader :impl, :arguments
+ def initialize(package, name, sev, kwargs={})
+ @arguments = []
+ if kwargs.include?(:impl)
+ @impl = kwargs[:impl]
+ @impl.getArgumentCount.times do |i|
+ @arguments << SchemaArgument.new(nil, nil, :impl => @impl.getArgument(i))
+ end
+ else
+ @impl = Qmfengine::SchemaEventClass.new(package, name, sev)
+ @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+ end
+ end
+
+ def add_argument(arg)
+ @arguments << arg
+ @impl.addArgument(arg.impl)
+ end
+
+ def name
+ @impl.getClassKey.getClassName
+ end
+
+ def class_key
+ SchemaClassKey.new(@impl.getClassKey)
+ end
+
+ def package_name
+ @impl.getClassKey.getPackageName
+ end
+
+ def class_name
+ @impl.getClassKey.getClassName
+ end
+ end
+
+ ##==============================================================================
+ ## CONSOLE
+ ##==============================================================================
+
+ class ConsoleHandler
+ def agent_added(agent); end
+ def agent_deleted(agent); end
+ def new_package(package); end
+ def new_class(class_key); end
+ def object_update(object, hasProps, hasStats); end
+ def event_received(event); end
+ def agent_heartbeat(agent, timestamp); end
+ def method_response(resp); end
+ def broker_info(broker); end
+ end
+
+ class Console
+ include MonitorMixin
+ attr_reader :impl
+
+ def initialize(handler = nil, kwargs={})
+ super()
+ @handler = handler
+ @impl = Qmfengine::Console.new
+ @event = Qmfengine::ConsoleEvent.new
+ @broker_list = []
+ @cv = new_cond
+ @sync_count = nil
+ @sync_result = nil
+ @select = []
+ @bt_count = 0
+ @cb_cond = new_cond
+ @cb_thread = Thread.new do
+ run_cb_thread
+ end
+ end
+
+ def add_connection(conn)
+ broker = Broker.new(self, conn)
+ synchronize { @broker_list << broker }
+ return broker
+ end
+
+ def del_connection(broker)
+ broker.shutdown
+ synchronize { @broker_list.delete(broker) }
+ end
+
+ def packages()
+ plist = []
+ count = @impl.packageCount
+ for i in 0...count
+ plist << @impl.getPackageName(i)
+ end
+ return plist
+ end
+
+ def classes(package, kind=CLASS_OBJECT)
+ clist = []
+ count = @impl.classCount(package)
+ for i in 0...count
+ key = @impl.getClass(package, i)
+ class_kind = @impl.getClassKind(key)
+ if class_kind == kind
+ if kind == CLASS_OBJECT
+ clist << SchemaObjectClass.new(nil, nil, :impl => @impl.getObjectClass(key))
+ elsif kind == CLASS_EVENT
+ clist << SchemaEventClass.new(nil, nil, nil, :impl => @impl.getEventClass(key))
+ end
+ end
+ end
+
+ return clist
+ end
+
+ def bind_package(package)
+ @impl.bindPackage(package)
+ end
+
+ def bind_class(kwargs = {})
+ if kwargs.include?(:key)
+ @impl.bindClass(kwargs[:key])
+ elsif kwargs.include?(:package)
+ package = kwargs[:package]
+ if kwargs.include?(:class)
+ @impl.bindClass(package, kwargs[:class])
+ else
+ @impl.bindClass(package)
+ end
+ else
+ raise ArgumentError, "Invalid arguments, use :key or :package[,:class]"
+ end
+ end
+
+ def bind_event(kwargs = {})
+ if kwargs.include?(:key)
+ @impl.bindEvent(kwargs[:key])
+ elsif kwargs.include?(:package)
+ package = kwargs[:package]
+ if kwargs.include?(:event)
+ @impl.bindEvent(package, kwargs[:event])
+ else
+ @impl.bindEvent(package, "*")
+ end
+ else
+ raise ArgumentError, "Invalid arguments, use :key or :package[,:event]"
+ end
+ end
+
+ def agents(broker = nil)
+ blist = []
+ if broker
+ blist << broker
+ else
+ synchronize { blist = @broker_list }
+ end
+
+ agents = []
+ blist.each do |b|
+ count = b.impl.agentCount
+ for idx in 0...count
+ agents << AgentProxy.new(b.impl.getAgent(idx), b)
+ end
+ end
+
+ return agents
+ end
+
+ def objects(query, kwargs = {})
+ timeout = 30
+ agent = nil
+ kwargs.merge!(query) if query.class == Hash
+
+ if kwargs.include?(:timeout)
+ timeout = kwargs[:timeout]
+ kwargs.delete(:timeout)
+ end
+
+ if kwargs.include?(:agent)
+ agent = kwargs[:agent]
+ kwargs.delete(:agent)
+ end
+
+ query = Query.new(kwargs) if query.class == Hash
+
+ @select = []
+ kwargs.each do |k,v|
+ @select << [k, v] if k.is_a?(String)
+ end
+
+ synchronize do
+ @sync_count = 1
+ @sync_result = []
+ broker = nil
+ synchronize { broker = @broker_list[0] }
+ broker.send_query(query.impl, nil, agent)
+ unless @cv.wait(timeout) { @sync_count == 0 }
+ raise "Timed out waiting for response"
+ end
+
+ return @sync_result
+ end
+ end
+
+ # Return one and only one object or nil.
+ def object(query, kwargs = {})
+ objs = objects(query, kwargs)
+ return objs.length == 1 ? objs[0] : nil
+ end
+
+ # Return the first of potentially many objects.
+ def first_object(query, kwargs = {})
+ objs = objects(query, kwargs)
+ return objs.length > 0 ? objs[0] : nil
+ end
+
+ # Check the object against select to check for a match
+ def select_match(object)
+ @select.each do |key, value|
+ object.properties.each do |prop, propval|
+ if key == prop.name && value != propval
+ return nil
+ end
+ end
+ end
+ return :true
+ end
+
+ def _get_result(list, context)
+ synchronize do
+ list.each do |item|
+ @sync_result << item if select_match(item)
+ end
+ @sync_count -= 1
+ @cv.signal
+ end
+ end
+
+ def start_sync(query)
+ end
+
+ def touch_sync(sync)
+ end
+
+ def end_sync(sync)
+ end
+
+ def run_cb_thread
+ while :true
+ synchronize { @cb_cond.wait(1) }
+ begin
+ count = do_console_events
+ end until count == 0
+ end
+ end
+
+ def start_console_events
+ synchronize { @cb_cond.signal }
+ end
+
+ def do_console_events
+ count = 0
+ valid = @impl.getEvent(@event)
+ while valid
+ count += 1
+ begin
+ case @event.kind
+ when Qmfengine::ConsoleEvent::AGENT_ADDED
+ @handler.agent_added(AgentProxy.new(@event.agent, nil)) if @handler
+ when Qmfengine::ConsoleEvent::AGENT_DELETED
+ @handler.agent_deleted(AgentProxy.new(@event.agent, nil)) if @handler
+ when Qmfengine::ConsoleEvent::NEW_PACKAGE
+ @handler.new_package(@event.name) if @handler
+ when Qmfengine::ConsoleEvent::NEW_CLASS
+ @handler.new_class(SchemaClassKey.new(@event.classKey)) if @handler
+ when Qmfengine::ConsoleEvent::OBJECT_UPDATE
+ @handler.object_update(ConsoleObject.new(nil, :impl => @event.object), @event.hasProps, @event.hasStats) if @handler
+ when Qmfengine::ConsoleEvent::EVENT_RECEIVED
+ @handler.event_received(QmfEvent.new(nil, :impl => @event.event)) if @handler
+ when Qmfengine::ConsoleEvent::AGENT_HEARTBEAT
+ @handler.agent_heartbeat(AgentProxy.new(@event.agent, nil), @event.timestamp) if @handler
+ when Qmfengine::ConsoleEvent::METHOD_RESPONSE
+ end
+ rescue Exception => ex
+ puts "Exception caught in callback: #{ex}"
+ if @bt_count < 2
+ puts ex.backtrace
+ @bt_count += 1
+ end
+ end
+ @impl.popEvent
+ valid = @impl.getEvent(@event)
+ end
+ return count
+ end
+ end
+
+ class AgentProxy
+ attr_reader :impl, :broker, :label, :key
+
+ def initialize(impl, broker)
+ @impl = Qmfengine::AgentProxy.new(impl)
+ @broker = broker
+ @label = @impl.getLabel
+ @key = "#{@impl.getBrokerBank}.#{@impl.getAgentBank}"
+ end
+ end
+
+ class Broker < ConnectionHandler
+ include MonitorMixin
+ attr_reader :impl, :conn, :console, :broker_bank
+
+ def initialize(console, conn)
+ super()
+ @broker_bank = 1
+ @console = console
+ @conn = conn
+ @session = nil
+ @cv = new_cond
+ @stable = nil
+ @event = Qmfengine::BrokerEvent.new
+ @xmtMessage = Qmfengine::Message.new
+ @impl = Qmfengine::BrokerProxy.new(@console.impl)
+ @console.impl.addConnection(@impl, self)
+ @conn.add_conn_handler(self)
+ @operational = :true
+ end
+
+ def shutdown()
+ @console.impl.delConnection(@impl)
+ @conn.del_conn_handler(self)
+ @operational = :false
+ end
+
+ def wait_for_stable(timeout = nil)
+ synchronize do
+ return if @stable
+ if timeout
+ unless @cv.wait(timeout) { @stable }
+ raise "Timed out waiting for broker connection to become stable"
+ end
+ else
+ while not @stable
+ @cv.wait
+ end
+ end
+ end
+ end
+
+ def send_query(query, ctx, agent)
+ agent_impl = agent.impl if agent
+ @impl.sendQuery(query, ctx, agent_impl)
+ @conn.kick
+ end
+
+ def do_broker_events()
+ count = 0
+ valid = @impl.getEvent(@event)
+ while valid
+ count += 1
+ case @event.kind
+ when Qmfengine::BrokerEvent::BROKER_INFO
+ when Qmfengine::BrokerEvent::DECLARE_QUEUE
+ @conn.impl.declareQueue(@session.handle, @event.name)
+ when Qmfengine::BrokerEvent::DELETE_QUEUE
+ @conn.impl.deleteQueue(@session.handle, @event.name)
+ when Qmfengine::BrokerEvent::BIND
+ @conn.impl.bind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
+ when Qmfengine::BrokerEvent::UNBIND
+ @conn.impl.unbind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
+ when Qmfengine::BrokerEvent::SETUP_COMPLETE
+ @impl.startProtocol
+ when Qmfengine::BrokerEvent::STABLE
+ synchronize do
+ @stable = :true
+ @cv.signal
+ end
+ when Qmfengine::BrokerEvent::QUERY_COMPLETE
+ result = []
+ for idx in 0...@event.queryResponse.getObjectCount
+ result << ConsoleObject.new(nil, :impl => @event.queryResponse.getObject(idx), :broker => self)
+ end
+ @console._get_result(result, @event.context)
+ when Qmfengine::BrokerEvent::METHOD_RESPONSE
+ obj = @event.context
+ obj._method_result(MethodResponse.new(@event.methodResponse))
+ end
+ @impl.popEvent
+ valid = @impl.getEvent(@event)
+ end
+ return count
+ end
+
+ def do_broker_messages()
+ count = 0
+ valid = @impl.getXmtMessage(@xmtMessage)
+ while valid
+ count += 1
+ @conn.impl.sendMessage(@session.handle, @xmtMessage)
+ @impl.popXmt
+ valid = @impl.getXmtMessage(@xmtMessage)
+ end
+ return count
+ end
+
+ def do_events()
+ begin
+ @console.start_console_events
+ bcnt = do_broker_events
+ mcnt = do_broker_messages
+ end until bcnt == 0 and mcnt == 0
+ end
+
+ def conn_event_connected()
+ puts "Console Connection Established..."
+ @session = Session.new(@conn, "qmfc-%s.%d" % [Socket.gethostname, Process::pid], self)
+ @impl.sessionOpened(@session.handle)
+ do_events
+ end
+
+ def conn_event_disconnected(error)
+ puts "Console Connection Lost"
+ end
+
+ def conn_event_visit
+ do_events
+ end
+
+ def sess_event_session_closed(context, error)
+ puts "Console Session Lost"
+ @impl.sessionClosed()
+ end
+
+ def sess_event_recv(context, message)
+ puts "Unexpected RECV Event" if not @operational
+ @impl.handleRcvMessage(message)
+ do_events
+ end
+ end
+
+ ##==============================================================================
+ ## AGENT
+ ##==============================================================================
+
+ class AgentHandler
+ def get_query(context, query, userId); end
+ def method_call(context, name, object_id, args, userId); end
+ end
+
+ class Agent < ConnectionHandler
+ def initialize(handler, label="")
+ if label == ""
+ @agentLabel = "rb-%s.%d" % [Socket.gethostname, Process::pid]
+ else
+ @agentLabel = label
+ end
+ @conn = nil
+ @handler = handler
+ @impl = Qmfengine::Agent.new(@agentLabel)
+ @event = Qmfengine::AgentEvent.new
+ @xmtMessage = Qmfengine::Message.new
+ end
+
+ def set_connection(conn)
+ @conn = conn
+ @conn.add_conn_handler(self)
+ end
+
+ def register_class(cls)
+ @impl.registerClass(cls.impl)
+ end
+
+ def alloc_object_id(low = 0, high = 0)
+ ObjectId.new(@impl.allocObjectId(low, high))
+ end
+
+ def raise_event(event)
+ @impl.raiseEvent(event.impl)
+ end
+
+ def query_response(context, object)
+ @impl.queryResponse(context, object.impl)
+ end
+
+ def query_complete(context)
+ @impl.queryComplete(context)
+ end
+
+ def method_response(context, status, text, arguments)
+ @impl.methodResponse(context, status, text, arguments.map)
+ end
+
+ def do_agent_events()
+ count = 0
+ valid = @impl.getEvent(@event)
+ while valid
+ count += 1
+ case @event.kind
+ when Qmfengine::AgentEvent::GET_QUERY
+ @handler.get_query(@event.sequence, Query.new(:impl => @event.query), @event.authUserId)
+ when Qmfengine::AgentEvent::START_SYNC
+ when Qmfengine::AgentEvent::END_SYNC
+ when Qmfengine::AgentEvent::METHOD_CALL
+ args = Arguments.new(@event.arguments)
+ @handler.method_call(@event.sequence, @event.name, ObjectId.new(@event.objectId),
+ args, @event.authUserId)
+ when Qmfengine::AgentEvent::DECLARE_QUEUE
+ @conn.impl.declareQueue(@session.handle, @event.name)
+ when Qmfengine::AgentEvent::DELETE_QUEUE
+ @conn.impl.deleteQueue(@session.handle, @event.name)
+ when Qmfengine::AgentEvent::BIND
+ @conn.impl.bind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
+ when Qmfengine::AgentEvent::UNBIND
+ @conn.impl.unbind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
+ when Qmfengine::AgentEvent::SETUP_COMPLETE
+ @impl.startProtocol()
+ end
+ @impl.popEvent
+ valid = @impl.getEvent(@event)
+ end
+ return count
+ end
+
+ def do_agent_messages()
+ count = 0
+ valid = @impl.getXmtMessage(@xmtMessage)
+ while valid
+ count += 1
+ @conn.impl.sendMessage(@session.handle, @xmtMessage)
+ @impl.popXmt
+ valid = @impl.getXmtMessage(@xmtMessage)
+ end
+ return count
+ end
+
+ def do_events()
+ begin
+ ecnt = do_agent_events
+ mcnt = do_agent_messages
+ end until ecnt == 0 and mcnt == 0
+ end
+
+ def conn_event_connected()
+ puts "Agent Connection Established..."
+ @session = Session.new(@conn, "qmfa-%s.%d" % [Socket.gethostname, Process::pid], self)
+ @impl.newSession
+ do_events
+ end
+
+ def conn_event_disconnected(error)
+ puts "Agent Connection Lost"
+ end
+
+ def conn_event_visit
+ do_events
+ end
+
+ def sess_event_session_closed(context, error)
+ puts "Agent Session Lost"
+ end
+
+ def sess_event_recv(context, message)
+ @impl.handleRcvMessage(message)
+ do_events
+ end
+ end
+end
diff --git a/qpid/cpp/bindings/qmf/ruby/ruby.i b/qpid/cpp/bindings/qmf/ruby/ruby.i
new file mode 100644
index 0000000000..0101861100
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/ruby/ruby.i
@@ -0,0 +1,106 @@
+/*
+ * 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 stl.i
+
+%module qmfengine
+
+%typemap (in) void *
+{
+ $1 = (void *) $input;
+}
+
+%typemap (out) void *
+{
+ $result = (VALUE) $1;
+}
+
+%typemap (in) uint16_t
+{
+ $1 = NUM2UINT ($input);
+}
+
+%typemap (out) uint16_t
+{
+ $result = UINT2NUM((uint16_t) $1);
+}
+
+%typemap (in) uint32_t
+{
+ if (TYPE($input) == T_BIGNUM)
+ $1 = NUM2UINT($input);
+ else
+ $1 = FIX2UINT($input);
+}
+
+%typemap (out) uint32_t
+{
+ $result = UINT2NUM((uint32_t) $1);
+}
+
+%typemap (in) int32_t
+{
+ if (TYPE($input) == T_BIGNUM)
+ $1 = NUM2INT($input);
+ else
+ $1 = FIX2INT($input);
+}
+
+%typemap (out) int32_t
+{
+ $result = INT2NUM((int32_t) $1);
+}
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_INTEGER) uint32_t {
+ $1 = FIXNUM_P($input);
+}
+
+%typemap (in) uint64_t
+{
+ if (TYPE($input) == T_BIGNUM)
+ $1 = NUM2ULL($input);
+ else
+ $1 = (uint64_t) FIX2ULONG($input);
+}
+
+%typemap (out) uint64_t
+{
+ $result = ULL2NUM((uint64_t) $1);
+}
+
+%typemap (in) int64_t
+{
+ if (TYPE($input) == T_BIGNUM)
+ $1 = NUM2LL($input);
+ else
+ $1 = (int64_t) FIX2LONG($input);
+}
+
+%typemap (out) int64_t
+{
+ $result = LL2NUM((int64_t) $1);
+}
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_INTEGER) uint64_t {
+ $1 = FIXNUM_P($input);
+}
+
+
+%include "../qmfengine.i"
+
diff --git a/qpid/cpp/bindings/qmf/tests/Makefile.am b/qpid/cpp/bindings/qmf/tests/Makefile.am
new file mode 100644
index 0000000000..182771e16b
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/tests/Makefile.am
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+TESTS = run_interop_tests
+
+EXTRA_DIST = \
+ agent_ruby.rb \
+ python_agent.py \
+ python_console.py \
+ ruby_console.rb \
+ run_interop_tests
diff --git a/qpid/cpp/bindings/qmf/tests/agent_ruby.rb b/qpid/cpp/bindings/qmf/tests/agent_ruby.rb
new file mode 100755
index 0000000000..5ee5e371d3
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/tests/agent_ruby.rb
@@ -0,0 +1,279 @@
+#!/usr/bin/ruby
+
+#
+# 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.
+#
+
+require 'qmf'
+require 'socket'
+
+class Model
+ attr_reader :parent_class, :child_class, :event_class
+
+ def initialize
+ @parent_class = Qmf::SchemaObjectClass.new("org.apache.qpid.qmf", "parent")
+ @parent_class.add_property(Qmf::SchemaProperty.new("name", Qmf::TYPE_SSTR, :index => true))
+ @parent_class.add_property(Qmf::SchemaProperty.new("state", Qmf::TYPE_SSTR))
+
+ @parent_class.add_property(Qmf::SchemaProperty.new("uint64val", Qmf::TYPE_UINT64))
+ @parent_class.add_property(Qmf::SchemaProperty.new("uint32val", Qmf::TYPE_UINT32))
+ @parent_class.add_property(Qmf::SchemaProperty.new("uint16val", Qmf::TYPE_UINT16))
+ @parent_class.add_property(Qmf::SchemaProperty.new("uint8val", Qmf::TYPE_UINT8))
+
+ @parent_class.add_property(Qmf::SchemaProperty.new("int64val", Qmf::TYPE_INT64))
+ @parent_class.add_property(Qmf::SchemaProperty.new("int32val", Qmf::TYPE_INT32))
+ @parent_class.add_property(Qmf::SchemaProperty.new("int16val", Qmf::TYPE_INT16))
+ @parent_class.add_property(Qmf::SchemaProperty.new("int8val", Qmf::TYPE_INT8))
+
+ @parent_class.add_property(Qmf::SchemaProperty.new("sstrval", Qmf::TYPE_SSTR))
+ @parent_class.add_property(Qmf::SchemaProperty.new("lstrval", Qmf::TYPE_LSTR))
+
+ @parent_class.add_property(Qmf::SchemaProperty.new("mapval", Qmf::TYPE_MAP))
+ @parent_class.add_property(Qmf::SchemaProperty.new("listval", Qmf::TYPE_LIST))
+
+ @parent_class.add_statistic(Qmf::SchemaStatistic.new("queryCount", Qmf::TYPE_UINT32, :unit => "query", :desc => "Query count"))
+
+ method = Qmf::SchemaMethod.new("echo", :desc => "Check responsiveness of the agent object")
+ method.add_argument(Qmf::SchemaArgument.new("sequence", Qmf::TYPE_UINT32, :dir => Qmf::DIR_IN_OUT))
+ @parent_class.add_method(method)
+
+ method = Qmf::SchemaMethod.new("set_numerics", :desc => "Set the numeric values in the object")
+ method.add_argument(Qmf::SchemaArgument.new("test", Qmf::TYPE_SSTR, :dir => Qmf::DIR_IN))
+ @parent_class.add_method(method)
+
+ method = Qmf::SchemaMethod.new("test_map_list", :desc => "A method call that accepts map and list arguments.")
+ method.add_argument(Qmf::SchemaArgument.new("inMap", Qmf::TYPE_MAP, :dir => Qmf::DIR_IN))
+ method.add_argument(Qmf::SchemaArgument.new("inList", Qmf::TYPE_LIST, :dir => Qmf::DIR_IN))
+ method.add_argument(Qmf::SchemaArgument.new("outMap", Qmf::TYPE_MAP, :dir => Qmf::DIR_OUT))
+ method.add_argument(Qmf::SchemaArgument.new("outList", Qmf::TYPE_LIST, :dir => Qmf::DIR_OUT))
+ @parent_class.add_method(method)
+
+ method = Qmf::SchemaMethod.new("set_short_string", :desc => "Set the short string value in the object")
+ method.add_argument(Qmf::SchemaArgument.new("value", Qmf::TYPE_SSTR, :dir => Qmf::DIR_IN_OUT))
+ @parent_class.add_method(method)
+
+ method = Qmf::SchemaMethod.new("set_long_string", :desc => "Set the long string value in the object")
+ method.add_argument(Qmf::SchemaArgument.new("value", Qmf::TYPE_LSTR, :dir => Qmf::DIR_IN_OUT))
+ @parent_class.add_method(method)
+
+ method = Qmf::SchemaMethod.new("create_child", :desc => "Create a new child object")
+ method.add_argument(Qmf::SchemaArgument.new("child_name", Qmf::TYPE_LSTR, :dir => Qmf::DIR_IN))
+ method.add_argument(Qmf::SchemaArgument.new("child_ref", Qmf::TYPE_REF, :dir => Qmf::DIR_OUT))
+ @parent_class.add_method(method)
+
+ method = Qmf::SchemaMethod.new("probe_userid", :desc => "Return the user-id for this method call")
+ method.add_argument(Qmf::SchemaArgument.new("userid", Qmf::TYPE_SSTR, :dir => Qmf::DIR_OUT))
+ @parent_class.add_method(method)
+
+ @child_class = Qmf::SchemaObjectClass.new("org.apache.qpid.qmf", "child")
+ @child_class.add_property(Qmf::SchemaProperty.new("name", Qmf::TYPE_SSTR, :index => true))
+
+ @event_class = Qmf::SchemaEventClass.new("org.apache.qpid.qmf", "test_event", Qmf::SEV_INFORM)
+ @event_class.add_argument(Qmf::SchemaArgument.new("uint32val", Qmf::TYPE_UINT32))
+ @event_class.add_argument(Qmf::SchemaArgument.new("strval", Qmf::TYPE_LSTR))
+ @event_class.add_argument(Qmf::SchemaArgument.new("mapval", Qmf::TYPE_MAP))
+ @event_class.add_argument(Qmf::SchemaArgument.new("listval", Qmf::TYPE_LIST))
+ end
+
+ def register(agent)
+ agent.register_class(@parent_class)
+ agent.register_class(@child_class)
+ agent.register_class(@event_class)
+ end
+end
+
+
+class App < Qmf::AgentHandler
+ def get_query(context, query, userId)
+# puts "Query: user=#{userId} context=#{context} class=#{query.class_name} object_num=#{query.object_id if query.object_id}"
+ if query.class_name == 'parent'
+ @agent.query_response(context, @parent)
+ elsif query.object_id == @parent_oid
+ @agent.query_response(context, @parent)
+ end
+ @agent.query_complete(context)
+ end
+
+ def method_call(context, name, object_id, args, userId)
+# puts "Method: user=#{userId} context=#{context} method=#{name} object_num=#{object_id if object_id} args=#{args}"
+
+ retCode = 0
+ retText = "OK"
+
+ if name == "echo"
+ @agent.method_response(context, 0, "OK", args)
+
+ elsif name == "test_map_list"
+ # build the output map from the input map, accessing each key,
+ # value to ensure they are encoded/decoded
+ outMap = {}
+ args['inMap'].each do |k,v|
+ outMap[k] = v
+ end
+
+ # same deal for the output list
+ outList = []
+ args['inList'].each do |v|
+ outList << v
+ end
+
+ args['outMap'] = outMap
+ args['outList'] = outList
+
+ elsif name == "set_numerics"
+
+ if args['test'] == "big"
+ @parent.uint64val = 0x9494949449494949
+ @parent.uint32val = 0xa5a55a5a
+ @parent.uint16val = 0xb66b
+ @parent.uint8val = 0xc7
+
+ @parent.int64val = 1000000000000000000
+ @parent.int32val = 1000000000
+ @parent.int16val = 10000
+ @parent.int8val = 100
+
+ event = Qmf::QmfEvent.new(@model.event_class)
+ event.uint32val = @parent.uint32val
+ event.strval = "Unused"
+ event.mapval = @parent.mapval
+ event.listval = @parent.listval
+ @agent.raise_event(event)
+
+ elsif args['test'] == "small"
+ @parent.uint64val = 4
+ @parent.uint32val = 5
+ @parent.uint16val = 6
+ @parent.uint8val = 7
+
+ @parent.int64val = 8
+ @parent.int32val = 9
+ @parent.int16val = 10
+ @parent.int8val = 11
+
+ event = Qmf::QmfEvent.new(@model.event_class)
+ event.uint32val = @parent.uint32val
+ event.strval = "Unused"
+ @agent.raise_event(event)
+
+ elsif args['test'] == "negative"
+ @parent.uint64val = 0
+ @parent.uint32val = 0
+ @parent.uint16val = 0
+ @parent.uint8val = 0
+
+ @parent.int64val = -10000000000
+ @parent.int32val = -100000
+ @parent.int16val = -1000
+ @parent.int8val = -100
+
+ event = Qmf::QmfEvent.new(@model.event_class)
+ event.uint32val = @parent.uint32val
+ event.strval = "Unused"
+ @agent.raise_event(event)
+
+ else
+ retCode = 1
+ retText = "Invalid argument value for test"
+ end
+
+ elsif name == "set_short_string"
+ @parent.sstrval = args['value']
+
+ event = Qmf::QmfEvent.new(@model.event_class)
+ event.uint32val = 0
+ event.strval = @parent.sstrval
+ @agent.raise_event(event)
+
+ elsif name == "set_long_string"
+ @parent.lstrval = args['value']
+
+ event = Qmf::QmfEvent.new(@model.event_class)
+ event.uint32val = 0
+ event.strval = @parent.lstrval
+ @agent.raise_event(event)
+
+ elsif name == "create_child"
+ oid = @agent.alloc_object_id(2)
+ args['child_ref'] = oid
+ @child = Qmf::AgentObject.new(@model.child_class)
+ @child.name = args.by_key("child_name")
+ @child.set_object_id(oid)
+
+ elsif name == "probe_userid"
+ args['userid'] = userId
+
+ else
+ retCode = 1
+ retText = "Unimplemented Method: #{name}"
+ end
+
+ @agent.method_response(context, retCode, retText, args)
+ end
+
+ def main
+ @settings = Qmf::ConnectionSettings.new
+ @settings.set_attr("host", ARGV[0]) if ARGV.size > 0
+ @settings.set_attr("port", ARGV[1].to_i) if ARGV.size > 1
+ @connection = Qmf::Connection.new(@settings)
+ @agent = Qmf::Agent.new(self, "agent_test_label")
+
+ @model = Model.new
+ @model.register(@agent)
+
+ @agent.set_connection(@connection)
+
+ @parent = Qmf::AgentObject.new(@model.parent_class)
+ @parent.name = "Parent One"
+ @parent.state = "OPERATIONAL"
+
+ @parent.uint64val = 0
+ @parent.uint32val = 0
+ @parent.uint16val = 0
+ @parent.uint8val = 0
+
+ @parent.int64val = 0
+ @parent.int32val = 0
+ @parent.int16val = 0
+ @parent.int8val = 0
+
+ # a list containing a list that contains a map (so there!)
+ @parent.listval = ['a', 1, 'b', -2,
+ ['c', true, 3.1415,
+ {"hi" => 10, "lo" => 5, "neg" => -3}]]
+
+ # a default map
+ @parent.mapval = {'aLong' => 9999999999,
+ 'aInt' => 54321,
+ 'aSigned' => -666,
+ 'aString' => "A String",
+ 'aFloat'=> 3.1415,
+ 'aMap' => {"first" => 1, "second" => 2},
+ 'aList' => ['x', -1, 'y', 2]}
+
+ @parent_oid = @agent.alloc_object_id(1)
+ @parent.set_object_id(@parent_oid)
+
+ sleep
+ end
+end
+
+app = App.new
+app.main
+
+
diff --git a/qpid/cpp/bindings/qmf/tests/python_agent.py b/qpid/cpp/bindings/qmf/tests/python_agent.py
new file mode 100644
index 0000000000..28ba47e1bb
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/tests/python_agent.py
@@ -0,0 +1,326 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+
+import qmf
+import sys
+import time
+
+
+class Model:
+ # attr_reader :parent_class, :child_class
+ def __init__(self):
+ self.parent_class = qmf.SchemaObjectClass("org.apache.qpid.qmf", "parent")
+ self.parent_class.add_property(qmf.SchemaProperty("name", qmf.TYPE_SSTR, {"index":True}))
+ self.parent_class.add_property(qmf.SchemaProperty("state", qmf.TYPE_SSTR))
+
+ self.parent_class.add_property(qmf.SchemaProperty("uint64val", qmf.TYPE_UINT64))
+ self.parent_class.add_property(qmf.SchemaProperty("uint32val", qmf.TYPE_UINT32))
+ self.parent_class.add_property(qmf.SchemaProperty("uint16val", qmf.TYPE_UINT16))
+ self.parent_class.add_property(qmf.SchemaProperty("uint8val", qmf.TYPE_UINT8))
+
+ self.parent_class.add_property(qmf.SchemaProperty("int64val", qmf.TYPE_INT64))
+ self.parent_class.add_property(qmf.SchemaProperty("int32val", qmf.TYPE_INT32))
+ self.parent_class.add_property(qmf.SchemaProperty("int16val", qmf.TYPE_INT16))
+ self.parent_class.add_property(qmf.SchemaProperty("int8val", qmf.TYPE_INT8))
+
+ self.parent_class.add_property(qmf.SchemaProperty("sstrval", qmf.TYPE_SSTR))
+ self.parent_class.add_property(qmf.SchemaProperty("lstrval", qmf.TYPE_LSTR))
+
+ self.parent_class.add_property(qmf.SchemaProperty("mapval", qmf.TYPE_MAP))
+ self.parent_class.add_property(qmf.SchemaProperty("listval", qmf.TYPE_LIST))
+
+
+ self.parent_class.add_statistic(qmf.SchemaStatistic("queryCount", qmf.TYPE_UINT32, {"unit":"query", "desc":"Query count"}))
+
+ _method = qmf.SchemaMethod("echo", {"desc":"Check responsiveness of the agent object"})
+ _method.add_argument(qmf.SchemaArgument("sequence", qmf.TYPE_UINT32, {"dir":qmf.DIR_IN_OUT}))
+ self.parent_class.add_method(_method)
+
+ _method = qmf.SchemaMethod("set_numerics", {"desc":"Set the numeric values in the object"})
+ _method.add_argument(qmf.SchemaArgument("test", qmf.TYPE_SSTR, {"dir":qmf.DIR_IN}))
+ self.parent_class.add_method(_method)
+
+ _method = qmf.SchemaMethod("test_map_list", {"desc":"A method call that accepts map and list arguments."})
+ _method.add_argument(qmf.SchemaArgument("inMap", qmf.TYPE_MAP, {"dir":qmf.DIR_IN}))
+ _method.add_argument(qmf.SchemaArgument("inList", qmf.TYPE_LIST, {"dir":qmf.DIR_IN}))
+ _method.add_argument(qmf.SchemaArgument("outMap", qmf.TYPE_MAP, {"dir":qmf.DIR_OUT}))
+ _method.add_argument(qmf.SchemaArgument("outList", qmf.TYPE_LIST, {"dir":qmf.DIR_OUT}))
+ self.parent_class.add_method(_method)
+
+ _method = qmf.SchemaMethod("set_short_string", {"desc":"Set the short string value in the object"})
+ _method.add_argument(qmf.SchemaArgument("value", qmf.TYPE_SSTR, {"dir":qmf.DIR_IN_OUT}))
+ self.parent_class.add_method(_method)
+
+ _method = qmf.SchemaMethod("set_long_string", {"desc":"Set the long string value in the object"})
+ _method.add_argument(qmf.SchemaArgument("value", qmf.TYPE_LSTR, {"dir":qmf.DIR_IN_OUT}))
+ self.parent_class.add_method(_method)
+
+ _method = qmf.SchemaMethod("create_child", {"desc":"Create a new child object"})
+ _method.add_argument(qmf.SchemaArgument("child_name", qmf.TYPE_LSTR, {"dir":qmf.DIR_IN}))
+ _method.add_argument(qmf.SchemaArgument("child_ref", qmf.TYPE_REF, {"dir":qmf.DIR_OUT}))
+ self.parent_class.add_method(_method)
+
+ _method = qmf.SchemaMethod("probe_userid", {"desc":"Return the user-id for this method call"})
+ _method.add_argument(qmf.SchemaArgument("userid", qmf.TYPE_SSTR, {"dir":qmf.DIR_OUT}))
+ self.parent_class.add_method(_method)
+
+ self.child_class = qmf.SchemaObjectClass("org.apache.qpid.qmf", "child")
+ self.child_class.add_property(qmf.SchemaProperty("name", qmf.TYPE_SSTR, {"index":True}))
+
+ self.event_class = qmf.SchemaEventClass("org.apache.qpid.qmf", "test_event", qmf.SEV_NOTICE)
+ self.event_class.add_argument(qmf.SchemaArgument("uint32val", qmf.TYPE_UINT32))
+ self.event_class.add_argument(qmf.SchemaArgument("strval", qmf.TYPE_LSTR))
+ self.event_class.add_argument(qmf.SchemaArgument("mapval", qmf.TYPE_MAP))
+ self.event_class.add_argument(qmf.SchemaArgument("listval", qmf.TYPE_LIST))
+
+ def register(self, agent):
+ agent.register_class(self.parent_class)
+ agent.register_class(self.child_class)
+ agent.register_class(self.event_class)
+
+
+
+class App(qmf.AgentHandler):
+ '''
+ Object that handles events received by the Agent.
+ '''
+ def get_query(self, context, query, userId):
+ '''
+ Respond to a Query request from a console.
+ '''
+ #print "Query: user=%s context=%d class=%s" % (userId, context, query.class_name())
+ #if query.object_id():
+ # print query.object_id().object_num_low()
+ self._parent.inc_attr("queryCount")
+ if query.class_name() == 'parent':
+ self._agent.query_response(context, self._parent)
+ elif query.object_id() == self._parent_oid:
+ self._agent.query_response(context, self._parent)
+ self._agent.query_complete(context)
+
+
+ def method_call(self, context, name, object_id, args, userId):
+ '''
+ Invoke a method call requested by the console.
+ '''
+ #print "Method: name=%s user=%s context=%d object_id=%s args=%s" % (name, userId, context, object_id, args)
+ if name == "echo":
+ self._agent.method_response(context, 0, "OK", args)
+
+ elif name == "test_map_list":
+ # build the output map from the input map, accessing each key,
+ # value to ensure they are encoded/decoded
+ outMap = {}
+ for key,value in args['inMap'].items():
+ outMap[key] = value
+
+ # same deal for the output list
+ outList = []
+ for value in args['inList']:
+ outList.append(value)
+
+ args['outMap'] = outMap
+ args['outList'] = outList
+ self._agent.method_response(context, 0, "OK", args)
+
+ elif name == "set_numerics":
+ _retCode = 0
+ _retText = "OK"
+
+ if args['test'] == "big":
+ #
+ # note the alternate forms for setting object attributes:
+ #
+ self._parent.set_attr("uint64val", 0x9494949449494949)
+ self._parent.uint32val = 0xa5a55a5a
+ self._parent.set_attr("uint16val", 0xb66b)
+ self._parent["uint8val"] = 0xc7
+
+ self._parent.int64val = 1000000000000000000
+ self._parent.set_attr("int32val", 1000000000)
+ self._parent["int16val"] = 10000
+ self._parent.set_attr("int8val", 100)
+
+ event = qmf.QmfEvent(self._model.event_class)
+ event.uint32val = self._parent.get_attr("uint32val")
+ event.strval = "Unused"
+ event.mapval = self._parent.get_attr("mapval")
+ event.listval = self._parent["listval"]
+
+ self._agent.raise_event(event)
+
+ ## Test the __getattr__ implementation:
+ ## @todo: remove once python_client implements this
+ ## form of property access
+ assert self._parent["uint8val"] == 0xc7
+ assert self._parent.uint64val == 0x9494949449494949
+
+ # note the alternative argument access syntax:
+ elif args.test == "small":
+ self._parent.set_attr("uint64val", 4)
+ self._parent.set_attr("uint32val", 5)
+ self._parent.set_attr("uint16val", 6)
+ self._parent.set_attr("uint8val", 7)
+
+ self._parent.set_attr("int64val", 8)
+ self._parent.set_attr("int32val", 9)
+ self._parent.set_attr("int16val", 10)
+ self._parent.set_attr("int8val", 11)
+
+ event = qmf.QmfEvent(self._model.event_class)
+ event.uint32val = self._parent.uint32val
+ event.strval = "Unused"
+ self._agent.raise_event(event)
+
+ elif args['test'] == "negative":
+ self._parent.set_attr("uint64val", 0)
+ self._parent.set_attr("uint32val", 0)
+ self._parent.set_attr("uint16val", 0)
+ self._parent.set_attr("uint8val", 0)
+
+ self._parent.set_attr("int64val", -10000000000)
+ self._parent.set_attr("int32val", -100000)
+ self._parent.set_attr("int16val", -1000)
+ self._parent.set_attr("int8val", -100)
+
+ event = qmf.QmfEvent(self._model.event_class)
+ event.uint32val = self._parent.uint32val
+ event.strval = "Unused"
+ self._agent.raise_event(event)
+
+ else:
+ _retCode = 1
+ _retText = "Invalid argument value for test"
+
+ self._agent.method_response(context, _retCode, _retText, args)
+
+ elif name == "set_short_string":
+ self._parent.set_attr('sstrval', args['value'])
+ event = qmf.QmfEvent(self._model.event_class)
+ event.uint32val = 0
+ event.strval = self._parent.sstrval
+ self._agent.raise_event(event)
+
+ self._agent.method_response(context, 0, "OK", args)
+
+ elif name == "set_long_string":
+ self._parent.set_attr('lstrval', args['value'])
+ event = qmf.QmfEvent(self._model.event_class)
+ event.uint32val = 0
+ event.strval = self._parent.lstrval
+ self._agent.raise_event(event)
+
+ self._agent.method_response(context, 0, "OK", args)
+
+ elif name == "create_child":
+ #
+ # Instantiate an object based on the Child Schema Class
+ #
+ _oid = self._agent.alloc_object_id(2)
+ args['child_ref'] = _oid
+ self._child = qmf.AgentObject(self._model.child_class)
+ self._child.set_attr("name", args["child_name"])
+ self._child.set_object_id(_oid)
+ self._agent.method_response(context, 0, "OK", args)
+
+ elif name == "probe_userid":
+ args['userid'] = userId
+ self._agent.method_response(context, 0, "OK", args)
+
+ else:
+ self._agent.method_response(context, 1, "Unimplemented Method: %s" % name, args)
+
+
+ def main(self):
+ '''
+ Agent application's main processing loop.
+ '''
+ # Connect to the broker
+ self._settings = qmf.ConnectionSettings()
+ self._settings.sendUserId = True
+ if len(sys.argv) > 1:
+ self._settings.host = str(sys.argv[1])
+ if len(sys.argv) > 2:
+ self._settings.port = int(sys.argv[2])
+ self._connection = qmf.Connection(self._settings)
+
+ # Instantiate an Agent to serve me queries and method calls
+ self._agent = qmf.Agent(self, "agent_test_label")
+
+ # Dynamically define the parent and child schemas, then
+ # register them with the agent
+ self._model = Model()
+ self._model.register(self._agent)
+
+ # Tell the agent about our connection to the broker
+ self._agent.set_connection(self._connection)
+
+ # Instantiate and populate an instance of the Parent
+ # Schema Object
+ self._parent = qmf.AgentObject(self._model.parent_class)
+
+ ## @todo how do we force a test failure?
+ # verify the properties() and statistics() object methods:
+ assert len(self._parent.properties()) == 14
+ assert len(self._parent.statistics()) == 1
+
+ self._parent.set_attr("name", "Parent One")
+ self._parent.set_attr("state", "OPERATIONAL")
+
+ self._parent.set_attr("uint64val", 0)
+ self._parent.set_attr("uint32val", 0)
+ self._parent.set_attr("uint16val", 0)
+ self._parent.set_attr("uint8val", 0)
+
+ self._parent.set_attr("int64val", 0)
+ self._parent.set_attr("int32val", 0)
+ self._parent.set_attr("int16val", 0)
+ self._parent.set_attr("int8val", 0)
+
+ # a list containing a list that contains a map (so there!)
+ self._parent.set_attr("listval", ['a', 1, 'b', -2,
+ ['c', True, 3.1415,
+ {"hi": 10, "lo": 5, "neg": -3}]])
+ # a default map
+ self._parent.set_attr("mapval", {'aLong' : long(9999999999),
+ 'aInt' : int(54321),
+ 'aSigned' : -666,
+ 'aString' : "A String",
+ 'aFloat' : 3.1415,
+ 'aMap' : {'first' : 1,
+ 'second': 2},
+ 'aList' : ['x', -1, 'y', 2]})
+
+
+
+ self._parent_oid = self._agent.alloc_object_id(1)
+ self._parent.set_object_id(self._parent_oid)
+
+ # Now wait for events arriving on the connection
+ # to the broker...
+ while True:
+ time.sleep(1000)
+
+
+
+app = App()
+app.main()
+
diff --git a/qpid/cpp/bindings/qmf/tests/python_console.py b/qpid/cpp/bindings/qmf/tests/python_console.py
new file mode 100755
index 0000000000..1cef824fb5
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/tests/python_console.py
@@ -0,0 +1,311 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import sys
+from qpid.testlib import TestBase010
+from qpid.datatypes import Message
+from qpid.queue import Empty
+from time import sleep
+import qmf.console
+
+class QmfInteropTests(TestBase010):
+
+ def test_A_agent_presence(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ agents = []
+ count = 0
+ while len(agents) == 0:
+ agents = qmf.getObjects(_class="agent")
+ sleep(1)
+ count += 1
+ if count > 10:
+ self.fail("Timed out waiting for remote agent")
+
+ def test_B_basic_method_invocation(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+ for seq in range(10):
+ result = parent.echo(seq, _timeout=5)
+ self.assertEqual(result.status, 0)
+ self.assertEqual(result.text, "OK")
+ self.assertEqual(result.sequence, seq)
+
+ result = parent.set_numerics("bogus")
+ self.assertEqual(result.status, 1)
+ self.assertEqual(result.text, "Invalid argument value for test")
+
+ def test_C_basic_types_numeric_big(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ result = parent.set_numerics("big")
+ self.assertEqual(result.status, 0)
+ self.assertEqual(result.text, "OK")
+
+ parent.update()
+
+ self.assertEqual(parent.uint64val, 0x9494949449494949)
+ self.assertEqual(parent.uint32val, 0xA5A55A5A)
+ self.assertEqual(parent.uint16val, 0xB66B)
+ self.assertEqual(parent.uint8val, 0xC7)
+
+ self.assertEqual(parent.int64val, 1000000000000000000)
+ self.assertEqual(parent.int32val, 1000000000)
+ self.assertEqual(parent.int16val, 10000)
+ self.assertEqual(parent.int8val, 100)
+
+ def test_C_basic_types_numeric_small(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ result = parent.set_numerics("small")
+ self.assertEqual(result.status, 0)
+ self.assertEqual(result.text, "OK")
+
+ parent.update()
+
+ self.assertEqual(parent.uint64val, 4)
+ self.assertEqual(parent.uint32val, 5)
+ self.assertEqual(parent.uint16val, 6)
+ self.assertEqual(parent.uint8val, 7)
+
+ self.assertEqual(parent.int64val, 8)
+ self.assertEqual(parent.int32val, 9)
+ self.assertEqual(parent.int16val, 10)
+ self.assertEqual(parent.int8val, 11)
+
+ def test_C_basic_types_numeric_negative(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ result = parent.set_numerics("negative")
+ self.assertEqual(result.status, 0)
+ self.assertEqual(result.text, "OK")
+
+ parent.update()
+
+ self.assertEqual(parent.uint64val, 0)
+ self.assertEqual(parent.uint32val, 0)
+ self.assertEqual(parent.uint16val, 0)
+ self.assertEqual(parent.uint8val, 0)
+
+ self.assertEqual(parent.int64val, -10000000000)
+ self.assertEqual(parent.int32val, -100000)
+ self.assertEqual(parent.int16val, -1000)
+ self.assertEqual(parent.int8val, -100)
+
+ def disabled_test_D_userid_for_method(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ result = parent.probe_userid()
+ self.assertEqual(result.status, 0)
+ self.assertEqual(result.userid, "guest")
+
+ def test_D_get_by_object_id(self):
+ self.startQmf()
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ newList = qmf.getObjects(_objectId=parent.getObjectId())
+ self.assertEqual(len(newList), 1)
+
+ def test_E_filter_by_object_id(self):
+ self.startQmf()
+ qmf = self.qmf
+
+ list = qmf.getObjects(_class="exchange", name="qpid.management")
+ self.assertEqual(len(list), 1, "No Management Exchange")
+ mgmt_exchange = list[0]
+
+ bindings = qmf.getObjects(_class="binding", exchangeRef=mgmt_exchange.getObjectId())
+ if len(bindings) == 0:
+ self.fail("No bindings found on management exchange")
+
+ for binding in bindings:
+ self.assertEqual(binding.exchangeRef, mgmt_exchange.getObjectId())
+
+ def test_F_events(self):
+ class Handler(qmf.console.Console):
+ def __init__(self):
+ self.queue = []
+
+ def event(self, broker, event):
+ if event.getClassKey().getClassName() == "test_event":
+ self.queue.append(event)
+
+ handler = Handler()
+ self.startQmf(handler)
+
+ parents = self.qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ parent.set_numerics("big")
+ parent.set_numerics("small")
+ parent.set_numerics("negative")
+ parent.set_short_string("TEST")
+ parent.set_long_string("LONG_TEST")
+ parent.probe_userid()
+
+ queue = handler.queue
+ self.assertEqual(len(queue), 5)
+ self.assertEqual(queue[0].arguments["uint32val"], 0xA5A55A5A)
+ self.assertEqual(queue[0].arguments["strval"], "Unused")
+
+ # verify map and list event content.
+ # see agent for structure of listval and mapval
+ listval = queue[0].arguments["listval"]
+ self.assertTrue(isinstance(listval, list))
+ self.assertEqual(len(listval), 5)
+ self.assertTrue(isinstance(listval[4], list))
+ self.assertEqual(len(listval[4]), 4)
+ self.assertTrue(isinstance(listval[4][3], dict))
+ self.assertEqual(listval[4][3]["hi"], 10)
+ self.assertEqual(listval[4][3]["lo"], 5)
+ self.assertEqual(listval[4][3]["neg"], -3)
+
+ mapval = queue[0].arguments["mapval"]
+ self.assertTrue(isinstance(mapval, dict))
+ self.assertEqual(len(mapval), 7)
+ self.assertEqual(mapval['aLong'], 9999999999)
+ self.assertEqual(mapval['aInt'], 54321)
+ self.assertEqual(mapval['aSigned'], -666)
+ self.assertEqual(mapval['aString'], "A String"),
+ self.assertEqual(mapval['aFloat'], 3.1415),
+ self.assertTrue(isinstance(mapval['aMap'], dict))
+ self.assertEqual(len(mapval['aMap']), 2)
+ self.assertEqual(mapval['aMap']['second'], 2)
+ self.assertTrue(isinstance(mapval['aList'], list))
+ self.assertEqual(len(mapval['aList']), 4)
+ self.assertEqual(mapval['aList'][1], -1)
+
+ self.assertEqual(queue[1].arguments["uint32val"], 5)
+ self.assertEqual(queue[1].arguments["strval"], "Unused")
+ self.assertEqual(queue[2].arguments["uint32val"], 0)
+ self.assertEqual(queue[2].arguments["strval"], "Unused")
+ self.assertEqual(queue[3].arguments["uint32val"], 0)
+ self.assertEqual(queue[3].arguments["strval"], "TEST")
+ self.assertEqual(queue[4].arguments["uint32val"], 0)
+ self.assertEqual(queue[4].arguments["strval"], "LONG_TEST")
+
+
+
+ def test_G_basic_map_list_data(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ # see agent for structure of listval
+
+ self.assertTrue(isinstance(parent.listval, list))
+ self.assertEqual(len(parent.listval), 5)
+ self.assertTrue(isinstance(parent.listval[4], list))
+ self.assertEqual(len(parent.listval[4]), 4)
+ self.assertTrue(isinstance(parent.listval[4][3], dict))
+ self.assertEqual(parent.listval[4][3]["hi"], 10)
+ self.assertEqual(parent.listval[4][3]["lo"], 5)
+ self.assertEqual(parent.listval[4][3]["neg"], -3)
+
+ # see agent for structure of mapval
+
+ self.assertTrue(isinstance(parent.mapval, dict))
+ self.assertEqual(len(parent.mapval), 7)
+ self.assertEqual(parent.mapval['aLong'], 9999999999)
+ self.assertEqual(parent.mapval['aInt'], 54321)
+ self.assertEqual(parent.mapval['aSigned'], -666)
+ self.assertEqual(parent.mapval['aString'], "A String"),
+ self.assertEqual(parent.mapval['aFloat'], 3.1415),
+ self.assertTrue(isinstance(parent.mapval['aMap'], dict))
+ self.assertEqual(len(parent.mapval['aMap']), 2)
+ self.assertEqual(parent.mapval['aMap']['second'], 2)
+ self.assertTrue(isinstance(parent.mapval['aList'], list))
+ self.assertEqual(len(parent.mapval['aList']), 4)
+ self.assertEqual(parent.mapval['aList'][1], -1)
+
+ def test_H_map_list_method_call(self):
+ self.startQmf();
+ qmf = self.qmf
+
+ parents = qmf.getObjects(_class="parent")
+ self.assertEqual(len(parents), 1)
+ parent = parents[0]
+
+ inMap = {'aLong' : long(9999999999),
+ 'aInt' : int(54321),
+ 'aSigned' : -666,
+ 'aString' : "A String",
+ 'aFloat' : 3.1415,
+ 'aList' : ['x', -1, 'y', 2],
+ 'abool' : False}
+ inList = ['aString', long(1), -1, 2.7182, {'aMap': -8}, True]
+
+ result = parent.test_map_list(inMap, inList)
+ self.assertEqual(result.status, 0)
+ self.assertEqual(result.text, "OK")
+
+ # verify returned values
+ self.assertEqual(len(inMap), len(result.outArgs['outMap']))
+ for key,value in result.outArgs['outMap'].items():
+ self.assertEqual(inMap[key], value)
+
+ self.assertEqual(len(inList), len(result.outArgs['outList']))
+ for idx in range(len(inList)):
+ self.assertEqual(inList[idx], result.outArgs['outList'][idx])
+
+
+ def getProperty(self, msg, name):
+ for h in msg.headers:
+ if hasattr(h, name): return getattr(h, name)
+ return None
+
+ def getAppHeader(self, msg, name):
+ headers = self.getProperty(msg, "application_headers")
+ if headers:
+ return headers[name]
+ return None
diff --git a/qpid/cpp/bindings/qmf/tests/ruby_console.rb b/qpid/cpp/bindings/qmf/tests/ruby_console.rb
new file mode 100755
index 0000000000..31670312d6
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/tests/ruby_console.rb
@@ -0,0 +1,174 @@
+#!/usr/bin/ruby
+
+#
+# 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.
+#
+
+require 'qmf'
+require 'socket'
+
+class App < Qmf::ConsoleHandler
+
+ def agent_added(agent)
+ puts "AgentAdded: label=#{agent.label} key=#{agent.key}"
+ end
+
+ def agent_deleted(agent)
+ puts "AgentDeleted: #{agent.label}"
+ end
+
+ def new_package(package)
+ puts "NewPackage: #{package}"
+ end
+
+ def new_class(class_key)
+ puts "NewClass: #{class_key}"
+ end
+
+ def object_update(object, hasProps, hasStats)
+ puts "ObjectUpdate: #{object.object_class.class_name} props=#{hasProps} stats=#{hasStats}"
+ puts " agent-key=#{object.object_id.agent_key}"
+ puts " package=#{object.object_class.package_name}"
+ end
+
+ def event_received(event); end
+
+ def agent_heartbeat(agent, timestamp)
+ puts "AgentHeartbeat: #{agent.label} time=#{timestamp/1000000000}"
+ end
+
+ def method_response(resp); end
+ def broker_info(broker); end
+
+
+ def dump_schema
+ packages = @qmfc.packages
+ puts "----- Packages -----"
+ packages.each do |p|
+ puts p
+ puts " ----- Object Classes -----"
+ classes = @qmfc.classes(p)
+ classes.each do |c|
+ puts " #{c.name}"
+
+ puts " ---- Properties ----"
+ props = c.properties
+ props.each do |prop|
+ puts " #{prop.name}"
+ end
+
+ puts " ---- Statistics ----"
+ stats = c.statistics
+ stats.each do |stat|
+ puts " #{stat.name}"
+ end
+
+ puts " ---- Methods ----"
+ methods = c.methods
+ methods.each do |method|
+ puts " #{method.name}"
+ puts " ---- Args ----"
+ args = method.arguments
+ args.each do |arg|
+ puts " #{arg.name}"
+ end
+ end
+ end
+
+ puts " ----- Event Classes -----"
+ classes = @qmfc.classes(p, Qmf::CLASS_EVENT)
+ classes.each do |c|
+ puts " #{c.name}"
+ puts " ---- Args ----"
+ args = c.arguments
+ args.each do |arg|
+ puts " #{arg.name}"
+ end
+ end
+ end
+ puts "-----"
+ end
+
+ def main
+ @settings = Qmf::ConnectionSettings.new
+ @settings.host = ARGV[0] if ARGV.size > 0
+ @settings.port = ARGV[1].to_i if ARGV.size > 1
+ @connection = Qmf::Connection.new(@settings)
+ @qmfc = Qmf::Console.new(self)
+
+ @broker = @qmfc.add_connection(@connection)
+ @broker.wait_for_stable
+
+ ##dump_schema
+
+ agents = @qmfc.agents()
+ puts "---- Agents ----"
+ agents.each do |a|
+ puts " => #{a.label}"
+ end
+ puts "----"
+
+ for idx in 0...20
+ blist = @qmfc.objects(Qmf::Query.new(:class => "broker"))
+ puts "---- Brokers ----"
+ blist.each do |b|
+ puts " ---- Broker ----"
+ puts " systemRef: #{b.systemRef}"
+ puts " port : #{b.port}"
+ puts " uptime : #{b.uptime / 1000000000}"
+ puts " properties : #{b.properties}"
+ puts " statistics : #{b.statistics}"
+
+ for rep in 0...1
+ puts " Pinging..."
+ ret = b.echo(45, 'text string')
+ puts " status=#{ret.status} text=#{ret.exception.asString} seq=#{ret.args.sequence} body=#{ret.args.body}"
+ end
+ end
+ puts "----"
+
+ elist = @qmfc.objects(:package => "org.apache.qpid.broker", :class => "exchange", 'durable' => true)
+ puts "---- Durable Exchanges ----"
+ elist.each do |e|
+ puts "Exchange: #{e.name}"
+ end
+ puts "----"
+
+ qlist = @qmfc.objects(Qmf::Query.new(:package => "org.apache.qpid.broker",
+ :class => "queue"))
+ puts "---- Queues ----"
+ qlist.each do |q|
+ puts " ---- Queue ----"
+ puts " name : #{q.name}"
+ end
+ puts "----"
+ sleep(5)
+ end
+
+ sleep(5)
+ puts "Deleting connection..."
+ @qmfc.del_connection(@broker)
+ puts " done"
+ sleep
+ end
+end
+
+app = App.new
+app.main
+
+
diff --git a/qpid/cpp/bindings/qmf/tests/ruby_console_test.rb b/qpid/cpp/bindings/qmf/tests/ruby_console_test.rb
new file mode 100755
index 0000000000..972d5977b8
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/tests/ruby_console_test.rb
@@ -0,0 +1,397 @@
+#!/usr/bin/ruby
+
+#
+# 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.
+#
+
+require 'test_base'
+
+class ConsoleTest < ConsoleTestBase
+
+ def test_A_agent_presence
+ assert(@connection.connected?, "Connection not connected")
+
+ agents = []
+ count = 0
+ while agents.size == 0
+ agents = @qmfc.objects(Qmf::Query.new(:class => "agent"))
+ sleep(1)
+ count += 1
+ fail("Timed out waiting for remote agent") if count > 10
+ end
+
+ agentList = @qmfc.agents
+ assert_equal(agentList.size, 2, "Number of agents reported by Console")
+ end
+
+ def test_A_connection_settings
+ begin
+ @settings.bogusAttribute = 25
+ fail("Connection settings accepted bogus attribute")
+ rescue
+ end
+ end
+
+ def test_B_basic_method_invocation
+ parent = @qmfc.object(:class => "parent")
+ assert(parent, "Number of 'parent' objects")
+ for seq in 0...10
+ result = parent.echo(seq)
+ assert_equal(result.status, 0, "Method Response Status")
+ assert_equal(result.text, "OK", "Method Response Text")
+ assert_equal(result.args.sequence, seq, "Echo Response Sequence")
+ end
+
+ result = parent.set_numerics("bogus")
+ assert_equal(result.status, 1)
+ assert_equal(result.text, "Invalid argument value for test")
+ end
+
+ def test_C_basic_types_numeric_big
+ parent = @qmfc.object(:class =>"parent")
+ assert(parent, "Number of parent objects")
+
+ result = parent.set_numerics("big")
+ assert_equal(result.status, 0, "Method Response Status")
+ assert_equal(result.text, "OK", "Method Response Text")
+
+ parent.update
+
+ assert_equal(parent.uint64val, 0x9494949449494949)
+ assert_equal(parent.uint32val, 0xA5A55A5A)
+ assert_equal(parent.uint16val, 0xB66B)
+ assert_equal(parent.uint8val, 0xC7)
+
+ assert_equal(parent.int64val, 1000000000000000000)
+ assert_equal(parent.int32val, 1000000000)
+ assert_equal(parent.int16val, 10000)
+ assert_equal(parent.int8val, 100)
+ end
+
+ def test_C_basic_types_numeric_small
+ parent = @qmfc.object(:class =>"parent")
+ assert(parent, "Number of parent objects")
+
+ result = parent.set_numerics("small")
+ assert_equal(result.status, 0, "Method Response Status")
+ assert_equal(result.text, "OK", "Method Response Text")
+
+ parent.update
+
+ assert_equal(parent.uint64val, 4)
+ assert_equal(parent.uint32val, 5)
+ assert_equal(parent.uint16val, 6)
+ assert_equal(parent.uint8val, 7)
+
+ assert_equal(parent.int64val, 8)
+ assert_equal(parent.int32val, 9)
+ assert_equal(parent.int16val, 10)
+ assert_equal(parent.int8val, 11)
+ end
+
+ def test_C_basic_types_numeric_negative
+ parent = @qmfc.object(:class =>"parent")
+ assert(parent, "Number of parent objects")
+
+ result = parent.set_numerics("negative")
+ assert_equal(result.status, 0, "Method Response Status")
+ assert_equal(result.text, "OK", "Method Response Text")
+
+ parent.update
+
+ assert_equal(parent.uint64val, 0)
+ assert_equal(parent.uint32val, 0)
+ assert_equal(parent.uint16val, 0)
+ assert_equal(parent.uint8val, 0)
+
+ assert_equal(parent.int64val, -10000000000)
+ assert_equal(parent.int32val, -100000)
+ assert_equal(parent.int16val, -1000)
+ assert_equal(parent.int8val, -100)
+ end
+
+ def test_C_basic_types_string_short
+ parent = @qmfc.object(:class =>"parent")
+ assert(parent, "Number of parent objects")
+
+ strings = []
+ strings << ""
+ strings << "A"
+ strings << "BC"
+ strings << "DEF"
+ strings << "GHIJKLMNOPQRSTUVWXYZ"
+ big = "a"
+ for i in 0...254
+ big << "X"
+ end
+ strings << big
+
+ strings.each do |str|
+ result = parent.set_short_string(str)
+ assert_equal(result.status, 0, "Method Response Status")
+ compare = str
+ compare = compare[0..254] if compare.size > 255
+ assert_equal(result.args.value, compare, "Value returned by method")
+ parent.update
+ assert_equal(parent.sstrval, compare, "Value stored in the object")
+ end
+ end
+
+ def test_C_basic_types_string_long
+ parent = @qmfc.object(:class =>"parent")
+ assert(parent, "Number of parent objects")
+
+ strings = []
+ strings << ""
+ strings << "A"
+ strings << "BC"
+ strings << "DEF"
+ strings << "GHIJKLMNOPQRSTUVWXYZ"
+ big = "a"
+ for i in 0...270
+ big << "X"
+ end
+ strings << big
+
+ strings.each do |str|
+ result = parent.set_long_string(str)
+ assert_equal(result.status, 0, "Method Response Status")
+ assert_equal(result.args.value, str, "Value returned by method")
+ parent.update
+ assert_equal(parent.lstrval, str, "Value stored in the object")
+ end
+ end
+
+ def test_D_userid_for_method
+ parent = @qmfc.object(:class => "parent")
+ assert(parent, "Number of parent objects")
+
+ result = parent.probe_userid
+ assert_equal(result.status, 0, "Method Response Status")
+ assert_equal(result.args.userid, "anonymous")
+ end
+
+ def test_D_get_by_object_id
+ parent = @qmfc.object(:class => "parent")
+ assert(parent, "Number of parent objects")
+
+ list = @qmfc.objects(:object_id => parent.object_id)
+ assert_equal(list.size, 1)
+
+ bad_oid = Qmf::ObjectId.new
+ list = @qmfc.objects(:object_id => bad_oid)
+ assert_equal(list.size, 0)
+
+ # TODO: test a bad_oid that has an agent-bank that is not associated with an attached agent.
+
+ end
+
+ def test_D_get_with_agent
+ agents = @qmfc.agents
+ agents.each do |agent|
+ if agent.label == "agent_test_label"
+ parent = @qmfc.object(:class => "parent", :agent => agent)
+ assert(parent, "Number of parent objects")
+ return
+ end
+ end
+
+ fail("Didn't find a non-broker agent")
+ end
+
+ def test_E_filter_by_object_id
+ mgmt_exchange = @qmfc.object(:class => "exchange", 'name' => "qpid.management")
+ assert(mgmt_exchange, "No Management Exchange")
+
+ bindings = @qmfc.objects(:class => "binding", 'exchangeRef' => mgmt_exchange.object_id)
+ if bindings.size == 0
+ fail("No bindings found on management exchange")
+ end
+
+ bindings.each do |binding|
+ assert_equal(binding.exchangeRef, mgmt_exchange.object_id)
+ end
+ end
+
+
+ def test_F_events
+
+ @event_list.clear
+ @store_events = :true
+
+ parent = @qmfc.object(:class =>"parent")
+ assert(parent, "Number of parent objects")
+
+ parent.set_numerics("big")
+ parent.set_numerics("small")
+ parent.set_numerics("negative")
+ parent.set_short_string("TEST")
+ parent.set_long_string("LONG_TEST")
+ parent.probe_userid()
+
+ @store_events = :false
+
+ assert_equal(@event_list.length, 5)
+
+ assert_equal(@event_list[0].get_attr("uint32val"), 0xA5A55A5A)
+ assert_equal(@event_list[0].get_attr("strval"), "Unused")
+
+ # verify map and list event content.
+ # see agent for structure of listval and mapval
+
+ listval = @event_list[0].listval
+ assert(listval.class == Array)
+ assert_equal(listval.length, 5)
+ assert(listval[4].class == Array)
+ assert_equal(listval[4].length, 4)
+ assert(listval[4][3].class == Hash)
+ assert_equal(listval[4][3]["hi"], 10)
+ assert_equal(listval[4][3]["lo"], 5)
+ assert_equal(listval[4][3]["neg"], -3)
+
+ mapval = @event_list[0].mapval
+ assert(mapval.class == Hash)
+ assert_equal(mapval.length, 7)
+ assert_equal(mapval['aLong'], 9999999999)
+ assert_equal(mapval['aInt'], 54321)
+ assert_equal(mapval['aSigned'], -666)
+ assert_equal(mapval['aString'], "A String")
+ assert_equal(mapval['aFloat'], 3.1415)
+ assert(mapval['aMap'].class == Hash)
+ assert_equal(mapval['aMap'].length, 2)
+ assert_equal(mapval['aMap']['second'], 2)
+ assert(mapval['aList'].class == Array)
+ assert_equal(mapval['aList'].length, 4)
+ assert_equal(mapval['aList'][1], -1)
+
+ assert_equal(@event_list[1]["uint32val"], 5)
+ assert_equal(@event_list[1].get_attr("strval"), "Unused")
+ assert_equal(@event_list[2].get_attr("uint32val"), 0)
+ assert_equal(@event_list[2].get_attr("strval"), "Unused")
+ assert_equal(@event_list[3].get_attr("uint32val"), 0)
+ assert_equal(@event_list[3].get_attr("strval"), "TEST")
+ assert_equal(@event_list[4].get_attr("uint32val"), 0)
+ assert_equal(@event_list[4].get_attr("strval"), "LONG_TEST")
+
+ @event_list.clear
+
+ end
+
+ def test_G_basic_map_list_data
+ parent = @qmfc.object(:class => "parent")
+ assert(parent, "Number of 'parent' objects")
+
+ # see agent for structure of listval
+
+ assert(parent.listval.class == Array)
+ assert_equal(parent.listval.length, 5)
+ assert(parent.listval[4].class == Array)
+ assert_equal(parent.listval[4].length, 4)
+ assert(parent.listval[4][3].class == Hash)
+ assert_equal(parent.listval[4][3]["hi"], 10)
+ assert_equal(parent.listval[4][3]["lo"], 5)
+ assert_equal(parent.listval[4][3]["neg"], -3)
+
+ # see agent for structure of mapval
+
+ assert(parent.mapval.class == Hash)
+ assert_equal(parent.mapval.length, 7)
+ assert_equal(parent.mapval['aLong'], 9999999999)
+ assert_equal(parent.mapval['aInt'], 54321)
+ assert_equal(parent.mapval['aSigned'], -666)
+ assert_equal(parent.mapval['aString'], "A String")
+ assert_equal(parent.mapval['aFloat'], 3.1415)
+ assert(parent.mapval['aMap'].class == Hash)
+ assert_equal(parent.mapval['aMap'].length, 2)
+ assert_equal(parent.mapval['aMap']['second'], 2)
+ assert(parent.mapval['aList'].class == Array)
+ assert_equal(parent.mapval['aList'].length, 4)
+ assert_equal(parent.mapval['aList'][1], -1)
+ end
+
+ def test_H_map_list_method_call
+ parent = @qmfc.object(:class => "parent")
+ assert(parent, "Number of 'parent' objects")
+
+ inMap = {'aLong' => 9999999999,
+ 'aInt' => 54321,
+ 'aSigned' => -666,
+ 'aString' => "A String",
+ 'aFloat' => 3.1415,
+ 'aList' => ['x', -1, 'y', 2],
+ 'abool' => false}
+
+ inList = ['aString', 1, -1, 2.7182, {'aMap'=> -8}, true]
+
+ result = parent.test_map_list(inMap, inList)
+ assert_equal(result.status, 0)
+ assert_equal(result.text, "OK")
+
+ # verify returned values
+ assert_equal(inMap.length, result.args['outMap'].length)
+ result.args['outMap'].each do |k,v|
+ assert_equal(inMap[k], v)
+ end
+
+ assert_equal(inList.length, result.args['outList'].length)
+ for idx in 0...inList.length
+ assert_equal(inList[idx], result.args['outList'][idx])
+ end
+ end
+
+ def test_H_map_list_method_call_big
+ parent = @qmfc.object(:class => "parent")
+ assert(parent, "Number of 'parent' objects")
+
+ big_string = ""
+ segment = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ for idx in 1...1500
+ big_string = big_string + segment
+ end
+
+ inMap = {'aLong' => 9999999999,
+ 'aInt' => 54321,
+ 'aSigned' => -666,
+ 'aString' => big_string,
+ 'another' => big_string,
+ 'aFloat' => 3.1415,
+ 'aList' => ['x', -1, 'y', 2],
+ 'abool' => false}
+
+ inList = ['aString', 1, -1, 2.7182, {'aMap'=> -8}, true]
+
+ result = parent.test_map_list(inMap, inList)
+ assert_equal(result.status, 0)
+ assert_equal(result.text, "OK")
+
+ # verify returned values
+ assert_equal(inMap.length, result.args['outMap'].length)
+ result.args['outMap'].each do |k,v|
+ assert_equal(inMap[k], v)
+ end
+
+ assert_equal(inList.length, result.args['outList'].length)
+ for idx in 0...inList.length
+ assert_equal(inList[idx], result.args['outList'][idx])
+ end
+ end
+
+end
+
+app = ConsoleTest.new
+
diff --git a/qpid/cpp/bindings/qmf/tests/run_interop_tests b/qpid/cpp/bindings/qmf/tests/run_interop_tests
new file mode 100755
index 0000000000..83e7f2593b
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/tests/run_interop_tests
@@ -0,0 +1,135 @@
+#!/bin/sh
+
+#
+# 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.
+#
+
+# Run the qmf interoperability tests.
+MY_DIR=`dirname \`which $0\``
+QPID_DIR=${MY_DIR}/../../../..
+BUILD_DIR=../../..
+PYTHON_DIR=${QPID_DIR}/python
+QMF_DIR=${QPID_DIR}/extras/qmf
+QMF_DIR_PY=${QMF_DIR}/src/py
+BROKER_DIR=${BUILD_DIR}/src
+API_DIR=${BUILD_DIR}/bindings/qmf
+SPEC_DIR=${QPID_DIR}/specs
+
+RUBY_LIB_DIR=${API_DIR}/ruby/.libs
+PYTHON_LIB_DIR=${API_DIR}/python/.libs
+
+trap stop_broker INT TERM QUIT
+
+start_broker() {
+ ${BROKER_DIR}/qpidd --daemon --port 0 --no-data-dir --no-module-dir --auth no > _qpidd.port
+ BROKER_PORT=`cat _qpidd.port`
+}
+
+stop_broker() {
+ ${BROKER_DIR}/qpidd -q --port $BROKER_PORT
+ echo "Broker stopped"
+}
+
+start_ruby_agent() {
+ ruby -I${MY_DIR}/../ruby -I${RUBY_LIB_DIR} ${MY_DIR}/agent_ruby.rb localhost $BROKER_PORT &
+ AGENT_PID=$!
+}
+
+stop_ruby_agent() {
+ kill $AGENT_PID
+}
+
+start_python_agent() {
+ PYTHONPATH="${MY_DIR}/../python:${API_DIR}/python:${PYTHON_LIB_DIR}" python ${MY_DIR}/python_agent.py localhost $BROKER_PORT &
+ PY_AGENT_PID=$!
+}
+
+stop_python_agent() {
+ kill $PY_AGENT_PID
+}
+
+TESTS_FAILED=0
+
+if test -d ${PYTHON_DIR} ; then
+ start_broker
+ echo "Running qmf interop tests using broker on port $BROKER_PORT"
+ PYTHONPATH=${PYTHON_DIR}:${QMF_DIR_PY}:${MY_DIR}
+ export PYTHONPATH
+
+ if test -d ${PYTHON_LIB_DIR} ; then
+ echo " Python Agent (external storage) vs. Pure-Python Console"
+ start_python_agent
+ echo " Python agent started at pid $PY_AGENT_PID"
+ ${PYTHON_DIR}/qpid-python-test -m python_console -b localhost:$BROKER_PORT $@
+ RETCODE=$?
+ stop_python_agent
+ if test x$RETCODE != x0; then
+ echo "FAIL qmf interop tests (Python Agent)";
+ TESTS_FAILED=1
+ fi
+ fi
+
+ if test -d ${RUBY_LIB_DIR} ; then
+ echo " Ruby Agent (external storage) vs. Pure-Python Console"
+ start_ruby_agent
+ echo " Ruby agent started at pid $AGENT_PID"
+ ${PYTHON_DIR}/qpid-python-test -m python_console -b localhost:$BROKER_PORT $@
+ RETCODE=$?
+ if test x$RETCODE != x0; then
+ echo "FAIL qmf interop tests (Ruby Agent)";
+ TESTS_FAILED=1
+ fi
+
+ echo " Ruby Agent (external storage) vs. Ruby Console"
+ ruby -I${MY_DIR} -I${MY_DIR}/../ruby -I${RUBY_LIB_DIR} ${MY_DIR}/ruby_console_test.rb localhost $BROKER_PORT $@
+ RETCODE=$?
+ stop_ruby_agent
+ if test x$RETCODE != x0; then
+ echo "FAIL qmf interop tests (Ruby Console/Ruby Agent)";
+ TESTS_FAILED=1
+ fi
+
+ if test -d ${PYTHON_LIB_DIR} ; then
+ echo " Python Agent (external storage) vs. Ruby Console"
+ start_python_agent
+ ruby -I${MY_DIR} -I${MY_DIR}/../ruby -I${RUBY_LIB_DIR} ${MY_DIR}/ruby_console_test.rb localhost $BROKER_PORT $@
+ RETCODE=$?
+ stop_python_agent
+ if test x$RETCODE != x0; then
+ echo "FAIL qmf interop tests (Ruby Console/Python Agent)";
+ TESTS_FAILED=1
+ fi
+ fi
+ fi
+
+ # Also against the Pure-Python console:
+ # Ruby agent (internal storage)
+ # Python agent (external and internal)
+ # C++ agent (external and internal)
+ #
+ # Other consoles against the same set of agents:
+ # Wrapped Python console
+ # Ruby console
+ # C++ console
+
+ stop_broker
+ if test x$TESTS_FAILED != x0; then
+ echo "TEST FAILED!"
+ exit 1
+ fi
+fi
diff --git a/qpid/cpp/bindings/qmf/tests/test_base.rb b/qpid/cpp/bindings/qmf/tests/test_base.rb
new file mode 100644
index 0000000000..7d4609097c
--- /dev/null
+++ b/qpid/cpp/bindings/qmf/tests/test_base.rb
@@ -0,0 +1,82 @@
+#!/usr/bin/ruby
+
+#
+# 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.
+#
+
+require 'qmf'
+require 'socket'
+
+class ConsoleTestBase < Qmf::ConsoleHandler
+ def initialize
+ sleep(2)
+ @settings = Qmf::ConnectionSettings.new
+ @settings.host = ARGV[0] if ARGV.size > 0
+ @settings.port = ARGV[1].to_i if ARGV.size > 1
+ @connection = Qmf::Connection.new(@settings)
+ @qmfc = Qmf::Console.new(self)
+
+ @broker = @qmfc.add_connection(@connection)
+ @broker.wait_for_stable
+
+ @store_events = :false
+ @event_list = []
+
+ tests = []
+ methods.each do |m|
+ name = m.to_s
+ tests << name if name[0..4] == "test_"
+ end
+
+ failures = 0
+
+ tests.sort.each do |t|
+ begin
+ print "#{t}..."
+ $stdout.flush
+ send(t)
+ puts " Pass"
+ rescue
+ puts " Fail: #{$!}"
+ failures += 1
+ end
+ end
+
+ @qmfc.del_connection(@broker)
+ exit(1) if failures > 0
+ end
+
+ def assert_equal(left, right, in_text=nil)
+ text = " (#{in_text})" if in_text
+ raise "Assertion failed: #{left} != #{right}#{text}" unless left == right
+ end
+
+ def assert(condition, in_text=nil)
+ text = " (#{in_text})" if in_text
+ raise "Assertion failed: #{condition} #{text}" unless condition
+ end
+
+ def fail(text)
+ raise text
+ end
+
+ def event_received(event)
+ @event_list << event if @store_events
+ end
+
+end
diff --git a/qpid/cpp/bindings/qmf2/Makefile.am b/qpid/cpp/bindings/qmf2/Makefile.am
new file mode 100644
index 0000000000..52b1bbd457
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/Makefile.am
@@ -0,0 +1,33 @@
+#
+# 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.
+#
+
+if HAVE_SWIG
+
+EXTRA_DIST = qmf2.i
+SUBDIRS = examples/cpp
+
+if HAVE_RUBY_DEVEL
+SUBDIRS += ruby
+endif
+
+if HAVE_PYTHON_DEVEL
+SUBDIRS += python
+endif
+
+endif
diff --git a/qpid/cpp/bindings/qmf2/examples/cpp/Makefile.am b/qpid/cpp/bindings/qmf2/examples/cpp/Makefile.am
new file mode 100644
index 0000000000..84207d43c4
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/cpp/Makefile.am
@@ -0,0 +1,33 @@
+#
+# 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 = -I$(top_srcdir)/include
+
+AM_CPPFLAGS = $(INCLUDE)
+
+noinst_PROGRAMS=agent list_agents print_events
+
+agent_SOURCES=agent.cpp
+agent_LDADD=$(top_builddir)/src/libqmf2.la
+
+list_agents_SOURCES=list_agents.cpp
+list_agents_LDADD=$(top_builddir)/src/libqmf2.la
+
+print_events_SOURCES=print_events.cpp
+print_events_LDADD=$(top_builddir)/src/libqmf2.la
diff --git a/qpid/cpp/bindings/qmf2/examples/cpp/agent.cpp b/qpid/cpp/bindings/qmf2/examples/cpp/agent.cpp
new file mode 100644
index 0000000000..00554539eb
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/cpp/agent.cpp
@@ -0,0 +1,250 @@
+/*
+ * 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 <qpid/messaging/Connection.h>
+#include <qpid/messaging/Duration.h>
+#include <qmf/AgentSession.h>
+#include <qmf/AgentEvent.h>
+#include <qmf/Schema.h>
+#include <qmf/SchemaProperty.h>
+#include <qmf/SchemaMethod.h>
+#include <qmf/Data.h>
+#include <qmf/DataAddr.h>
+#include <qpid/types/Variant.h>
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace qmf;
+using qpid::types::Variant;
+using qpid::messaging::Duration;
+
+class ExampleAgent {
+public:
+ ExampleAgent(const string& url);
+ ~ExampleAgent();
+
+ void setupSchema();
+ void populateData();
+ void run();
+private:
+ qpid::messaging::Connection connection;
+ AgentSession session;
+ Schema sch_exception;
+ Schema sch_control;
+ Schema sch_child;
+ Schema sch_event;
+ Data control;
+ DataAddr controlAddr;
+
+ bool method(AgentEvent& event);
+};
+
+
+ExampleAgent::ExampleAgent(const string& url)
+{
+ //
+ // Create and open a messaging connection to a broker.
+ //
+ connection = qpid::messaging::Connection(url, "{reconnect:True}");
+ connection.open();
+
+ //
+ // Create, configure, and open a QMFv2 agent session using the connection.
+ //
+ session = AgentSession(connection, "{interval:30}");
+ session.setVendor("profitron.com");
+ session.setProduct("gizmo");
+ session.setAttribute("attr1", 2000);
+ session.open();
+}
+
+ExampleAgent::~ExampleAgent()
+{
+ //
+ // Clean up the QMF session and the AMQP connection.
+ //
+ session.close();
+ connection.close();
+}
+
+void ExampleAgent::setupSchema()
+{
+ //
+ // Create and register schema for this agent.
+ //
+ string package("com.profitron.gizmo");
+
+ //
+ // Declare a schema for a structured exception that can be used in failed
+ // method invocations.
+ //
+ sch_exception = Schema(SCHEMA_TYPE_DATA, package, "exception");
+ sch_exception.addProperty(SchemaProperty("whatHappened", SCHEMA_DATA_STRING));
+ sch_exception.addProperty(SchemaProperty("howBad", SCHEMA_DATA_INT));
+ sch_exception.addProperty(SchemaProperty("details", SCHEMA_DATA_MAP));
+
+ //
+ // Declare a control object to test methods against.
+ //
+ sch_control = Schema(SCHEMA_TYPE_DATA, package, "control");
+ sch_control.addProperty(SchemaProperty("state", SCHEMA_DATA_STRING));
+ sch_control.addProperty(SchemaProperty("methodCount", SCHEMA_DATA_INT));
+
+ SchemaMethod stopMethod("stop", "{desc:'Stop Agent'}");
+ stopMethod.addArgument(SchemaProperty("message", SCHEMA_DATA_STRING));
+ sch_control.addMethod(stopMethod);
+
+ SchemaMethod echoMethod("echo", "{desc:'Echo Arguments'}");
+ echoMethod.addArgument(SchemaProperty("sequence", SCHEMA_DATA_INT, "{dir:INOUT}"));
+ echoMethod.addArgument(SchemaProperty("map", SCHEMA_DATA_MAP, "{dir:INOUT}"));
+ sch_control.addMethod(echoMethod);
+
+ SchemaMethod eventMethod("event", "{desc:'Raise an Event'}");
+ eventMethod.addArgument(SchemaProperty("text", SCHEMA_DATA_STRING, "{dir:IN}"));
+ eventMethod.addArgument(SchemaProperty("severity", SCHEMA_DATA_INT, "{dir:IN}"));
+ sch_control.addMethod(eventMethod);
+
+ SchemaMethod failMethod("fail", "{desc:'Expected to Fail'}");
+ failMethod.addArgument(SchemaProperty("useString", SCHEMA_DATA_BOOL, "{dir:IN}"));
+ failMethod.addArgument(SchemaProperty("stringVal", SCHEMA_DATA_STRING, "{dir:IN}"));
+ failMethod.addArgument(SchemaProperty("details", SCHEMA_DATA_MAP, "{dir:IN}"));
+ sch_control.addMethod(failMethod);
+
+ SchemaMethod createMethod("create_child", "{desc:'Create Child Object'}");
+ createMethod.addArgument(SchemaProperty("name", SCHEMA_DATA_STRING, "{dir:IN}"));
+ createMethod.addArgument(SchemaProperty("childAddr", SCHEMA_DATA_MAP, "{dir:OUT}"));
+ sch_control.addMethod(createMethod);
+
+ //
+ // Declare the child class
+ //
+ sch_child = Schema(SCHEMA_TYPE_DATA, package, "child");
+ sch_child.addProperty(SchemaProperty("name", SCHEMA_DATA_STRING));
+
+ //
+ // Declare the event class
+ //
+ sch_event = Schema(SCHEMA_TYPE_EVENT, package, "event");
+ sch_event.addProperty(SchemaProperty("text", SCHEMA_DATA_STRING));
+
+ //
+ // Register our schemata with the agent session.
+ //
+ session.registerSchema(sch_exception);
+ session.registerSchema(sch_control);
+ session.registerSchema(sch_child);
+ session.registerSchema(sch_event);
+}
+
+void ExampleAgent::populateData()
+{
+ //
+ // Create a control object and give it to the agent session to manage.
+ //
+ control = Data(sch_control);
+ control.setProperty("state", "OPERATIONAL");
+ control.setProperty("methodCount", 0);
+ controlAddr = session.addData(control, "singleton");
+}
+
+void ExampleAgent::run()
+{
+ AgentEvent event;
+ bool running(true);
+
+ while (running) {
+ bool valid(session.nextEvent(event, Duration::SECOND));
+ if (valid && running) {
+ switch (event.getType()) {
+ case AGENT_METHOD:
+ running = method(event);
+ break;
+ }
+ }
+ }
+}
+
+bool ExampleAgent::method(AgentEvent& event)
+{
+ const string& name(event.getMethodName());
+ control.setProperty("methodCount", control.getProperty("methodCount").asUint32() + 1);
+
+ try {
+ if (controlAddr == event.getDataAddr()) {
+ if (name == "stop") {
+ cout << "Stopping: message=" << event.getArguments()["message"] << endl;
+ session.methodSuccess(event);
+ return false;
+ }
+
+ if (name == "echo") {
+ event.addReturnArgument("sequence", event.getArguments()["sequence"]);
+ event.addReturnArgument("map", event.getArguments()["map"]);
+ session.methodSuccess(event);
+ return true;
+ }
+
+ if (name == "event") {
+ Data ev(sch_event);
+ ev.setProperty("text", event.getArguments()["text"]);
+ session.raiseEvent(ev, event.getArguments()["severity"]);
+ session.methodSuccess(event);
+ return true;
+ }
+
+ if (name == "fail") {
+ if (event.getArguments()["useString"])
+ session.raiseException(event, event.getArguments()["stringVal"]);
+ else {
+ Data ex(sch_exception);
+ ex.setProperty("whatHappened", "It Failed");
+ ex.setProperty("howBad", 75);
+ ex.setProperty("details", event.getArguments()["details"]);
+ session.raiseException(event, ex);
+ }
+ }
+
+ if (name == "create_child") {
+ const string& name(event.getArguments()["name"]);
+ Data child(sch_child);
+ child.setProperty("name", name);
+ DataAddr addr(session.addData(child, name));
+ event.addReturnArgument("childAddr", addr.asMap());
+ session.methodSuccess(event);
+ }
+ }
+ } catch (const exception& e) {
+ //
+ // Pass the exception on to the caller.
+ //
+ session.raiseException(event, e.what());
+ }
+
+ return true;
+}
+
+int main()
+{
+ ExampleAgent agent("localhost");
+ agent.setupSchema();
+ agent.populateData();
+ agent.run();
+}
+
diff --git a/qpid/cpp/bindings/qmf2/examples/cpp/list_agents.cpp b/qpid/cpp/bindings/qmf2/examples/cpp/list_agents.cpp
new file mode 100644
index 0000000000..327da9661f
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/cpp/list_agents.cpp
@@ -0,0 +1,73 @@
+/*
+ * 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 <qpid/messaging/Connection.h>
+#include <qpid/messaging/Duration.h>
+#include <qmf/ConsoleSession.h>
+#include <qmf/ConsoleEvent.h>
+#include <qmf/Agent.h>
+#include <qpid/types/Variant.h>
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace qmf;
+using qpid::types::Variant;
+using qpid::messaging::Duration;
+
+int main(int argc, char** argv)
+{
+ string url("localhost");
+ string connectionOptions;
+ string sessionOptions;
+
+ if (argc > 1)
+ url = argv[1];
+ if (argc > 2)
+ connectionOptions = argv[2];
+ if (argc > 3)
+ sessionOptions = argv[3];
+
+ qpid::messaging::Connection connection(url, connectionOptions);
+ connection.open();
+
+ ConsoleSession session(connection, sessionOptions);
+ session.open();
+
+ session.setAgentFilter("");
+
+ while (true) {
+ ConsoleEvent event;
+ if (session.nextEvent(event)) {
+ if (event.getType() == CONSOLE_AGENT_ADD) {
+ string extra;
+ if (event.getAgent().getName() == session.getConnectedBrokerAgent().getName())
+ extra = " [Connected Broker]";
+ cout << "Agent Added: " << event.getAgent().getName() << extra << endl;
+ }
+ if (event.getType() == CONSOLE_AGENT_DEL) {
+ if (event.getAgentDelReason() == AGENT_DEL_AGED)
+ cout << "Agent Aged: " << event.getAgent().getName() << endl;
+ else
+ cout << "Agent Filtered: " << event.getAgent().getName() << endl;
+ }
+ }
+ }
+}
+
diff --git a/qpid/cpp/bindings/qmf2/examples/cpp/print_events.cpp b/qpid/cpp/bindings/qmf2/examples/cpp/print_events.cpp
new file mode 100644
index 0000000000..9883a19962
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/cpp/print_events.cpp
@@ -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.
+ */
+
+#include <qpid/messaging/Connection.h>
+#include <qpid/messaging/Duration.h>
+#include <qmf/ConsoleSession.h>
+#include <qmf/ConsoleEvent.h>
+#include <qmf/Data.h>
+#include <qpid/types/Variant.h>
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace qmf;
+using qpid::types::Variant;
+using qpid::messaging::Duration;
+
+int main(int argc, char** argv)
+{
+ string url("localhost");
+ string connectionOptions;
+ string sessionOptions;
+
+ if (argc > 1)
+ url = argv[1];
+ if (argc > 2)
+ connectionOptions = argv[2];
+ if (argc > 3)
+ sessionOptions = argv[3];
+
+ qpid::messaging::Connection connection(url, connectionOptions);
+ connection.open();
+
+ ConsoleSession session(connection, sessionOptions);
+ session.open();
+
+ while (true) {
+ ConsoleEvent event;
+ if (session.nextEvent(event)) {
+ if (event.getType() == CONSOLE_EVENT) {
+ const Data& data(event.getData(0));
+ cout << "Event: timestamp=" << event.getTimestamp() << " severity=" <<
+ event.getSeverity() << " content=" << data.getProperties() << endl;
+ }
+ }
+ }
+}
+
diff --git a/qpid/cpp/bindings/qmf2/examples/python/agent.py b/qpid/cpp/bindings/qmf2/examples/python/agent.py
new file mode 100755
index 0000000000..b24890f531
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/python/agent.py
@@ -0,0 +1,196 @@
+#!/usr/bin/env python
+
+#
+# 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.
+#
+
+import cqpid
+from qmf2 import *
+
+
+class ExampleAgent(AgentHandler):
+ """
+ This example agent is implemented as a single class that inherits AgentHandler.
+ It does not use a separate thread since once set up, it is driven strictly by
+ incoming method calls.
+ """
+
+ def __init__(self, url):
+ ##
+ ## Create and open a messaging connection to a broker.
+ ##
+ self.connection = cqpid.Connection(url, "{reconnect:True}")
+ self.session = None
+ self.connection.open()
+
+ ##
+ ## Create, configure, and open a QMFv2 agent session using the connection.
+ ##
+ self.session = AgentSession(self.connection, "{interval:30}")
+ self.session.setVendor('profitron.com')
+ self.session.setProduct('blastinator')
+ self.session.setAttribute('attr1', 1000)
+ self.session.open()
+
+ ##
+ ## Initialize the parent class.
+ ##
+ AgentHandler.__init__(self, self.session)
+
+
+ def shutdown(self):
+ """
+ Clean up the session and connection.
+ """
+ if self.session:
+ self.session.close()
+ self.connection.close()
+
+
+ def method(self, handle, methodName, args, subtypes, addr, userId):
+ """
+ Handle incoming method calls.
+ """
+ if addr == self.controlAddr:
+ self.control.methodCount += 1
+
+ try:
+ if methodName == "stop":
+ self.session.methodSuccess(handle)
+ self.cancel()
+
+ elif methodName == "echo":
+ handle.addReturnArgument("sequence", args["sequence"])
+ handle.addReturnArgument("map", args["map"])
+ self.session.methodSuccess(handle)
+
+ elif methodName == "event":
+ ev = Data(self.sch_event)
+ ev.text = args['text']
+ self.session.raiseEvent(ev, args['severity'])
+ self.session.methodSuccess(handle)
+
+ elif methodName == "fail":
+ if args['useString']:
+ self.session.raiseException(handle, args['stringVal'])
+ else:
+ ex = Data(self.sch_exception)
+ ex.whatHappened = "It Failed"
+ ex.howBad = 75
+ ex.details = args['details']
+ self.session.raiseException(handle, ex)
+
+ elif methodName == "create_child":
+ name = args['name']
+ child = Data(self.sch_child)
+ child.name = name
+ addr = self.session.addData(child, name)
+ handle.addReturnArgument("childAddr", addr.asMap())
+ self.session.methodSuccess(handle)
+ except BaseException, e:
+ self.session.raiseException(handle, "%r" % e)
+
+
+ def setupSchema(self):
+ """
+ Create and register the schema for this agent.
+ """
+ package = "com.profitron.bntor"
+
+ ##
+ ## Declare a schema for a structured exception that can be used in failed
+ ## method invocations.
+ ##
+ self.sch_exception = Schema(SCHEMA_TYPE_DATA, package, "exception")
+ self.sch_exception.addProperty(SchemaProperty("whatHappened", SCHEMA_DATA_STRING))
+ self.sch_exception.addProperty(SchemaProperty("howBad", SCHEMA_DATA_INT))
+ self.sch_exception.addProperty(SchemaProperty("details", SCHEMA_DATA_MAP))
+
+ ##
+ ## Declare a control object to test methods against.
+ ##
+ self.sch_control = Schema(SCHEMA_TYPE_DATA, package, "control")
+ self.sch_control.addProperty(SchemaProperty("state", SCHEMA_DATA_STRING))
+ self.sch_control.addProperty(SchemaProperty("methodCount", SCHEMA_DATA_INT))
+
+ stopMethod = SchemaMethod("stop", desc="Stop Agent")
+ stopMethod.addArgument(SchemaProperty("message", SCHEMA_DATA_STRING, direction=DIR_IN))
+ self.sch_control.addMethod(stopMethod)
+
+ echoMethod = SchemaMethod("echo", desc="Echo Arguments")
+ echoMethod.addArgument(SchemaProperty("sequence", SCHEMA_DATA_INT, direction=DIR_IN_OUT))
+ echoMethod.addArgument(SchemaProperty("map", SCHEMA_DATA_MAP, direction=DIR_IN_OUT))
+ self.sch_control.addMethod(echoMethod)
+
+ eventMethod = SchemaMethod("event", desc="Raise an Event")
+ eventMethod.addArgument(SchemaProperty("text", SCHEMA_DATA_STRING, direction=DIR_IN))
+ eventMethod.addArgument(SchemaProperty("severity", SCHEMA_DATA_INT, direction=DIR_IN))
+ self.sch_control.addMethod(eventMethod)
+
+ failMethod = SchemaMethod("fail", desc="Expected to Fail")
+ failMethod.addArgument(SchemaProperty("useString", SCHEMA_DATA_BOOL, direction=DIR_IN))
+ failMethod.addArgument(SchemaProperty("stringVal", SCHEMA_DATA_STRING, direction=DIR_IN))
+ failMethod.addArgument(SchemaProperty("details", SCHEMA_DATA_MAP, direction=DIR_IN))
+ self.sch_control.addMethod(failMethod)
+
+ createMethod = SchemaMethod("create_child", desc="Create Child Object")
+ createMethod.addArgument(SchemaProperty("name", SCHEMA_DATA_STRING, direction=DIR_IN))
+ createMethod.addArgument(SchemaProperty("childAddr", SCHEMA_DATA_MAP, direction=DIR_OUT))
+ self.sch_control.addMethod(createMethod)
+
+ ##
+ ## Declare a child object
+ ##
+ self.sch_child = Schema(SCHEMA_TYPE_DATA, package, "child")
+ self.sch_child.addProperty(SchemaProperty("name", SCHEMA_DATA_STRING))
+
+ ##
+ ## Declare the event class
+ ##
+ self.sch_event = Schema(SCHEMA_TYPE_EVENT, package, "event")
+ self.sch_event.addProperty(SchemaProperty("text", SCHEMA_DATA_STRING))
+
+ ##
+ ## Register our schemata with the agent session.
+ ##
+ self.session.registerSchema(self.sch_exception)
+ self.session.registerSchema(self.sch_control)
+ self.session.registerSchema(self.sch_child)
+ self.session.registerSchema(self.sch_event)
+
+
+ def populateData(self):
+ """
+ Create a control object and give it to the agent session to manage.
+ """
+ self.control = Data(self.sch_control)
+ self.control.state = "OPERATIONAL"
+ self.control.methodCount = 0
+ self.controlAddr = self.session.addData(self.control, "singleton")
+
+
+try:
+ agent = ExampleAgent("localhost")
+ agent.setupSchema()
+ agent.populateData()
+ agent.run() # Use agent.start() to launch the agent in a separate thread
+ agent.shutdown()
+except Exception, e:
+ print "Exception Caught:", e
+
+
diff --git a/qpid/cpp/bindings/qmf2/examples/python/find_agents.py b/qpid/cpp/bindings/qmf2/examples/python/find_agents.py
new file mode 100644
index 0000000000..5fd71b3f1c
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/python/find_agents.py
@@ -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.
+#
+
+import cqpid
+import qmf2
+
+class FindAgents(qmf2.ConsoleHandler):
+
+ def __init__(self, session):
+ qmf2.ConsoleHandler.__init__(self, session)
+
+ def agentAdded(self, agent):
+ print "Agent Added: %r" % agent
+
+ def agentDeleted(self, agent, reason):
+ print "Agent Deleted: %r reason: %s" % (agent, reason)
+
+ def agentRestarted(self, agent):
+ print "Agent Restarted: %r" % agent
+
+ def agentSchemaUpdated(self, agent):
+ print "Agent Schema Updated: %r" % agent
+
+ def eventRaised(self, agent, data, timestamp, severity):
+ print "Event: data=%r time=%d sev=%d" % (data.getProperties(), timestamp, severity)
+
+
+
+url = "localhost"
+options = ""
+
+connection = cqpid.Connection(url, options)
+connection.open()
+
+session = qmf2.ConsoleSession(connection)
+session.open()
+session.setAgentFilter("[]")
+
+main = FindAgents(session)
+main.run()
+
diff --git a/qpid/cpp/bindings/qmf2/examples/ruby/agent_external.rb b/qpid/cpp/bindings/qmf2/examples/ruby/agent_external.rb
new file mode 100644
index 0000000000..75171931ed
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/ruby/agent_external.rb
@@ -0,0 +1,84 @@
+#
+# 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.
+#
+
+require 'cqpid'
+require 'qmf2'
+
+class MyAgent < Qmf2::AgentHandler
+
+ def initialize(session, data)
+ super(session)
+ @data = data
+ end
+
+ def authorize_query(query, user_id)
+ puts "Authorizing #{user_id}"
+ return true
+ end
+
+ def get_query(context, query, user_id)
+ puts "Get Query"
+ context.response(@data)
+ context.complete
+ end
+
+ def method_call(context, method_name, data_addr, args, user_id)
+ puts "Method: #{method_name}"
+ context._success
+ end
+
+end
+
+
+class Program
+
+ def initialize(url)
+ @url = url
+ @sess_options = "{allow-queries:False, external:True}"
+ end
+
+ def setup_schema(agent)
+ @cls_control = Qmf2::Schema.new(Qmf2::SCHEMA_TYPE_DATA, "org.package", "control")
+ @cls_control.add_property(Qmf2::SchemaProperty.new("state", Qmf2::SCHEMA_DATA_STRING))
+ agent.register_schema(@cls_control)
+ end
+
+ def run
+ connection = Cqpid::Connection.new(@url)
+ connection.open
+
+ session = Qmf2::AgentSession.new(connection, @sess_options)
+ session.set_vendor("package.org")
+ session.set_product("external_agent")
+ setup_schema(session)
+ session.open
+
+ @control = Qmf2::Data.new(@cls_control)
+ @control.state = "OPERATIONAL-EXTERNAL"
+ @control.set_addr(Qmf2::DataAddr.new("singleton"))
+
+ main = MyAgent.new(session, @control)
+ main.run
+ end
+end
+
+prog = Program.new("localhost")
+prog.run
+
+
diff --git a/qpid/cpp/bindings/qmf2/examples/ruby/agent_internal.rb b/qpid/cpp/bindings/qmf2/examples/ruby/agent_internal.rb
new file mode 100644
index 0000000000..fc49a885f7
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/ruby/agent_internal.rb
@@ -0,0 +1,77 @@
+#
+# 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.
+#
+
+require 'cqpid'
+require 'qmf2'
+
+class MyAgent < Qmf2::AgentHandler
+
+ def initialize(session)
+ super(session)
+ end
+
+ def authorize_query(query, user_id)
+ puts "Authorizing #{user_id}"
+ return true
+ end
+
+ def method_call(context, method_name, data_addr, args, user_id)
+ puts "Method: #{method_name}"
+ context._success
+ end
+
+end
+
+
+class Program
+
+ def initialize(url)
+ @url = url
+ @sess_options = "{allow-queries:False}"
+ end
+
+ def setup_schema(agent)
+ @cls_control = Qmf2::Schema.new(Qmf2::SCHEMA_TYPE_DATA, "org.package", "control")
+ @cls_control.add_property(Qmf2::SchemaProperty.new("state", Qmf2::SCHEMA_DATA_STRING))
+ agent.register_schema(@cls_control)
+ end
+
+ def run
+ connection = Cqpid::Connection.new(@url)
+ connection.open
+
+ session = Qmf2::AgentSession.new(connection, @sess_options)
+ session.set_vendor("package.org")
+ session.set_product("internal_agent")
+ setup_schema(session)
+ session.open
+
+ control = Qmf2::Data.new(@cls_control)
+ control.state = "OPERATIONAL"
+ session.add_data(control)
+
+ main = MyAgent.new(session)
+ main.run
+ end
+end
+
+prog = Program.new("localhost")
+prog.run
+
+
diff --git a/qpid/cpp/bindings/qmf2/examples/ruby/find_agents.rb b/qpid/cpp/bindings/qmf2/examples/ruby/find_agents.rb
new file mode 100644
index 0000000000..41de7e5abe
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/examples/ruby/find_agents.rb
@@ -0,0 +1,63 @@
+#
+# 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.
+#
+
+require 'cqpid'
+require 'qmf2'
+
+class FindAgents < Qmf2::ConsoleHandler
+
+ def initialize(session)
+ super(session)
+ end
+
+ def agent_added(agent)
+ puts "Agent Added: #{agent.name}"
+ end
+
+ def agent_deleted(agent, reason)
+ puts "Agent Deleted: #{agent.to_s} reason: #{reason}"
+ end
+
+ def agent_restarted(agent)
+ puts "Agent Restarted: #{agent.to_s} epoch: #{agent.epoch}"
+ end
+
+ def agent_schema_updated(agent)
+ puts "Agent with new Schemata: #{agent.to_s}"
+ end
+
+ def event_raised(agent, data, timestamp, severity)
+ puts "Event Raised time=#{timestamp} sev=#{severity} data=#{data.properties}"
+ end
+end
+
+
+url = "localhost"
+options = ""
+
+connection = Cqpid::Connection.new(url, options)
+connection.open
+
+session = Qmf2::ConsoleSession.new(connection)
+session.open
+session.set_agent_filter("[]")
+
+main = FindAgents.new(session)
+main.run
+
diff --git a/qpid/cpp/bindings/qmf2/python/Makefile.am b/qpid/cpp/bindings/qmf2/python/Makefile.am
new file mode 100644
index 0000000000..3dc04e832f
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/python/Makefile.am
@@ -0,0 +1,49 @@
+#
+# 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.
+#
+
+if HAVE_PYTHON_DEVEL
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src -I$(top_builddir)/src $(QMF_INCLUDES)
+
+generated_file_list = \
+ cqmf2.cpp \
+ cqmf2.py
+
+EXTRA_DIST = python.i
+BUILT_SOURCES = $(generated_file_list)
+SWIG_FLAGS = -w362,401
+
+$(generated_file_list): $(srcdir)/python.i $(srcdir)/../qmf2.i $(srcdir)/../../swig_python_typemaps.i
+ $(SWIG) -c++ -python $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I/usr/include -o cqmf2.cpp $(srcdir)/python.i
+
+pylibdir = $(PYTHON_LIB)
+
+lib_LTLIBRARIES = _cqmf2.la
+cqpiddir = $(pyexecdir)
+cqpid_PYTHON = qmf2.py cqmf2.py
+
+_cqmf2_la_LDFLAGS = -avoid-version -module -shared
+_cqmf2_la_LIBADD = $(PYTHON_LIBS) -L$(top_builddir)/src/.libs $(top_builddir)/src/libqmf2.la
+_cqmf2_la_CXXFLAGS = $(INCLUDES) -I$(srcdir)/qmf -I$(PYTHON_INC) -fno-strict-aliasing
+nodist__cqmf2_la_SOURCES = cqmf2.cpp
+
+CLEANFILES = $(generated_file_list)
+
+endif # HAVE_PYTHON_DEVEL
+
diff --git a/qpid/cpp/bindings/qmf2/python/python.i b/qpid/cpp/bindings/qmf2/python/python.i
new file mode 100644
index 0000000000..02dd1632b0
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/python/python.i
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+%module cqmf2
+%include "std_string.i"
+%include "../../swig_python_typemaps.i"
+
+/* Define the general-purpose exception handling */
+%exception {
+ std::string error;
+ Py_BEGIN_ALLOW_THREADS;
+ try {
+ $action
+ } catch (qpid::types::Exception& ex) {
+ error = ex.what();
+ }
+ Py_END_ALLOW_THREADS;
+ if (!error.empty()) {
+ PyErr_SetString(PyExc_RuntimeError, error.c_str());
+ return NULL;
+ }
+}
+
+%include "../qmf2.i"
+
diff --git a/qpid/cpp/bindings/qmf2/python/qmf2.py b/qpid/cpp/bindings/qmf2/python/qmf2.py
new file mode 100644
index 0000000000..9f2d8556f4
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/python/qmf2.py
@@ -0,0 +1,933 @@
+#
+# 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.
+#
+
+import cqmf2
+import cqpid
+from threading import Thread
+import time
+
+#===================================================================================================
+# CONSTANTS
+#===================================================================================================
+SCHEMA_TYPE_DATA = cqmf2.SCHEMA_TYPE_DATA
+SCHEMA_TYPE_EVENT = cqmf2.SCHEMA_TYPE_EVENT
+
+SCHEMA_DATA_VOID = cqmf2.SCHEMA_DATA_VOID
+SCHEMA_DATA_BOOL = cqmf2.SCHEMA_DATA_BOOL
+SCHEMA_DATA_INT = cqmf2.SCHEMA_DATA_INT
+SCHEMA_DATA_FLOAT = cqmf2.SCHEMA_DATA_FLOAT
+SCHEMA_DATA_STRING = cqmf2.SCHEMA_DATA_STRING
+SCHEMA_DATA_MAP = cqmf2.SCHEMA_DATA_MAP
+SCHEMA_DATA_LIST = cqmf2.SCHEMA_DATA_LIST
+SCHEMA_DATA_UUID = cqmf2.SCHEMA_DATA_UUID
+
+ACCESS_READ_CREATE = cqmf2.ACCESS_READ_CREATE
+ACCESS_READ_WRITE = cqmf2.ACCESS_READ_WRITE
+ACCESS_READ_ONLY = cqmf2.ACCESS_READ_ONLY
+
+DIR_IN = cqmf2.DIR_IN
+DIR_OUT = cqmf2.DIR_OUT
+DIR_IN_OUT = cqmf2.DIR_IN_OUT
+
+SEV_EMERG = cqmf2.SEV_EMERG
+SEV_ALERT = cqmf2.SEV_ALERT
+SEV_CRIT = cqmf2.SEV_CRIT
+SEV_ERROR = cqmf2.SEV_ERROR
+SEV_WARN = cqmf2.SEV_WARN
+SEV_NOTICE = cqmf2.SEV_NOTICE
+SEV_INFORM = cqmf2.SEV_INFORM
+SEV_DEBUG = cqmf2.SEV_DEBUG
+
+QUERY_OBJECT = cqmf2.QUERY_OBJECT
+QUERY_OBJECT_ID = cqmf2.QUERY_OBJECT_ID
+QUERY_SCHEMA = cqmf2.QUERY_SCHEMA
+QUERY_SCHEMA_ID = cqmf2.QUERY_SCHEMA_ID
+
+
+#===================================================================================================
+# EXCEPTIONS
+#===================================================================================================
+class QmfAgentException(Exception):
+ """
+ This exception class represents an exception that was raised by a remote agent and propagated
+ to a console via QMFv2.
+ """
+ def __init__(self, data):
+ self.value = data
+
+ def __str__(self):
+ return "From Remote Agent: %r" % self.value.getProperties()
+
+
+#===================================================================================================
+# AGENT HANDLER
+#===================================================================================================
+class AgentHandler(Thread):
+ """
+ Agent applications can create a subclass of AgentHandler to handle asynchronous events (like
+ incoming method calls) that occur on the agent session. AgentHandler contains a thread on which
+ the handler callbacks are invoked.
+
+ There are two ways to operate the handler: Cause it to start its own thread by calling
+ start() and later stop it by calling cancel(); and directly calling run() to operate it on the
+ main thread.
+
+ Example Usage:
+
+ class MyAgentHandler(qmf2.AgentHandler):
+ def __init__(self, agentSession):
+ qmf2.AgentHandler.__init__(self, agentSession)
+ def method(self, handle, methodName, args, subtypes, addr, userId):
+ ...method handling code goes here...
+ For success, add output arguments:
+ handle.addReturnArgument("argname", argvalue)
+ ...
+ self.agent.methodSuccess(handle)
+ For failure, raise an exception:
+ self.agent.raiseException(handle, "error text")
+ Or, if you have created a schema for a structured exception:
+ ex = qmf2.Data(exceptionSchema)
+ ex.whatHappened = "it failed"
+ ex.howBad = 84
+ ex.detailMap = {}
+ ...
+ self.agent.raiseException(handle, ex)
+ """
+
+ def __init__(self, agentSession):
+ Thread.__init__(self)
+ self.__agent = agentSession
+ self.__running = True
+
+ def cancel(self):
+ """
+ Stop the handler thread.
+ """
+ self.__running = None
+
+ def run(self):
+ event = cqmf2.AgentEvent()
+ while self.__running:
+ valid = self.__agent._impl.nextEvent(event, cqpid.Duration.SECOND)
+ if valid and self.__running:
+ if event.getType() == cqmf2.AGENT_METHOD:
+ self.method(event, event.getMethodName(), event.getArguments(), event.getArgumentSubtypes(),
+ DataAddr(event.getDataAddr()), event.getUserId())
+
+ def method(self, handle, methodName, args, subtypes, addr, userId):
+ """
+ Override this method to create your own method handler.
+ """
+ pass
+
+
+#===================================================================================================
+# CONSOLE HANDLER
+#===================================================================================================
+class ConsoleHandler(Thread):
+
+ def __init__(self, consoleSession):
+ Thread.__init__(self)
+ self.__session = consoleSession
+ self.__running = True
+
+ def cancel(self):
+ """
+ Stop the handler thread.
+ """
+ self.__running = None
+
+ def run(self):
+ event = cqmf2.ConsoleEvent()
+ while self.__running:
+ valid = self.__session._impl.nextEvent(event, cqpid.Duration.SECOND)
+ if valid and self.__running:
+ if event.getType() == cqmf2.CONSOLE_AGENT_ADD:
+ self.agentAdded(Agent(event.getAgent()))
+
+ elif event.getType() == cqmf2.CONSOLE_AGENT_DEL:
+ reason = 'filter'
+ if event.getAgentDelReason() == cqmf2.AGENT_DEL_AGED:
+ reason = 'aged'
+ self.agentDeleted(Agent(event.getAgent()), reason)
+
+ elif event.getType() == cqmf2.CONSOLE_AGENT_RESTART:
+ self.agentRestarted(Agent(event.getAgent()))
+
+ elif event.getType() == cqmf2.CONSOLE_AGENT_SCHEMA_UPDATE:
+ self.agentSchemaUpdated(Agent(event.getAgent()))
+
+ elif event.getType() == cqmf2.CONSOLE_EVENT:
+ self.eventRaised(Agent(event.getAgent()), Data(event.getData(0)), event.getTimestamp(), event.getSeverity())
+
+ ##
+ ## The following methods are intended to be overridden in a sub-class. They are
+ ## handlers for events that occur on QMF consoles.
+ ##
+
+ #
+ # A new agent, whose attributes match the console's agent filter, has been discovered.
+ #
+ def agentAdded(self, agent):
+ pass
+
+ #
+ # A known agent has been removed from the agent list. There are two possible reasons
+ # for agent deletion:
+ #
+ # 1) 'aged' - The agent hasn't been heard from for the maximum age interval and is
+ # presumed dead.
+ # 2) 'filter' - The agent no longer matches the console's agent-filter and has been
+ # effectively removed from the agent list. Such occurrences are likely
+ # to be seen immediately after setting the filter to a new value.
+ #
+ def agentDeleted(self, agent, reason):
+ pass
+
+ #
+ # An agent-restart was detected. This occurs when the epoch number advertised by the
+ # agent changes. It indicates that the agent in question was shut-down/crashed and
+ # restarted.
+ #
+ def agentRestarted(self, agent):
+ pass
+
+ #
+ # The agent has registered new schema information which can now be queried, if desired.
+ #
+ def agentSchemaUpdated(self, agent):
+ pass
+
+ #
+ # An agent raised an event. The 'data' argument is a Data object that contains the
+ # content of the event.
+ #
+ def eventRaised(self, agent, data, timestamp, severity):
+ pass
+
+
+#===================================================================================================
+# CONSOLE SESSION
+#===================================================================================================
+class ConsoleSession(object):
+ """
+ """
+
+ def __init__(self, connection, options=""):
+ """
+ ## The options string is of the form "{key:value,key:value}". The following keys are supported:
+ ##
+ ## domain:NAME - QMF Domain to join [default: "default"]
+ ## max-agent-age:N - Maximum time, in minutes, that we will tolerate not hearing from
+ ## an agent before deleting it [default: 5]
+ ## listen-on-direct:{True,False} - If True: Listen on legacy direct-exchange address for backward compatibility [default]
+ ## If False: Listen only on the routable direct address
+ ## strict-security:{True,False} - If True: Cooperate with the broker to enforce strict access control to the network
+ ## - If False: Operate more flexibly with regard to use of messaging facilities [default]
+ ##
+ """
+ self._impl = cqmf2.ConsoleSession(connection, options)
+
+ def setDomain(self, domain):
+ """
+ """
+ self._impl.setDomain(domain)
+
+ def setAgentFilter(self, filt):
+ """
+ """
+ self._impl.setAgentFilter(filt)
+
+ def open(self):
+ """
+ """
+ self._impl.open()
+
+ def close(self):
+ """
+ """
+ self._impl.close()
+
+ def getAgents(self):
+ """
+ """
+ result = []
+ count = self._impl.getAgentCount()
+ for i in range(count):
+ result.append(Agent(self._impl.getAgent(i)))
+ return result
+
+ def getConnectedBrokerAgent(self):
+ """
+ """
+ return Agent(self._impl.getConnectedBrokerAgent())
+
+ ## TODO: Async methods
+
+#===================================================================================================
+# AGENT SESSION
+#===================================================================================================
+class AgentSession(object):
+ """
+ """
+
+ def __init__(self, connection, options=""):
+ """
+ ## The options string is of the form "{key:value,key:value}". The following keys are supported:
+ ##
+ ## interval:N - Heartbeat interval in seconds [default: 60]
+ ## external:{True,False} - Use external data storage (queries and subscriptions are pass-through) [default: False]
+ ## allow-queries:{True,False} - If True: automatically allow all queries [default]
+ ## If False: generate an AUTH_QUERY event to allow per-query authorization
+ ## allow-methods:{True,False} - If True: automatically allow all methods [default]
+ ## If False: generate an AUTH_METHOD event to allow per-method authorization
+ ## max-subscriptions:N - Maximum number of concurrent subscription queries permitted [default: 64]
+ ## min-sub-interval:N - Minimum publish interval (in milliseconds) permitted for a subscription [default: 3000]
+ ## sub-lifetime:N - Lifetime (in seconds with no keepalive) for a subscription [default: 300]
+ ## public-events:{True,False} - If True: QMF events are sent to the topic exchange [default]
+ ## If False: QMF events are only sent to authorized subscribers
+ ## listen-on-direct:{True,False} - If True: Listen on legacy direct-exchange address for backward compatibility [default]
+ ## If False: Listen only on the routable direct address
+ ## strict-security:{True,False} - If True: Cooperate with the broker to enforce strict access control to the network
+ ## - If False: Operate more flexibly with regard to use of messaging facilities [default]
+ ##
+ """
+ self._impl = cqmf2.AgentSession(connection, options)
+
+ def setDomain(self, domain):
+ """
+ """
+ self._impl.setDomain(domain)
+
+ def setVendor(self, val):
+ """
+ """
+ self._impl.setVendor(val)
+
+ def setProduct(self, val):
+ """
+ """
+ self._impl.setProduct(val)
+
+ def setInstance(self, val):
+ """
+ """
+ self._impl.setInstance(val)
+
+ def setAttribute(self, key, val):
+ """
+ """
+ self._impl.setAttribute(key, val)
+
+ def open(self):
+ """
+ """
+ self._impl.open()
+
+ def close(self):
+ """
+ """
+ self._impl.close()
+
+ def registerSchema(self, schema):
+ """
+ """
+ self._impl.registerSchema(schema._impl)
+
+ def addData(self, data, name="", persistent=False):
+ """
+ """
+ return DataAddr(self._impl.addData(data._impl, name, persistent))
+
+ def delData(self, addr):
+ """
+ """
+ self._impl.delData(addr._impl)
+
+ def methodSuccess(self, handle):
+ """
+ """
+ self._impl.methodSuccess(handle)
+
+ def raiseException(self, handle, data):
+ """
+ """
+ if data.__class__ == Data:
+ self._impl.raiseException(handle, data._impl)
+ else:
+ self._impl.raiseException(handle, data)
+
+ def raiseEvent(self, data, severity=None):
+ """
+ """
+ if not severity:
+ self._impl.raiseEvent(data._impl)
+ else:
+ if (severity.__class__ != int and severity.__class__ != long) or severity < 0 or severity > 7:
+ raise Exception("Severity must be an int between 0..7")
+ self._impl.raiseEvent(data._impl, severity);
+
+
+#===================================================================================================
+# AGENT PROXY
+#===================================================================================================
+class Agent(object):
+ """
+ """
+
+ def __init__(self, impl):
+ self._impl = impl
+
+ def __repr__(self):
+ return self.getName()
+
+ def getName(self):
+ """
+ """
+ return self._impl.getName()
+
+ def getEpoch(self):
+ """
+ """
+ return self._impl.getEpoch()
+
+ def getVendor(self):
+ """
+ """
+ return self._impl.getVendor()
+
+ def getProduct(self):
+ """
+ """
+ return self._impl.getProduct()
+
+ def getInstance(self):
+ """
+ """
+ return self._impl.getInstance()
+
+ def getAttributes(self):
+ """
+ """
+ return self._impl.getAttributes()
+
+ def query(self, q, timeout=30):
+ """
+ """
+ if q.__class__ == Query:
+ q_arg = q._impl
+ else:
+ q_arg = q
+ dur = cqpid.Duration(cqpid.Duration.SECOND.getMilliseconds() * timeout)
+ result = self._impl.query(q_arg, dur)
+ if result.getType() == cqmf2.CONSOLE_EXCEPTION:
+ raise Exception(Data(result.getData(0)))
+ if result.getType() != cqmf2.CONSOLE_QUERY_RESPONSE:
+ raise Exception("Protocol error, expected CONSOLE_QUERY_RESPONSE, got %d" % result.getType())
+ dataList = []
+ count = result.getDataCount()
+ for i in range(count):
+ dataList.append(Data(result.getData(i)))
+ return dataList
+
+ def loadSchemaInfo(self, timeout=30):
+ """
+ """
+ dur = cqpid.Duration(cqpid.Duration.SECOND.getMilliseconds() * timeout)
+ self._impl.querySchema(dur)
+
+ def getPackages(self):
+ """
+ """
+ result = []
+ count = self._impl.getPackageCount()
+ for i in range(count):
+ result.append(self._impl.getPackage(i))
+ return result
+
+ def getSchemaIds(self, package):
+ """
+ """
+ result = []
+ count = self._impl.getSchemaIdCount(package)
+ for i in range(count):
+ result.append(SchemaId(self._impl.getSchemaId(package, i)))
+ return result
+
+ def getSchema(self, schemaId, timeout=30):
+ """
+ """
+ dur = cqpid.Duration(cqpid.Duration.SECOND.getMilliseconds() * timeout)
+ return Schema(self._impl.getSchema(schemaId._impl, dur))
+
+ ## TODO: Async query
+ ## TODO: Agent method
+
+#===================================================================================================
+# QUERY
+#===================================================================================================
+class Query(object):
+ """
+ """
+
+ def __init__(self, arg1, arg2=None, arg3=None, *kwargs):
+ """
+ """
+ if arg1.__class__ == DataAddr:
+ self._impl = cqmf2.Query(arg1._impl)
+
+ def getAddr(self):
+ """
+ """
+ return DataAddr(self._impl.getDataAddr())
+
+ def getSchemaId(self):
+ """
+ """
+ return SchemaId(self._impl.getSchemaId())
+
+ def getPredicate(self):
+ """
+ """
+ return self._impl.getPredicate()
+
+ def matches(self, data):
+ """
+ """
+ m = data
+ if data.__class__ == Data:
+ m = data.getProperties()
+ return self._impl.matchesPredicate(m)
+
+#===================================================================================================
+# DATA
+#===================================================================================================
+class Data(object):
+ """
+ """
+
+ def __init__(self, arg=None):
+ """
+ """
+ if arg == None:
+ self._impl = cqmf2.Data()
+ elif arg.__class__ == cqmf2.Data:
+ self._impl = arg
+ elif arg.__class__ == Schema:
+ self._impl = cqmf2.Data(arg._impl)
+ else:
+ raise Exception("Unsupported initializer for Data")
+ self._schema = None
+
+ def getSchemaId(self):
+ """
+ """
+ if self._impl.hasSchema():
+ return SchemaId(self._impl.getSchemaId())
+ return None
+
+ def getAddr(self):
+ """
+ """
+ if self._impl.hasAddr():
+ return DataAddr(self._impl.getAddr())
+ return None
+
+ def getAgent(self):
+ """
+ """
+ return Agent(self._impl.getAgent())
+
+ def update(self, timeout=5):
+ dur = cqpid.Duration(cqpid.Duration.SECOND.getMilliseconds() * timeout)
+ agent = self._impl.getAgent()
+ query = cqmf2.Query(self._impl.getAddr())
+ result = agent.query(query, dur)
+ if result.getType() != cqmf2.CONSOLE_QUERY_RESPONSE:
+ raise "Update query failed"
+ if result.getDataCount == 0:
+ raise "Object no longer exists on agent"
+ self._impl = cqmf2.Data(result.getData(0))
+
+ def getProperties(self):
+ """
+ """
+ return self._impl.getProperties();
+
+ def _getSchema(self):
+ if not self._schema:
+ if not self._impl.hasSchema():
+ raise Exception("Data object has no schema")
+ self._schema = Schema(self._impl.getAgent().getSchema(self._impl.getSchemaId()))
+
+ def _invoke(self, name, args, kwargs):
+ ##
+ ## Get local copies of the agent and the address of the data object
+ ##
+ agent = self._impl.getAgent()
+ addr = self._impl.getAddr()
+
+ ##
+ ## Set up the timeout duration for the method call. Set the default and override
+ ## it if the _timeout keyword arg was supplied.
+ ##
+ timeout = 30
+ if '_timeout' in kwargs:
+ timeout = kwargs['_timeout']
+ dur = cqpid.Duration(cqpid.Duration.SECOND.getMilliseconds() * timeout)
+
+ ##
+ ## Get the list of arguments from the schema, isolate those that are IN or IN_OUT,
+ ## validate that we have the right number of arguments supplied, and marshall them
+ ## into a map for transmission.
+ ##
+ arglist = []
+ methods = self._schema.getMethods()
+ for m in methods:
+ if m.getName() == name:
+ arglist = m.getArguments()
+ break
+ argmap = {}
+ count = 0
+ for a in arglist:
+ if a.getDirection() == DIR_IN or a.getDirection() == DIR_IN_OUT:
+ count += 1
+ if count != len(args):
+ raise Exception("Wrong number of arguments: expected %d, got %d" % (count, len(args)))
+ i = 0
+ for a in arglist:
+ if a.getDirection() == DIR_IN or a.getDirection() == DIR_IN_OUT:
+ argmap[a.getName()] = args[i]
+ i += 1
+
+ ##
+ ## Invoke the method through the agent proxy.
+ ##
+ result = agent.callMethod(name, argmap, addr, dur)
+
+ ##
+ ## If the agent sent an exception, raise it in a QmfAgentException.
+ ##
+ if result.getType() == cqmf2.CONSOLE_EXCEPTION:
+ exdata = result.getData(0)
+ raise QmfAgentException(exdata)
+
+ ##
+ ## If a successful method response was received, collect the output arguments into a map
+ ## and return them to the caller.
+ ##
+ if result.getType() != cqmf2.CONSOLE_METHOD_RESPONSE:
+ raise Exception("Protocol error: Unexpected event type in method-response: %d" % result.getType())
+ return result.getArguments()
+
+ def __getattr__(self, name):
+ ##
+ ## If we have a schema and an address, check to see if this name is the name of a method.
+ ##
+ if self._impl.hasSchema() and self._impl.hasAddr() and self._impl.hasAgent():
+ ##
+ ## Get the schema for the data object. Note that this call will block if the remote agent
+ ## needs to be queried for the schema (i.e. the schema is not in the local cache).
+ ##
+ self._getSchema()
+ methods = self._schema.getMethods()
+
+ ##
+ ## If the name matches a method in the schema, return a closure to be invoked.
+ ##
+ for method in methods:
+ if name == method.getName():
+ return lambda *args, **kwargs : self._invoke(name, args, kwargs)
+
+ ##
+ ## This is not a method call, return the property matching the name.
+ ##
+ return self._impl.getProperty(name)
+
+ def __setattr__(self, name, value):
+ if name[0] == '_':
+ super.__setattr__(self, name, value)
+ return
+ self._impl.setProperty(name, value)
+
+#===================================================================================================
+# DATA ADDRESS
+#===================================================================================================
+class DataAddr(object):
+ """
+ """
+
+ def __init__(self, arg, agentName=""):
+ if arg.__class__ == dict:
+ self._impl = cqmf2.DataAddr(arg)
+ elif arg.__class__ == cqmf2.DataAddr:
+ self._impl = arg
+ else:
+ self._impl = cqmf2.DataAddr(arg, agentName)
+
+ def __repr__(self):
+ return "%s:%s" % (self.getAgentName(), self.getName())
+
+ def __eq__(self, other):
+ return self.getAgentName() == other.getAgentName() and \
+ self.getName() == other.getName() and \
+ self.getAgentEpoch() == other.getAgentEpoch()
+
+ def asMap(self):
+ """
+ """
+ return self._impl.asMap()
+
+ def getAgentName(self):
+ """
+ """
+ return self._impl.getAgentName()
+
+ def getName(self):
+ """
+ """
+ return self._impl.getName()
+
+ def getAgentEpoch(self):
+ """
+ """
+ return self._impl.getAgentEpoch()
+
+#===================================================================================================
+# SCHEMA ID
+#===================================================================================================
+class SchemaId(object):
+ """
+ """
+
+ def __init__(self, impl):
+ self._impl = impl
+
+ def __repr__(self):
+ return "%s:%s" % (self.getPackageName(), self.getName())
+
+ def getType(self):
+ """
+ """
+ return self._impl.getType()
+
+ def getPackageName(self):
+ """
+ """
+ return self._impl.getPackageName()
+
+ def getName(self):
+ """
+ """
+ return self._impl.getName()
+
+ def getHash(self):
+ """
+ """
+ return self._impl.getHash()
+
+#===================================================================================================
+# SCHEMA
+#===================================================================================================
+class Schema(object):
+ """
+ """
+
+ def __init__(self, stype, packageName=None, className=None, desc=None, sev=None):
+ if stype.__class__ == cqmf2.Schema:
+ self._impl = stype
+ else:
+ self._impl = cqmf2.Schema(stype, packageName, className)
+ if desc:
+ self._impl.setDesc(desc)
+ if sev:
+ self._impl.setDefaultSeverity(sev)
+
+ def __repr__(self):
+ return "QmfSchema:%r" % SchemaId(self._impl.getSchemaId())
+
+ def finalize(self):
+ """
+ """
+ self._impl.finalize()
+
+ def getSchemaId(self):
+ """
+ """
+ return SchemaId(self._impl.getSchemaId())
+
+ def getDesc(self):
+ """
+ """
+ return self._impl.getDesc()
+
+ def getSev(self):
+ """
+ """
+ return self._impl.getDefaultSeverity()
+
+ def addProperty(self, prop):
+ """
+ """
+ self._impl.addProperty(prop._impl)
+
+ def addMethod(self, meth):
+ """
+ """
+ self._impl.addMethod(meth._impl)
+
+ def getProperties(self):
+ """
+ """
+ props = []
+ count = self._impl.getPropertyCount()
+ for i in range(count):
+ props.append(SchemaProperty(self._impl.getProperty(i)))
+ return props
+
+ def getMethods(self):
+ """
+ """
+ meths = []
+ count = self._impl.getMethodCount()
+ for i in range(count):
+ meths.append(SchemaMethod(self._impl.getMethod(i)))
+ return meths
+
+#===================================================================================================
+# SCHEMA PROPERTY
+#===================================================================================================
+class SchemaProperty(object):
+ """
+ """
+
+ def __init__(self, name, dtype=None, **kwargs):
+ """
+ """
+ if name.__class__ == cqmf2.SchemaProperty:
+ self._impl = name
+ else:
+ self._impl = cqmf2.SchemaProperty(name, dtype)
+ if 'access' in kwargs:
+ self._impl.setAccess(kwargs['access'])
+ if 'index' in kwargs:
+ self._impl.setIndex(kwargs['index'])
+ if 'optional' in kwargs:
+ self._impl.setOptional(kwargs['optional'])
+ if 'unit' in kwargs:
+ self._impl.setUnit(kwargs['unit'])
+ if 'desc' in kwargs:
+ self._impl.setDesc(kwargs['desc'])
+ if 'subtype' in kwargs:
+ self._impl.setSubtype(kwargs['subtype'])
+ if 'direction' in kwargs:
+ self._impl.setDirection(kwargs['direction'])
+
+ def __repr__(self):
+ return self._impl.getName()
+
+ def getName(self):
+ """
+ """
+ return self._impl.getName()
+
+ def getType(self):
+ """
+ """
+ return self._impl.getType()
+
+ def getAccess(self):
+ """
+ """
+ return self._impl.getAccess()
+
+ def isIndex(self):
+ """
+ """
+ return self._impl.isIndex()
+
+ def isOptional(self):
+ """
+ """
+ return self._impl.isOptional()
+
+ def getUnit(self):
+ """
+ """
+ return self._impl.getUnit()
+
+ def getDesc(self):
+ """
+ """
+ return self._impl.getDesc()
+
+ def getSubtype(self):
+ """
+ """
+ return self._impl.getSubtype()
+
+ def getDirection(self):
+ """
+ """
+ return self._impl.getDirection()
+
+#===================================================================================================
+# SCHEMA METHOD
+#===================================================================================================
+class SchemaMethod(object):
+ """
+ """
+
+ def __init__(self, name, **kwargs):
+ """
+ """
+ if name.__class__ == cqmf2.SchemaMethod:
+ self._impl = name
+ else:
+ self._impl = cqmf2.SchemaMethod(name)
+ if 'desc' in kwargs:
+ self._impl.setDesc(kwargs['desc'])
+
+ def __repr__(self):
+ return "%s()" % self._impl.getName()
+
+ def getName(self):
+ """
+ """
+ return self._impl.getName()
+
+ def getDesc(self):
+ """
+ """
+ return self._impl.getDesc()
+
+ def addArgument(self, arg):
+ """
+ """
+ self._impl.addArgument(arg._impl)
+
+ def getArguments(self):
+ """
+ """
+ result = []
+ count = self._impl.getArgumentCount()
+ for i in range(count):
+ result.append(SchemaProperty(self._impl.getArgument(i)))
+ return result
+
diff --git a/qpid/cpp/bindings/qmf2/qmf2.i b/qpid/cpp/bindings/qmf2/qmf2.i
new file mode 100644
index 0000000000..0f573fe3e6
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/qmf2.i
@@ -0,0 +1,66 @@
+/*
+ * 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 <qmf/exceptions.h>
+#include <qmf/AgentEvent.h>
+#include <qmf/Agent.h>
+#include <qmf/AgentSession.h>
+#include <qmf/ConsoleEvent.h>
+#include <qmf/ConsoleSession.h>
+#include <qmf/DataAddr.h>
+#include <qmf/Data.h>
+#include <qmf/Query.h>
+#include <qmf/Schema.h>
+#include <qmf/SchemaId.h>
+#include <qmf/SchemaMethod.h>
+#include <qmf/SchemaProperty.h>
+#include <qmf/SchemaTypes.h>
+#include <qmf/Subscription.h>
+
+%}
+
+%include <qpid/ImportExport.h>
+%include <qpid/messaging/ImportExport.h>
+%include <qpid/messaging/Duration.h>
+
+%include <qmf/ImportExport.h>
+%include <qmf/exceptions.h>
+%include <qmf/AgentEvent.h>
+%include <qmf/Agent.h>
+%include <qmf/AgentSession.h>
+%include <qmf/ConsoleEvent.h>
+%include <qmf/ConsoleSession.h>
+%include <qmf/DataAddr.h>
+%include <qmf/Data.h>
+%include <qmf/Query.h>
+%include <qmf/Schema.h>
+%include <qmf/SchemaId.h>
+%include <qmf/SchemaMethod.h>
+%include <qmf/SchemaProperty.h>
+%include <qmf/SchemaTypes.h>
+%include <qmf/Subscription.h>
+
+%{
+
+using namespace qmf;
+
+%};
+
diff --git a/qpid/cpp/bindings/qmf2/ruby/Makefile.am b/qpid/cpp/bindings/qmf2/ruby/Makefile.am
new file mode 100644
index 0000000000..97bbc6f385
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/ruby/Makefile.am
@@ -0,0 +1,44 @@
+#
+# 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.
+#
+
+if HAVE_RUBY_DEVEL
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src -I$(top_builddir)/src $(QMF_INCLUDES)
+
+EXTRA_DIST = ruby.i
+BUILT_SOURCES = cqmf2.cpp
+SWIG_FLAGS = -w362,401
+
+rubylibdir = $(RUBY_LIB)
+
+cqmf2.cpp: $(srcdir)/ruby.i $(srcdir)/../qmf2.i $(srcdir)/../../swig_ruby_typemaps.i
+ $(SWIG) -ruby -c++ $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I/usr/include -o cqmf2.cpp $(srcdir)/ruby.i
+
+rubylibarchdir = $(RUBY_LIB_ARCH)
+rubylibarch_LTLIBRARIES = cqmf2.la
+dist_rubylib_DATA = qmf2.rb
+
+cqmf2_la_LDFLAGS = -avoid-version -module -shared -shrext ".$(RUBY_DLEXT)"
+cqmf2_la_LIBADD = $(RUBY_LIBS) -L$(top_builddir)/src/.libs -lqmf2 $(top_builddir)/src/libqmf2.la
+cqmf2_la_CXXFLAGS = $(INCLUDES) -I$(RUBY_INC) -I$(RUBY_INC_ARCH) -fno-strict-aliasing
+nodist_cqmf2_la_SOURCES = cqmf2.cpp
+
+CLEANFILES = cqmf2.cpp
+
+endif # HAVE_RUBY_DEVEL
diff --git a/qpid/cpp/bindings/qmf2/ruby/qmf2.rb b/qpid/cpp/bindings/qmf2/ruby/qmf2.rb
new file mode 100644
index 0000000000..c14ecba4e1
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/ruby/qmf2.rb
@@ -0,0 +1,855 @@
+#
+# 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.
+#
+
+require 'cqmf2'
+require 'cqpid'
+require 'thread'
+require 'socket'
+require 'monitor'
+
+module Qmf2
+
+ Cqmf2.constants.each do |c|
+ if c.index('AGENT_') == 0 or c.index('CONSOLE_') == 0 or
+ c.index('SCHEMA_') == 0 or c.index('SEV_') == 0 or c.index('QUERY') == 0
+ const_set(c, Cqmf2.const_get(c))
+ end
+ end
+
+ SCHEMA_TYPE_DATA = Cqmf2::SCHEMA_TYPE_DATA()
+ SCHEMA_TYPE_EVENT = Cqmf2::SCHEMA_TYPE_EVENT()
+
+ SCHEMA_DATA_VOID = Cqmf2::SCHEMA_DATA_VOID()
+ SCHEMA_DATA_BOOL = Cqmf2::SCHEMA_DATA_BOOL()
+ SCHEMA_DATA_INT = Cqmf2::SCHEMA_DATA_INT()
+ SCHEMA_DATA_FLOAT = Cqmf2::SCHEMA_DATA_FLOAT()
+ SCHEMA_DATA_STRING = Cqmf2::SCHEMA_DATA_STRING()
+ SCHEMA_DATA_MAP = Cqmf2::SCHEMA_DATA_MAP()
+ SCHEMA_DATA_LIST = Cqmf2::SCHEMA_DATA_LIST()
+ SCHEMA_DATA_UUID = Cqmf2::SCHEMA_DATA_UUID()
+
+ ACCESS_READ_CREATE = Cqmf2::ACCESS_READ_CREATE()
+ ACCESS_READ_WRITE = Cqmf2::ACCESS_READ_WRITE()
+ ACCESS_READ_ONLY = Cqmf2::ACCESS_READ_ONLY()
+
+ DIR_IN = Cqmf2::DIR_IN()
+ DIR_OUT = Cqmf2::DIR_OUT()
+ DIR_IN_OUT = Cqmf2::DIR_IN_OUT()
+
+ SEV_EMERG = Cqmf2::SEV_EMERG()
+ SEV_ALERT = Cqmf2::SEV_ALERT()
+ SEV_CRIT = Cqmf2::SEV_CRIT()
+ SEV_ERROR = Cqmf2::SEV_ERROR()
+ SEV_WARN = Cqmf2::SEV_WARN()
+ SEV_NOTICE = Cqmf2::SEV_NOTICE()
+ SEV_INFORM = Cqmf2::SEV_INFORM()
+ SEV_DEBUG = Cqmf2::SEV_DEBUG()
+
+ ##==============================================================================
+ ## EXCEPTIONS
+ ##==============================================================================
+
+ class QmfAgentException < RuntimeError
+ attr :data
+
+ def initialize(data)
+ @data = data
+ end
+
+ def to_s
+ "QmfAgentException: #{@data}"
+ end
+ end
+
+ ##==============================================================================
+ ## AGENT HANDLER
+ ##==============================================================================
+
+ class AgentHandler
+
+ def initialize(session)
+ @_session = session
+ @_running = false
+ @_thread = nil
+ end
+
+ ##
+ ## Call the "start" method to run the handler on a new thread.
+ ##
+ def start
+ @_thread = Thread.new do
+ run
+ end
+ end
+
+ ##
+ ## Request that the running thread complete and exit.
+ ##
+ def cancel
+ @_running = false
+ @_thread.join if @_thread
+ @_thread = nil
+ end
+
+ ##
+ ## Call the "run" method only if you want the handler to run on your own thread.
+ ##
+ def run
+ @_running = true
+ event = Cqmf2::AgentEvent.new
+ while @_running do
+ valid = @_session.impl.nextEvent(event, Cqpid::Duration.SECOND)
+ if valid and @_running
+ case event.getType
+ when Cqmf2::AGENT_AUTH_QUERY
+ yes = authorize_query(Query.new(event.getQuery()), event.getUserId())
+ if yes == true
+ @_session.impl.authAccept(event)
+ else
+ @_session.impl.authReject(event)
+ end
+
+ when Cqmf2::AGENT_QUERY
+ context = QueryContext.new(@_session, event)
+ get_query(context, Query.new(event.getQuery()), event.getUserId())
+
+ when Cqmf2::AGENT_METHOD
+ context = MethodContext.new(@_session, event)
+ begin
+ method_call(context, event.getMethodName(), event.getDataAddr(), event.getArguments(), event.getUserId())
+ rescue Exception => ex
+ @_session.impl.raiseException(event, "#{ex}")
+ end
+
+ end
+ end
+ end
+ end
+
+
+ ##
+ ## The following methods are intended to be overridden in a sub-class. They are
+ ## handlers for events that occur on QMF consoles.
+ ##
+
+ #
+ # This method will only be invoked if the "allow-queries" option is enabled on the
+ # agent session. When invoked, it provides the query and the authenticated user-id
+ # of the querying client.
+ #
+ # This method must return true if the query is permitted, false otherwise.
+ #
+ def authorize_query(query, user_id); end
+
+ #
+ # This method will only be invoked if the "external" option is "True" on the agent
+ # session. When invoked, the method should begin the process of responding to a data
+ # query. The authenticated user-id of the requestor is provided for informational
+ # purposes. The 'context' variable is used to provide the results back to the requestor.
+ #
+ # For each matching Data object, call context.response(data). When the query is complete,
+ # call context.complete(). After completing the query, you should not use 'context' any
+ # longer.
+ #
+ # Note: It is not necessary to process the query synchronously. If desired, this method
+ # may store the context for asynchronous processing or pass it to another thread for
+ # processing. There is no restriction on the number of contexts that may be in-flight
+ # concurrently.
+ #
+ def get_query(context, query, user_id); end
+
+ #
+ # This method is invoked when a console calls a QMF method on the agent. Supplied are
+ # a context for the response, the method name, the data address of the data object being
+ # called, the input arguments (a dictionary), and the caller's authenticated user-id.
+ #
+ # A method call can end one of two ways: Successful completion, in which the output
+ # arguments (if any) are supplied; and Exceptional completion if there is an error.
+ #
+ # Successful Completion:
+ # For each output argument, assign the value directly to context (context.arg1 = "value")
+ # Once arguments are assigned, call context._success().
+ #
+ # Exceptional Completion:
+ # Method 1: Call context._exception(data) where 'data' is a string or a Data object.
+ # Method 2: Raise an exception (raise "Error Text") synchronously in the method body.
+ #
+ # Note: Like get_query, method_call may process methods synchronously or asynchronously.
+ # This method may store the context for later asynchronous processing. There is no
+ # restriction on the number of contexts that may be in-flight concurrently.
+ #
+ # However, "Method 2" for Exceptional Completion can only be done synchronously.
+ #
+ def method_call(context, method_name, data_addr, args, user_id); end
+ end
+
+ class QueryContext
+ def initialize(agent, context)
+ @agent = agent
+ @context = context
+ end
+
+ def response(data)
+ @agent.impl.response(@context, data.impl)
+ end
+
+ def complete
+ @agent.impl.complete(@context)
+ end
+ end
+
+ class MethodContext
+ def initialize(agent, context)
+ @agent = agent
+ @context = context
+ end
+
+ def _success
+ @agent.impl.methodSuccess(@context)
+ end
+
+ def _exception(ex)
+ if ex.class == Data
+ @agent.impl.raiseException(@context, ex.impl)
+ else
+ @agent.impl.raiseException(@context, ex)
+ end
+ end
+
+ def method_missing(name_in, *args)
+ name = name_in.to_s
+ if name[name.length - 1] == 61
+ name = name[0..name.length - 2]
+ @context.impl.addReturnArgument(name, args[0])
+ else
+ super.method_missing(name_in, args)
+ end
+ end
+ end
+
+ ##==============================================================================
+ ## CONSOLE HANDLER
+ ##==============================================================================
+
+ class ConsoleHandler
+
+ def initialize(session)
+ @_session = session
+ @_running = false
+ @_thread = nil
+ end
+
+ ##
+ ## Call the "start" method to run the handler on a new thread.
+ ##
+ def start
+ @_thread = Thread.new do
+ run
+ end
+ end
+
+ ##
+ ## Request that the running thread complete and exit.
+ ##
+ def cancel
+ @_running = false
+ @_thread.join if @_thread
+ @_thread = nil
+ end
+
+ ##
+ ## Call the "run" method only if you want the handler to run on your own thread.
+ ##
+ def run
+ @_running = true
+ event = Cqmf2::ConsoleEvent.new
+ while @_running do
+ valid = @_session.impl.nextEvent(event, Cqpid::Duration.SECOND)
+ if valid and @_running
+ case event.getType
+ when Cqmf2::CONSOLE_AGENT_ADD
+ agent_added(Agent.new(event.getAgent))
+
+ when Cqmf2::CONSOLE_AGENT_DEL
+ reason = :filter
+ reason = :aged if event.getAgentDelReason == Cqmf2::AGENT_DEL_AGED
+ agent_deleted(Agent.new(event.getAgent), reason)
+
+ when Cqmf2::CONSOLE_AGENT_RESTART
+ agent_restarted(Agent.new(event.getAgent))
+
+ when Cqmf2::CONSOLE_AGENT_SCHEMA_UPDATE
+ agent_schema_updated(Agent.new(event.getAgent))
+
+ when Cqmf2::CONSOLE_EVENT
+ event_raised(Agent.new(event.getAgent), Data.new(event.getData(0)), event.getTimestamp, event.getSeverity)
+
+ end
+ end
+ end
+ end
+
+
+ ##
+ ## The following methods are intended to be overridden in a sub-class. They are
+ ## handlers for events that occur on QMF consoles.
+ ##
+
+ #
+ # A new agent, whose attributes match the console's agent filter, has been discovered.
+ #
+ def agent_added(agent); end
+
+ #
+ # A known agent has been removed from the agent list. There are two possible reasons
+ # for agent deletion:
+ #
+ # 1) :aged - The agent hasn't been heard from for the maximum age interval and is
+ # presumed dead.
+ # 2) :filter - The agent no longer matches the console's agent-filter and has been
+ # effectively removed from the agent list. Such occurrences are likely
+ # to be seen immediately after setting the filter to a new value.
+ #
+ def agent_deleted(agent, reason); end
+
+ #
+ # An agent-restart was detected. This occurs when the epoch number advertised by the
+ # agent changes. It indicates that the agent in question was shut-down/crashed and
+ # restarted.
+ #
+ def agent_restarted(agent); end
+
+ #
+ # The agent has registered new schema information which can now be queried, if desired.
+ #
+ def agent_schema_updated(agent); end
+
+ #
+ # An agent raised an event. The 'data' argument is a Data object that contains the
+ # content of the event.
+ #
+ def event_raised(agent, data, timestamp, severity); end
+ end
+
+ ##==============================================================================
+ ## CONSOLE SESSION
+ ##==============================================================================
+
+ class ConsoleSession
+ attr_reader :impl
+
+ ## The options string is of the form "{key:value,key:value}". The following keys are supported:
+ ##
+ ## domain:NAME - QMF Domain to join [default: "default"]
+ ## max-agent-age:N - Maximum time, in minutes, that we will tolerate not hearing from
+ ## an agent before deleting it [default: 5]
+ ## listen-on-direct:{True,False} - If True: Listen on legacy direct-exchange address for backward compatibility [default]
+ ## If False: Listen only on the routable direct address
+ ## strict-security:{True,False} - If True: Cooperate with the broker to enforce strict access control to the network
+ ## - If False: Operate more flexibly with regard to use of messaging facilities [default]
+ ##
+ def initialize(connection, options="")
+ @impl = Cqmf2::ConsoleSession.new(connection, options)
+ end
+
+ def set_domain(domain) @impl.setDomain(domain) end
+ def set_agent_filter(filter) @impl.setAgentFilter(filter) end
+
+ def open() @impl.open end
+ def close() @impl.close end
+
+ def agents
+ result = []
+ count = @impl.getAgentCount
+ for i in 0...count
+ result << Agent.new(@impl.getAgent(i))
+ end
+ return result
+ end
+
+ def connected_broker_agent
+ Agent.new(@impl.getConnectedBrokerAgent)
+ end
+ end
+
+ ##==============================================================================
+ ## AGENT SESSION
+ ##==============================================================================
+
+ class AgentSession
+ attr_reader :impl
+
+ ## The options string is of the form "{key:value,key:value}". The following keys are supported:
+ ##
+ ## interval:N - Heartbeat interval in seconds [default: 60]
+ ## external:{True,False} - Use external data storage (queries and subscriptions are pass-through) [default: False]
+ ## allow-queries:{True,False} - If True: automatically allow all queries [default]
+ ## If False: generate an AUTH_QUERY event to allow per-query authorization
+ ## allow-methods:{True,False} - If True: automatically allow all methods [default]
+ ## If False: generate an AUTH_METHOD event to allow per-method authorization
+ ## max-subscriptions:N - Maximum number of concurrent subscription queries permitted [default: 64]
+ ## min-sub-interval:N - Minimum publish interval (in milliseconds) permitted for a subscription [default: 3000]
+ ## sub-lifetime:N - Lifetime (in seconds with no keepalive) for a subscription [default: 300]
+ ## public-events:{True,False} - If True: QMF events are sent to the topic exchange [default]
+ ## If False: QMF events are only sent to authorized subscribers
+ ## listen-on-direct:{True,False} - If True: Listen on legacy direct-exchange address for backward compatibility [default]
+ ## If False: Listen only on the routable direct address
+ ## strict-security:{True,False} - If True: Cooperate with the broker to enforce strict access control to the network
+ ## - If False: Operate more flexibly with regard to use of messaging facilities [default]
+ ##
+ def initialize(connection, options="")
+ @impl = Cqmf2::AgentSession.new(connection, options)
+ end
+
+ def set_domain(val) @impl.setDomain(val) end
+ def set_vendor(val) @impl.setVendor(val) end
+ def set_product(val) @impl.setProduct(val) end
+ def set_instance(val) @impl.setInstance(val) end
+ def set_attribute(key, val) @impl.setAttribute(key, val) end
+ def open() @impl.open end
+ def close() @impl.close end
+ def register_schema(cls) @impl.registerSchema(cls.impl) end
+
+ def add_data(data, name="", persistent=false)
+ DataAddr.new(@impl.addData(data.impl, name, persistent))
+ end
+
+ def del_data(addr)
+ @impl.del_data(addr.impl)
+ end
+
+ def raise_event(data, severity=nil)
+ if !severity
+ @impl.raiseEvent(data.impl)
+ else
+ @impl.raiseEvent(data.impl, severity)
+ end
+ end
+ end
+
+ ##==============================================================================
+ ## AGENT PROXY
+ ##==============================================================================
+
+ class Agent
+ attr_reader :impl
+
+ def initialize(impl)
+ @impl = impl
+ end
+
+ def name() @impl.getName end
+ def epoch() @impl.getEpoch end
+ def vendor() @impl.getVendor end
+ def product() @impl.getProduct end
+ def instance() @impl.getInstance end
+ def attributes() @impl.getAttributes end
+
+ def to_s
+ "#{vendor}:#{product}:#{instance}"
+ end
+
+ def query(q, timeout=30)
+ if q.class == Query
+ q_arg = q.impl
+ else
+ q_arg = q
+ end
+ dur = Cqpid::Duration.new(Cqpid::Duration.SECOND.getMilliseconds * timeout)
+ result = @impl.query(q_arg, dur)
+ raise QmfAgentException.new(Data.new(result.getData(0))) if result.getType == Cqmf2::CONSOLE_EXCEPTION
+ raise "Protocol error, expected CONSOLE_QUERY_RESPONSE, got #{result.getType}" if result.getType != Cqmf2::CONSOLE_QUERY_RESPONSE
+ data_list = []
+ count = result.getDataCount
+ for i in 0...count
+ data_list << Data.new(result.getData(i))
+ end
+ return data_list
+ end
+
+ def load_schema_info(timeout=30)
+ dur = Cqpid::Duration.new(Cqpid::Duration.SECOND.getMilliseconds * timeout)
+ @impl.querySchema(dur)
+ end
+
+ def packages
+ result = []
+ count = @impl.getPackageCount
+ for i in 0...count
+ result << @impl.getPackage(i)
+ end
+ return result
+ end
+
+ def schema_ids(package)
+ result = []
+ count = @impl.getSchemaIdCount(package)
+ for i in 0...count
+ result << SchemaId.new(@impl.getSchemaId(package, i))
+ end
+ return result
+ end
+
+ def schema(sid, timeout=30)
+ dur = Cqpid::Duration.new(Cqpid::Duration.SECOND.getMilliseconds * timeout)
+ Schema.new(@impl.getSchema(sid.impl, dur))
+ end
+ end
+
+ ##==============================================================================
+ ## QUERY
+ ##==============================================================================
+
+ class Query
+ attr_reader :impl
+ def initialize(arg1, arg2=nil, arg3=nil)
+ if arg1.class == Qmf2::DataAddr
+ @impl = Cqmf2::Query.new(arg1.impl)
+ end
+ end
+
+ def addr() DataAddr.new(@impl.getDataAddr()) end
+ def schema_id() SchemaId.new(@impl.getSchemaId()) end
+ def predicate() @impl.getPredicate() end
+
+ def matches?(data)
+ map = data
+ map = data.properties if data.class == Data
+ @impl.matchesPredicate(map)
+ end
+ end
+
+ ##==============================================================================
+ ## DATA
+ ##==============================================================================
+
+ class Data
+ attr_reader :impl
+
+ def initialize(arg=nil)
+ @schema = nil
+ if arg == nil
+ @impl = Cqmf2::Data.new
+ elsif arg.class == Cqmf2::Data
+ @impl = arg
+ elsif arg.class == Schema
+ @impl = Cqmf2::Data.new(arg.impl)
+ @schema = arg
+ else
+ raise "Unsupported initializer for Data"
+ end
+ end
+
+ def to_s
+ "#{@impl.getProperties}"
+ end
+
+ def schema_id
+ if @impl.hasSchema
+ return SchemaId.new(@impl.getSchemaId)
+ end
+ return nil
+ end
+
+ def set_addr(addr)
+ @impl.setAddr(addr.impl)
+ end
+
+ def addr
+ if @impl.hasAddr
+ return DataAddr.new(@impl.getAddr)
+ end
+ return nil
+ end
+
+ def agent
+ return Agent.new(@impl.getAgent)
+ end
+
+ def update(timeout=5)
+ dur = Cqpid::Duration.new(Cqpid::Duration.SECOND.getMilliseconds * timeout)
+ agent = @impl.getAgent
+ query = Cqmf2::Query.new(@impl.getAddr)
+ result = agent.query(query, dur)
+ raise "Update query failed" if result.getType != Cqmf2::CONSOLE_QUERY_RESPONSE
+ raise "Object no longer exists on agent" if result.getDataCount == 0
+ @impl = Cqmf2::Data.new(result.getData(0))
+ return nil
+ end
+
+ def properties
+ return @impl.getProperties
+ end
+
+ def get_attr(name)
+ @impl.getProperty(name)
+ end
+
+ def set_attr(name, v)
+ @impl.setProperty(name, v)
+ end
+
+ def [](name)
+ get_attr(name)
+ end
+
+ def []=(name, value)
+ set_attr(name, value)
+ end
+
+ def _get_schema
+ unless @schema
+ raise "Data object has no schema" unless @impl.hasSchema
+ @schema = Schema.new(@impl.getAgent.getSchema(@impl.getSchemaId))
+ end
+ end
+
+ def method_missing(name_in, *args)
+ #
+ # Convert the name to a string and determine if it represents an
+ # attribute assignment (i.e. "attr=")
+ #
+ name = name_in.to_s
+ attr_set = (name[name.length - 1] == 61)
+ name = name[0..name.length - 2] if attr_set
+
+ #
+ # We'll be needing the schema to determine how to proceed. Get the schema.
+ # Note that this call may block if the remote agent needs to be queried
+ # for the schema (i.e. the schema isn't in the local cache).
+ #
+ _get_schema
+
+ #
+ # If the name matches a property name, set or return the value of the property.
+ #
+ @schema.properties.each do |prop|
+ if prop.name == name
+ if attr_set
+ return set_attr(name, args[0])
+ else
+ return get_attr(name)
+ end
+ end
+ end
+
+ #
+ # If we still haven't found a match for the name, check to see if
+ # it matches a method name. If so, marshall the arguments and invoke
+ # the method.
+ #
+ @schema.methods.each do |method|
+ if method.name == name
+ raise "Sets not permitted on methods" if attr_set
+ result = @impl.getAgent.callMethod(name, _marshall(method, args), @impl.getAddr)
+ if result.getType == Cqmf2::CONSOLE_EXCEPTION
+ raise QmfAgentException, result.getData(0)
+ end
+ return result.getArguments
+ end
+ end
+
+ #
+ # This name means nothing to us, pass it up the line to the parent
+ # class's handler.
+ #
+ super.method_missing(name_in, args)
+ end
+
+ #
+ # Convert a Ruby array of arguments (positional) into a Value object of type "map".
+ #
+ private
+ def _marshall(schema, args)
+ count = 0
+ schema.arguments.each do |arg|
+ if arg.direction == DIR_IN || arg.direction == DIR_IN_OUT
+ count += 1
+ end
+ end
+ raise "Wrong number of arguments: expecter #{count}, got #{arge.length}" if count != args.length
+ map = {}
+ count = 0
+ schema.arguments.each do |arg|
+ if arg.direction == DIR_IN || arg.direction == DIR_IN_OUT
+ map[arg.name] = args[count]
+ count += 1
+ end
+ end
+ return map
+ end
+ end
+
+ ##==============================================================================
+ ## DATA ADDRESS
+ ##==============================================================================
+
+ class DataAddr
+ attr_reader :impl
+
+ def initialize(arg, agentName="")
+ if arg.class == Hash
+ @impl = Cqmf2::DataAddr.new(arg)
+ elsif arg.class == Cqmf2::DataAddr
+ @impl = arg
+ else
+ @impl = Cqmf2::DataAddr.new(arg, agentName)
+ end
+ end
+
+ def ==(other)
+ return @impl == other.impl
+ end
+
+ def as_map() @impl.asMap end
+ def agent_name() @impl.getAgentName end
+ def name() @impl.getName end
+ def agent_epoch() @impl.getAgentEpoch end
+ end
+
+ ##==============================================================================
+ ## SCHEMA ID
+ ##==============================================================================
+
+ class SchemaId
+ attr_reader :impl
+ def initialize(impl)
+ @impl = impl
+ end
+
+ def type() @impl.getType end
+ def package_name() @impl.getPackageName end
+ def class_name() @impl.getName end
+ def hash() @impl.getHash end
+ end
+
+ ##==============================================================================
+ ## SCHEMA
+ ##==============================================================================
+
+ class Schema
+ attr_reader :impl
+ def initialize(arg, packageName="", className="", kwargs={})
+ if arg.class == Cqmf2::Schema
+ @impl = arg
+ else
+ @impl = Cqmf2::Schema.new(arg, packageName, className)
+ @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+ @impl.setDefaultSeverity(kwargs[:sev]) if kwargs.include?(:sev)
+ end
+ end
+
+ def finalize() @impl.finalize end
+ def schema_id() SchemaId.new(@impl.getSchemaId) end
+ def desc() @impl.getDesc end
+ def sev() @impl.getDefaultSeverity end
+ def add_property(prop) @impl.addProperty(prop.impl) end
+ def add_method(meth) @impl.addMethod(meth.impl) end
+
+ def properties
+ result = []
+ count = @impl.getPropertyCount
+ for i in 0...count
+ result << SchemaProperty.new(@impl.getProperty(i))
+ end
+ return result
+ end
+
+ def methods
+ result = []
+ count = @impl.getMethodCount
+ for i in 0...count
+ result << SchemaMethod.new(@impl.getMethod(i))
+ end
+ return result
+ end
+ end
+
+ ##==============================================================================
+ ## SCHEMA PROPERTY
+ ##==============================================================================
+
+ class SchemaProperty
+ attr_reader :impl
+
+ def initialize(arg, dtype=nil, kwargs={})
+ if arg.class == Cqmf2::SchemaProperty
+ @impl = arg
+ else
+ @impl = Cqmf2::SchemaProperty.new(arg, dtype)
+ @impl.setAccess(kwargs[:access]) if kwargs.include?(:access)
+ @impl.setIndex(kwargs[:index]) if kwargs.include?(:index)
+ @impl.setOptional(kwargs[:optional]) if kwargs.include?(:optional)
+ @impl.setUnit(kwargs[:unit]) if kwargs.include?(:unit)
+ @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+ @impl.setSubtype(kwargs[:subtype]) if kwargs.include?(:subtype)
+ @impl.setDirection(kwargs[:direction]) if kwargs.include?(:direction)
+ end
+ end
+
+ def name() @impl.getName end
+ def access() @impl.getAccess end
+ def index?() @impl.isIndex end
+ def optional?() @impl.isOptional end
+ def unit() @impl.getUnit end
+ def desc() @impl.getDesc end
+ def subtype() @impl.getSubtype end
+ def direction() @impl.getDirection end
+
+ def to_s
+ name
+ end
+ end
+
+ ##==============================================================================
+ ## SCHEMA METHOD
+ ##==============================================================================
+
+ class SchemaMethod
+ attr_reader :impl
+
+ def initialize(arg, kwargs={})
+ if arg.class == Cqmf2::SchemaMethod
+ @impl = arg
+ else
+ @impl = Cqmf2::SchemaMethod.new(arg)
+ @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+ end
+ end
+
+ def name() @impl.getName end
+ def desc() @impl.getDesc end
+ def add_argument(arg) @impl.addArgument(arg.impl) end
+
+ def arguments
+ result = []
+ count = @impl.getArgumentCount
+ for i in 0...count
+ result << SchemaProperty.new(@impl.getArgument(i))
+ end
+ return result
+ end
+
+ def to_s
+ name
+ end
+ end
+end
+
+
diff --git a/qpid/cpp/bindings/qmf2/ruby/ruby.i b/qpid/cpp/bindings/qmf2/ruby/ruby.i
new file mode 100644
index 0000000000..1070c65a44
--- /dev/null
+++ b/qpid/cpp/bindings/qmf2/ruby/ruby.i
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+%module cqmf2
+%include "std_string.i"
+%include "../../swig_ruby_typemaps.i"
+
+/* Define the general-purpose exception handling */
+%exception {
+ try {
+ $action
+ }
+ catch (qpid::types::Exception& mex) {
+ static VALUE qmferror = rb_define_class("QmfError", rb_eStandardError);
+ rb_raise(qmferror, mex.what());
+ }
+}
+
+%include "../qmf2.i"
diff --git a/qpid/cpp/bindings/qpid/CMakeLists.txt b/qpid/cpp/bindings/qpid/CMakeLists.txt
new file mode 100644
index 0000000000..7c9f76f991
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/CMakeLists.txt
@@ -0,0 +1,41 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+include(FindSWIG)
+include(UseSWIG)
+include(FindRuby)
+include(FindPythonLibs)
+include(FindPerlLibs)
+
+if (SWIG_FOUND)
+ set(CMAKE_SWIG_FLAGS "-w361,362,401,467,503")
+
+ if (PYTHONLIBS_FOUND)
+ add_subdirectory(python)
+ endif (PYTHONLIBS_FOUND)
+
+ if (RUBY_FOUND)
+ add_subdirectory(ruby)
+ endif (RUBY_FOUND)
+
+ if (PERLLIBS_FOUND)
+ add_subdirectory(perl)
+ endif (PERLLIBS_FOUND)
+endif (SWIG_FOUND)
diff --git a/qpid/cpp/bindings/qpid/Makefile.am b/qpid/cpp/bindings/qpid/Makefile.am
new file mode 100644
index 0000000000..31bce5d1d5
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/Makefile.am
@@ -0,0 +1,38 @@
+#
+# 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.
+#
+
+SUBDIRS = dotnet
+
+if HAVE_SWIG
+
+EXTRA_DIST = CMakeLists.txt qpid.i
+
+if HAVE_RUBY_DEVEL
+SUBDIRS += ruby
+endif
+
+if HAVE_PYTHON_DEVEL
+SUBDIRS += python
+endif
+
+if HAVE_PERL_DEVEL
+SUBDIRS += perl
+endif
+
+endif
diff --git a/qpid/cpp/bindings/qpid/dotnet/Makefile.am b/qpid/cpp/bindings/qpid/dotnet/Makefile.am
new file mode 100644
index 0000000000..b5c1f6dda5
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/Makefile.am
@@ -0,0 +1,126 @@
+#
+# 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.
+#
+
+EXTRA_DIST = winsdk_sources/winsdk_dotnet_examples.sln \
+ winsdk_sources/examples/csharp.direct.receiver/csharp.direct.receiver.csproj \
+ winsdk_sources/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj \
+ winsdk_sources/examples/csharp.example.helloworld/csharp.example.helloworld.csproj \
+ winsdk_sources/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj \
+ winsdk_sources/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj \
+ winsdk_sources/examples/csharp.example.server/csharp.example.server.csproj \
+ winsdk_sources/examples/csharp.example.spout/csharp.example.spout.csproj \
+ winsdk_sources/examples/csharp.example.drain/csharp.example.drain.csproj \
+ winsdk_sources/examples/csharp.map.sender/csharp.map.sender.csproj \
+ winsdk_sources/examples/csharp.map.receiver/csharp.map.receiver.csproj \
+ winsdk_sources/examples/csharp.example.client/csharp.example.client.csproj \
+ winsdk_sources/examples/csharp.direct.sender/csharp.direct.sender.csproj \
+ examples/csharp.direct.receiver/csharp.direct.receiver.cs \
+ examples/csharp.direct.receiver/csharp.direct.receiver.csproj \
+ examples/csharp.direct.receiver/Properties/AssemblyInfo.cs \
+ examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs \
+ examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj \
+ examples/csharp.map.callback.receiver/Properties/AssemblyInfo.cs \
+ examples/powershell.example.helloworld/powershell.example.helloworld.ps1 \
+ examples/csharp.example.helloworld/csharp.example.helloworld.cs \
+ examples/csharp.example.helloworld/csharp.example.helloworld.csproj \
+ examples/csharp.example.helloworld/Properties/AssemblyInfo.cs \
+ examples/csharp.example.declare_queues/csharp.example.declare_queues.cs \
+ examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj \
+ examples/csharp.example.declare_queues/Properties/AssemblyInfo.cs \
+ examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj \
+ examples/csharp.map.callback.sender/Properties/AssemblyInfo.cs \
+ examples/csharp.map.callback.sender/csharp.map.callback.sender.cs \
+ examples/csharp.example.server/csharp.example.server.csproj \
+ examples/csharp.example.server/csharp.example.server.cs \
+ examples/csharp.example.server/Properties/AssemblyInfo.cs \
+ examples/csharp.example.spout/csharp.example.spout.csproj \
+ examples/csharp.example.spout/Options.cs \
+ examples/csharp.example.spout/csharp.example.spout.cs \
+ examples/csharp.example.spout/Properties/AssemblyInfo.cs \
+ examples/csharp.example.drain/csharp.example.drain.cs \
+ examples/csharp.example.drain/csharp.example.drain.csproj \
+ examples/csharp.example.drain/Options.cs \
+ examples/csharp.example.drain/Properties/AssemblyInfo.cs \
+ examples/csharp.map.sender/csharp.map.sender.csproj \
+ examples/csharp.map.sender/csharp.map.sender.cs \
+ examples/csharp.map.sender/Properties/AssemblyInfo.cs \
+ examples/visualbasic.example.client/visualbasic.example.client.vbproj \
+ examples/visualbasic.example.client/MyProject/Resources.resx \
+ examples/visualbasic.example.client/MyProject/Application.myapp \
+ examples/visualbasic.example.client/MyProject/Settings.settings \
+ examples/visualbasic.example.client/MyProject/Settings.Designer.vb \
+ examples/visualbasic.example.client/MyProject/AssemblyInfo.vb \
+ examples/visualbasic.example.client/MyProject/Application.Designer.vb \
+ examples/visualbasic.example.client/MyProject/Resources.Designer.vb \
+ examples/visualbasic.example.client/visualbasic.example.client.vb \
+ examples/csharp.map.receiver/csharp.map.receiver.csproj \
+ examples/csharp.map.receiver/csharp.map.receiver.cs \
+ examples/csharp.map.receiver/Properties/AssemblyInfo.cs \
+ examples/csharp.example.client/csharp.example.client.cs \
+ examples/csharp.example.client/Properties/AssemblyInfo.cs \
+ examples/csharp.example.client/csharp.example.client.csproj \
+ examples/csharp.direct.sender/csharp.direct.sender.csproj \
+ examples/csharp.direct.sender/csharp.direct.sender.cs \
+ examples/csharp.direct.sender/Properties/AssemblyInfo.cs \
+ configure-windows.ps1 \
+ ReadMe.txt \
+ org.apache.qpid.messaging.sln \
+ org.apache.qpid.messaging.sessionreceiver.sln \
+ test/messaging.test/messaging.test.address.cs \
+ test/messaging.test/messaging.test.duration.cs \
+ test/messaging.test/messaging.test.cs \
+ test/messaging.test/messaging.test.message.cs \
+ test/messaging.test/messaging.test.csproj \
+ test/messaging.test/Properties/AssemblyInfo.cs \
+ test/messaging.test/messaging.test.connection.cs \
+ src/org.apache.qpid.messaging.vcproj \
+ src/Message.cpp \
+ src/Connection.cpp \
+ src/TypeTranslator.h \
+ src/AssemblyInfo.cpp \
+ src/FailoverUpdates.h \
+ src/sessionreceiver/sessionreceiver.cs \
+ src/sessionreceiver/Properties/sessionreceiver-AssemblyInfo-template.cs \
+ src/sessionreceiver/qpid.snk \
+ src/sessionreceiver/org.apache.qpid.messaging.sessionreceiver.csproj \
+ src/Sender.h \
+ src/TypeTranslator.cpp \
+ src/Receiver.h \
+ src/Address.h \
+ src/Sender.cpp \
+ src/QpidTypeCheck.h \
+ src/resource1.h \
+ src/Duration.h \
+ src/Session.h \
+ src/Message.h \
+ src/ReadMe.txt \
+ src/Receiver.cpp \
+ src/Address.cpp \
+ src/app.rc \
+ src/Session.cpp \
+ src/org.apache.qpid.messaging.template.rc \
+ src/qpid.snk \
+ src/Connection.h \
+ src/QpidException.h \
+ src/QpidMarshal.h \
+ src/FailoverUpdates.cpp \
+ src/Duration.cpp \
+ ../../../src/windows/resources/qpid-icon.ico \
+ ../../../src/windows/resources/template-resource.rc \
+ ../../../src/windows/resources/version-resource.h
diff --git a/qpid/cpp/bindings/qpid/dotnet/ReadMe.txt b/qpid/cpp/bindings/qpid/dotnet/ReadMe.txt
new file mode 100644
index 0000000000..61f29bddc4
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/ReadMe.txt
@@ -0,0 +1,94 @@
+#
+# 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.
+#
+
+Qpid.cpp.bindings.qpid.dotnet binding package.
+
+1. Features
+===========
+
+A. This binding package provides a .NET Interop wrapper around the
+ Qpid C++ Messaging interface. It exposes the Messaging interface through
+ a series of managed code classes that may be used by any .NET language.
+
+B. A sessionreceiver assembly provides session message callback functionality.
+
+2. Prerequisites
+================
+
+A. From a fresh check-out of Qpid sources, execute an in-source CMake.
+ This command puts the CMake output files in the same directories
+ as the Qpid source files.
+
+ > cd cpp
+ > cmake -i
+
+
+B. Build the qpid-cpp solution.
+
+ > qpid-cpp.sln
+ Select Configuration Debug
+ Select Platform Win32
+ Compile the ALL_BUILD project
+
+3. Building the Dotnet Binding solution
+=======================================
+
+A. Open solution file cpp\bindings\qpid\dotnet\org.apache.qpid.messaging.sln
+ Select Configuration Debug
+ Select Platform x86
+ Compile the solution
+
+
+4. Running the examples
+=======================
+
+A. csharp.direct.receiver
+B. csharp.direct.sender
+
+C. csharp.map.receiver
+D. csharp.map.sender
+
+E. csharp.map.callback.receiver
+F. csharp.map.callback.sender
+
+G. csharp.example.server
+H. visualbasic.example.server
+I. csharp.example.client
+
+J. csharp.example.drain
+K. csharp.example.spout
+L. csharp.example.declare_queues
+
+M. csharp.example.helloworld
+N. powershell.example.helloworld
+
+
+5. Running the tests
+====================
+
+A. TBD
+
+
+6. Notes
+========
+
+A. Directory cpp\bindings\qpid\dotnet\bld holds a solution file and two
+ project files that are executed during automated winsdk builds.
+ These are not meant to be run interactively.
+
diff --git a/qpid/cpp/bindings/qpid/dotnet/configure-windows.ps1 b/qpid/cpp/bindings/qpid/dotnet/configure-windows.ps1
new file mode 100644
index 0000000000..34395911b9
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/configure-windows.ps1
@@ -0,0 +1,522 @@
+#
+# 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.
+#
+
+#
+# configure-windows.ps1
+# =====================
+#
+# This script configures a qpid\cpp developer build environment under Windows
+# to enable working with cpp\bindings\qpid\dotnet binding source code.
+#
+# * Supports 32-bit and/or 64-bit development platforms.
+#
+# * User chooses in-source or out-of-source build directories.
+#
+# - 'In-source' builds happen when CMake is run from directory qpid\cpp.
+# Hundreds of CMake-generated output files are placed in qpid\cpp\src.
+# These files go right on top of files that are part of the source tree
+# in qpid\cpp\src.
+# In-source builds support only one platform.
+# Choose only a 32-bit or a 64-bit platform but not both.
+#
+# - Out-of-source builds happen when the user chooses another directory
+# under qpid in which to run CMake. Out-of-source builds are required
+# in order to build both x86 and x64 targets using the same source tree.
+# For each build platform (32-bit x86 or Win32, or 64-bit x64) the user
+# specifies a build directory and a specific version of Boost.
+# Many platform/Boost-version directories may reside side by side.
+#
+# * User chooses to run CMake or not.
+#
+# - When a new build directory is created then the user is given the
+# option of running CMake in that directory. Running CMake is a
+# necessary step as CMake creates important source, solution, and
+# project files.
+#
+# - If a directory "looks like" is has already had CMake run in it
+# then this script skips running CMake again.
+#
+#
+# Prerequisites
+#
+# 1. Powershell must be installed.
+# 2. 32-bit and/or 64-bit Boost libraries must be installed in separate
+# directories. A user system may have any number of Boost library
+# versions installed on it as long as each may be referred to through
+# a separate BOOST_ROOT directory path.
+# 3. CMake 2.8 (or later) must be installed. The cmake\bin directory
+# must be in the user's path.
+# 4. Boost library specifications may or may not be in the user's path.
+# The script author recommeds not to have Boost in the path and only
+# allow the Boost path to be specified by generated command procedures.
+# 5. Visual Studio build environment must be installed.
+#
+#
+# Use case: Create a new build environment
+# ========================================
+#
+# Required Boost:
+# 32-bit library - C:\Boost
+# 64-bit library - D:\Boost_64
+#
+# Required Qpid checkout tree
+# C:\svn\qpid\...
+#
+# Run this script. It will ask for four directories:
+#
+# Needed info User clicks on or adds new
+# ---------------- --------------------------
+# 32-bit Boost C:\boost
+# 32-bit build dir C:\svn\qpid\build32
+# 64-bit Boost D:\Boost_64
+# 64-bit build dir C:\svn\qpid\build64
+#
+# In this example the build dirs are new. The script will prompt
+# asking if CMake is to run in the build directories. User chooses Yes.
+#
+# Now this script runs CMake twice, once each with the 32-bit and 64-bit
+# generators.
+# * This step creates qpid-cpp.sln and related project files.
+# C:\svn\qpid\build32\qpid-cpp.sln
+# C:\svn\qpid\build64\qpid-cpp.sln
+#
+# This script generates other scripts as follows:
+#
+# C:\svn\qpid\build32\start-devenv-messaging-x86-32bit.ps1
+# C:\svn\qpid\build32\start-devenv-messaging-x86-32bit.bat
+# C:\svn\qpid\build32\setenv-messaging-x86-32bit.bat
+#
+# C:\svn\qpid\build64\start-devenv-messaging-x64-64bit.ps1
+# C:\svn\qpid\build64\start-devenv-messaging-x64-64bit.bat
+# C:\svn\qpid\build64\setenv-messaging-x64-64bit.bat
+#
+# Next the user compiles solution qpid\build32\qpid-cpp.sln.
+#
+# Using the generated scripts:
+#
+# Case 1. Run an executable in 32-bit mode.
+# 1. Open a command prompt.
+# 2. > CD c:\svn\qpid\build32
+# 3. > CALL setenv-messaging-x86-32bit.bat
+# 4. > CD src\debug
+# 5. > run the chosen program
+#
+# Note: Step #3 adds Boost to the user's path. This script selects the
+# version of Boost to match the executables in src\debug.
+#
+# Case 2. Launch Visual Studio org.apache.qpid.messaging.sln in 64-bit mode.
+# 1. > CD c:\svn\qpid\build64
+# 2. > powershell start-devenv-messaging-x64-64bit.ps1
+# or
+# 1. Double-click c:\svn\qpid\build64\start-devenv-messaging-x64-64bit.bat
+#
+# Note: In this case the scripts set QPID_BUILD_ROOT to point to the out-of-
+# source directory used by qpid-cpp.sln. Also the scripts put Boost in
+# the path so that executables may run directly from Visual Studio.
+#
+
+Set-PSDebug -Trace 0
+Set-PSDebug -strict
+$ErrorActionPreference='Stop'
+
+#############################
+# global strings to be written to script files
+#
+$global:txtPath = '$env:PATH'
+$global:txtQR = '$env:QPID_BUILD_ROOT'
+$global:txtWH = 'Write-Host'
+
+
+#############################
+# Select-Folder
+# Return a folder or null
+#
+function Select-Folder ($message="Select a folder", $path=0)
+{
+ $shellApp = New-Object -comObject Shell.Application
+ $folder = $shellApp.BrowseForFolder(0, $message, 0, $path)
+ if ($folder -ne $null) {
+ $folder.self.Path
+ }
+}
+
+
+#############################
+# AskYesOrNo
+# Show modal dialog messagebox and return yes or no
+#
+function AskYesOrNo ($Question="No question?", $Title="No Title?")
+{
+ $dlg = [Windows.Forms.MessageBox]::Show($Question, $Title, `
+ [Windows.Forms.MessageBoxButtons]::YesNo, `
+ [Windows.Forms.MessageBoxIcon]::Question)
+
+ $result = $dlg -eq [Windows.Forms.DialogResult]::Yes
+
+ $result
+}
+
+
+#############################
+# SanityCheckBoostPath
+# A path is a "boost path" if it contains
+# both lib and include subdirectories.
+#
+function SanityCheckBoostPath ($path=0)
+{
+ $result = $true
+ $displayPath = ""
+
+ if ($path -ne $null) {
+ $displayPath = $path
+
+ $toTest = ('include', 'lib')
+ foreach ($pattern in $toTest) {
+ $target = Join-Path $path $pattern
+ if (!(Test-Path -path $target)) {
+ $result = $false
+ }
+ }
+ } else {
+ $result = $false
+ }
+
+ if (! $result) {
+ Write-Host "The path ""$displayPath"" does not appear to be a Boost root path."
+ }
+ $result
+}
+
+
+#############################
+# SanityCheckBuildPath
+# A path is a "build path" if it contains
+# various subdirectories.
+#
+function SanityCheckBuildPath ($path=0)
+{
+ $result = $true
+ $displayPath = ""
+ if ($path -ne $null) {
+ $displayPath = $path
+
+ $toTest = ('CMakeFiles', 'docs', 'etc', 'examples', 'include',
+ 'managementgen', 'src')
+ foreach ($pattern in $toTest) {
+ $target = Join-Path $path $pattern
+ if (!(Test-Path -path $target)) {
+ $result = $false
+ }
+ }
+ } else {
+ $result = $false
+ }
+ if (! $result) {
+ Write-Host "The path ""$displayPath"" does not appear to be a Qpid C++ build root path."
+ }
+ $result
+}
+
+
+#############################
+# WriteDotnetBindingSlnLauncherPs1
+# Write a powershell script that sets up the environment
+# and then launches Visual Studio solution file.
+#
+function WriteDotnetBindingSlnLauncherPs1
+{
+ param
+ (
+ [string] $slnName,
+ [string] $boostRoot,
+ [string] $buildRoot,
+ [string] $cppDir,
+ [string] $vsPlatform,
+ [string] $nBits,
+ [string] $outfileName
+ )
+
+ $out = @("#
+# Launch $slnName in Visual Studio $vsPlatform ($nBits-bit) environment
+#
+$global:txtPath = ""$boostRoot\lib;$global:txtPath""
+$global:txtQR = ""$buildRoot""
+$global:txtWH ""Launch $slnName in Visual Studio $vsPlatform ($nBits-bit) environment.""
+$cppDir\bindings\qpid\dotnet\$slnName
+")
+ Write-Host " $buildRoot\$outfileName"
+ $out | Out-File "$buildRoot\$outfileName" -encoding ASCII
+}
+
+
+#############################
+# WriteDotnetBindingSlnLauncherBat
+# Write a batch file that
+# launches a powershell script.
+#
+function WriteDotnetBindingSlnLauncherBat
+{
+ param
+ (
+ [string] $slnName,
+ [string] $buildRoot,
+ [string] $vsPlatform,
+ [string] $nBits,
+ [string] $psScriptName,
+ [string] $outfileName
+ )
+
+ $out = @("@ECHO OFF
+REM
+REM Launch $slnName in Visual Studio $vsPlatform ($nBits-bit) environment
+REM
+ECHO Launch $slnName in Visual Studio $vsPlatform ($nBits-bit) environment
+powershell $buildRoot\$psScriptName
+")
+ Write-Host " $buildRoot\$outfileName"
+ $out | Out-File "$buildRoot\$outfileName" -encoding ASCII
+}
+
+
+#############################
+# WriteDotnetBindingEnvSetupBat
+# Write a batch file that sets the desired environment into
+# the user's current environment settings.
+#
+function WriteDotnetBindingEnvSetupBat
+{
+ param
+ (
+ [string] $slnName,
+ [string] $boostRoot,
+ [string] $buildRoot,
+ [string] $vsPlatform,
+ [string] $nBits,
+ [string] $outfileName
+ )
+
+ $out = @("@ECHO OFF
+REM
+REM Call this command procedure from a command prompt to set up a $vsPlatform ($nBits-bit)
+REM $slnName environment
+REM
+REM > call $outfileName
+REM >
+REM
+ECHO %PATH% | FINDSTR /I boost > NUL
+IF %ERRORLEVEL% EQU 0 ECHO WARNING: Boost is defined in your path multiple times!
+SET PATH=$boostRoot\lib;%PATH%
+SET QPID_BUILD_ROOT=$buildRoot
+ECHO Environment set for $slnName $vsPlatform $nBits-bit development.
+")
+ Write-Host " $buildRoot\$outfileName"
+ $out | Out-File "$buildRoot\$outfileName" -encoding ASCII
+}
+
+
+#############################
+# Main
+#############################
+#
+# curDir is qpid\cpp\bindings\qpid\dotnet.
+#
+[string] $curDir = Split-Path -parent $MyInvocation.MyCommand.Definition
+[string] $projRoot = Resolve-Path (Join-Path $curDir "..\..\..\..")
+[string] $cppDir = Resolve-Path (Join-Path $curDir "..\..\..")
+
+[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
+
+#############################
+# User dialog to get optional 32-bit boost and build paths
+#
+$boost32 = Select-Folder -message 'Select 32-bit BOOST_ROOT folder. Press CANCEL to skip 32-bit processing.'
+
+$defined32 = ($boost32 -ne $null) -and ($boost32 -ne '')
+if ($defined32) {
+ $found = SanityCheckBoostPath $boost32
+ if (! $found) {
+ exit
+ }
+}
+
+$make32 = $false
+if ($defined32) {
+
+ $build32 = Select-Folder -message 'Select 32-bit QPID_BUILD_ROOT folder.' -path $projRoot
+
+ $found = ($build32 -ne $null) -and ($build32 -ne '')
+ if (! $found) {
+ Write-Host "You must select a build root folder for 32-bit builds"
+ exit
+ }
+ $found = SanityCheckBuildPath $build32
+ if ($found) {
+ Write-Host "Directory ""$build32"" is already set by CMake. CMake will not be re-run."
+ } else {
+ $make32 = AskYesOrNo "Run CMake in $build32 ?" "32-Bit Builds - Choose CMake run or not"
+ }
+}
+
+#############################
+# User dialog to get optional 64-bit boost and build paths
+#
+$boost64 = Select-Folder -message 'Select 64-bit BOOST_ROOT folder. Press CANCEL to skip 64-bit processing.'
+
+$defined64 = ($boost64 -ne $null) -and ($boost64 -ne '')
+if ($defined64) {
+ $found = SanityCheckBoostPath $boost64
+ if (! $found) {
+ exit
+ }
+}
+
+$make64 = $false
+if ($defined64) {
+ $build64 = Select-Folder -message 'Select 64-bit QPID_BUILD_ROOT folder.' -path $projRoot
+
+ $found = ($build64 -ne $null) -and ($build64 -ne '')
+ if (! $found) {
+ Write-Host "You must select a build root folder for 64-bit builds"
+ exit
+ }
+ $found = SanityCheckBuildPath $build64
+ if ($found) {
+ Write-Host "Directory ""$build64"" is already set by CMake. CMake will not be re-run."
+ } else {
+ $make64 = AskYesOrNo "Run CMake in $build64 ?" "64-Bit Builds - Choose CMake run or not"
+ }
+}
+
+#############################
+# Conditionally run CMake
+#
+# 32-bit X86
+#
+if ($make32) {
+ $env:BOOST_ROOT = "$boost32"
+ cd "$build32"
+ Write-Host "Running 32-bit CMake in $build32 ..."
+ CMake -G "Visual Studio 9 2008" "-DCMAKE_INSTALL_PREFIX=install_x86" $cppDir
+} else {
+ Write-Host "Skipped 32-bit CMake."
+}
+
+#
+# 64-bit X64
+#
+if ($make64) {
+ $env:BOOST_ROOT = "$boost64"
+ cd "$build64"
+ Write-Host "Running 64-bit CMake in $build64"
+ CMake -G "Visual Studio 9 2008 Win64" "-DCMAKE_INSTALL_PREFIX=install_x64" $cppDir
+} else {
+ Write-Host "Skipped 64-bit CMake."
+}
+
+#############################
+# Emit scripts
+#
+# 32-bit scripts
+#
+if ($defined32) {
+
+ Write-Host "Writing 32-bit scripts..."
+
+ ###########
+ # Powershell script to launch org.apache.qpid.messaging.sln
+ #
+ WriteDotnetBindingSlnLauncherPs1 -slnName "org.apache.qpid.messaging.sln" `
+ -boostRoot "$boost32" `
+ -buildRoot "$build32" `
+ -cppDir "$cppDir" `
+ -vsPlatform "x86" `
+ -nBits "32" `
+ -outfileName "start-devenv-messaging-x86-32bit.ps1"
+
+
+ ###########
+ # Batch script (that you doubleclick) to launch powershell script
+ # that launches org.apache.qpid.messaging.sln.
+ #
+ WriteDotnetBindingSlnLauncherBat -slnName "org.apache.qpid.messaging.sln" `
+ -buildRoot "$build32" `
+ -vsPlatform "x86" `
+ -nBits "32" `
+ -psScriptName "start-devenv-messaging-x86-32bit.ps1" `
+ -outfileName "start-devenv-messaging-x86-32bit.bat"
+
+ ###########
+ # Batch script (that you CALL from a command prompt)
+ # to establish the org.apache.qpid.messaging.sln build environment.
+ #
+ WriteDotnetBindingEnvSetupBat -slnName "org.apache.qpid.messaging.sln" `
+ -boostRoot "$boost32" `
+ -buildRoot "$build32" `
+ -vsPlatform "x86" `
+ -nBits "32" `
+ -outfileName "setenv-messaging-x86-32bit.bat"
+
+} else {
+ Write-Host "Skipped writing 32-bit scripts."
+}
+
+#############################
+# 64-bit scripts
+#
+if ($defined64) {
+
+ Write-Host "Writing 64-bit scripts..."
+
+ ###########
+ # Powershell script to launch org.apache.qpid.messaging.sln
+ #
+ WriteDotnetBindingSlnLauncherPs1 -slnName "org.apache.qpid.messaging.sln" `
+ -boostRoot "$boost64" `
+ -buildRoot "$build64" `
+ -cppDir "$cppDir" `
+ -vsPlatform "x64" `
+ -nBits "64" `
+ -outfileName "start-devenv-messaging-x64-64bit.ps1"
+
+
+ ###########
+ # Batch script (that you doubleclick) to launch powershell script
+ # that launches org.apache.qpid.messaging.sln.
+ #
+ WriteDotnetBindingSlnLauncherBat -slnName "org.apache.qpid.messaging.sln" `
+ -buildRoot "$build64" `
+ -vsPlatform "x64" `
+ -nBits "64" `
+ -psScriptName "start-devenv-messaging-x64-64bit.ps1" `
+ -outfileName "start-devenv-messaging-x64-64bit.bat"
+
+ ###########
+ # Batch script (that you CALL from a command prompt)
+ # to establish the org.apache.qpid.messaging.sln build environment.
+ #
+ WriteDotnetBindingEnvSetupBat -slnName "org.apache.qpid.messaging.sln" `
+ -boostRoot "$boost64" `
+ -buildRoot "$build64" `
+ -vsPlatform "x64" `
+ -nBits "64" `
+ -outfileName "setenv-messaging-x64-64bit.bat"
+
+} else {
+ Write-Host "Skipped writing 64-bit scripts."
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..abe35cf053
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/Properties/AssemblyInfo.cs
@@ -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 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("csharp.direct.receiver")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.direct.receiver")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[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("c60b17ab-a82c-4edf-ba95-1e88bd4c3e75")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.cs
new file mode 100644
index 0000000000..592a05ab29
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.cs
@@ -0,0 +1,79 @@
+/*
+ *
+ * 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 Org.Apache.Qpid.Messaging;
+
+namespace CSharpDirect
+{
+ class Program
+ {
+ // Direct receiver example
+ //
+ // Receive 10 messages from localhost:5672, amq.direct/key
+ // Messages are assumed to be printable strings.
+ //
+ static int Main(string[] args)
+ {
+ String host = "localhost:5672";
+ String addr = "amq.direct/key";
+ Int32 nMsg = 10;
+
+ if (args.Length > 0)
+ host = args[0];
+ if (args.Length > 1)
+ addr = args[1];
+ if (args.Length > 2)
+ nMsg = Convert.ToInt32(args[2]);
+
+ Console.WriteLine("csharp.direct.receiver");
+ Console.WriteLine("host : {0}", host);
+ Console.WriteLine("addr : {0}", addr);
+ Console.WriteLine("nMsg : {0}", nMsg);
+ Console.WriteLine();
+
+ Connection connection = null;
+ try
+ {
+ connection = new Connection(host);
+ connection.Open();
+ if (!connection.IsOpen) {
+ Console.WriteLine("Failed to open connection to host : {0}", host);
+ } else {
+ Session session = connection.CreateSession();
+ Receiver receiver = session.CreateReceiver(addr);
+ Message message = new Message("");
+ for (int i = 0; i < nMsg; i++) {
+ Message msg2 = receiver.Fetch(DurationConstants.FORVER);
+ Console.WriteLine("Rcvd msg {0} : {1}", i, msg2.GetContent());
+ }
+ connection.Close();
+ return 0;
+ }
+ } catch (Exception e) {
+ Console.WriteLine("Exception {0}.", e);
+ if (null != connection)
+ connection.Close();
+ }
+ return 1;
+ }
+ }
+} \ No newline at end of file
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.csproj
new file mode 100644
index 0000000000..34d79afa91
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{52F880E7-D677-4C91-8516-D679CE0F46A8}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.direct.receiver</RootNamespace>
+ <AssemblyName>csharp.direct.receiver</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.direct.receiver.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.direct.sender/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..18502a0666
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/Properties/AssemblyInfo.cs
@@ -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 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("csharp.direct.sender")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.direct.sender")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[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("19ce67e4-db90-4480-88c4-3721f47634c7")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.cs
new file mode 100644
index 0000000000..a0ac742a45
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.cs
@@ -0,0 +1,80 @@
+/*
+ *
+ * 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 Org.Apache.Qpid.Messaging;
+
+namespace csharp.direct.sender
+{
+ class Program
+ {
+ // Direct sender example
+ //
+ // Send 10 messages from localhost:5672, amq.direct/key
+ // Messages are assumed to be printable strings.
+ //
+ static int Main(string[] args)
+ {
+ String host = "localhost:5672";
+ String addr = "amq.direct/key";
+ Int32 nMsg = 10;
+
+ if (args.Length > 0)
+ host = args[0];
+ if (args.Length > 1)
+ addr = args[1];
+ if (args.Length > 2)
+ nMsg = Convert.ToInt32(args[2]);
+
+ Console.WriteLine("csharp.direct.sender");
+ Console.WriteLine("host : {0}", host);
+ Console.WriteLine("addr : {0}", addr);
+ Console.WriteLine("nMsg : {0}", nMsg);
+ Console.WriteLine();
+
+ Connection connection = null;
+ try
+ {
+ connection = new Connection(host);
+ connection.Open();
+
+ if (!connection.IsOpen) {
+ Console.WriteLine("Failed to open connection to host : {0}", host);
+ } else {
+ Session session = connection.CreateSession();
+ Sender sender = session.CreateSender(addr);
+ for (int i = 0; i < nMsg; i++) {
+ Message message = new Message(String.Format("Test Message {0}", i));
+ sender.Send(message);
+ }
+ session.Sync();
+ connection.Close();
+ return 0;
+ }
+ } catch (Exception e) {
+ Console.WriteLine("Exception {0}.", e);
+ if (null != connection)
+ connection.Close();
+ }
+ return 1;
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.csproj
new file mode 100644
index 0000000000..a8cd07da74
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.direct.sender</RootNamespace>
+ <AssemblyName>csharp.direct.sender</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.direct.sender.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.example.client/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..eddb759ef1
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/Properties/AssemblyInfo.cs
@@ -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 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("csharp.example.client")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.example.client")]
+[assembly: AssemblyCopyright("Copyright ? 2010")]
+[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("c60b17ab-a82c-4edf-ba95-1e88bd4c3e75")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/csharp.example.client.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/csharp.example.client.cs
new file mode 100644
index 0000000000..19a5267297
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/csharp.example.client.cs
@@ -0,0 +1,75 @@
+/*
+ *
+ * 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 Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging.Examples {
+ class Client {
+ static int Main(string[] args) {
+ String url = "amqp:tcp:127.0.0.1:5672";
+ String connectionOptions = "";
+
+ if (args.Length > 0)
+ url = args[0];
+ if (args.Length > 1)
+ connectionOptions = args[1];
+
+ Connection connection = new Connection(url, connectionOptions);
+ try
+ {
+ connection.Open();
+
+ Session session = connection.CreateSession();
+
+ Sender sender = session.CreateSender("service_queue");
+
+ Address responseQueue = new Address("#response-queue; {create:always, delete:always}");
+ Receiver receiver = session.CreateReceiver(responseQueue);
+
+ String[] s = new String[] {
+ "Twas brillig, and the slithy toves",
+ "Did gire and gymble in the wabe.",
+ "All mimsy were the borogroves,",
+ "And the mome raths outgrabe."
+ };
+
+ Message request = new Message("");
+ request.ReplyTo = responseQueue;
+
+ for (int i = 0; i < s.Length; i++) {
+ request.SetContent(s[i]);
+ sender.Send(request);
+ Message response = receiver.Fetch();
+ Console.WriteLine("{0} -> {1}", request.GetContent(), response.GetContent());
+ }
+ connection.Close();
+ return 0;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Exception {0}.", e);
+ connection.Close();
+ }
+ return 1;
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/csharp.example.client.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/csharp.example.client.csproj
new file mode 100644
index 0000000000..537efa8658
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.client/csharp.example.client.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0DE01712-C2D1-4CA4-B42C-5856456A8696}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.client</RootNamespace>
+ <AssemblyName>csharp.example.client</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.example.client.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.example.declare_queues/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..4e065803f6
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/Properties/AssemblyInfo.cs
@@ -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 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("csharp.example.declare_queues")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.example.declare_queues")]
+[assembly: AssemblyCopyright("Copyright ? 2010")]
+[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("c60b17ab-a82c-4edf-ba95-1e88bd4c3e75")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/csharp.example.declare_queues.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/csharp.example.declare_queues.cs
new file mode 100644
index 0000000000..06267bf719
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/csharp.example.declare_queues.cs
@@ -0,0 +1,60 @@
+/*
+ *
+ * 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 Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging.Examples {
+ class DeclareQueues {
+ //
+ // Sample invocation: csharp.example.declare_queues.exe localhost:5672 my-queue
+ //
+ static int Main(string[] args) {
+ string addr = "localhost:5672";
+ string queue = "my-queue";
+
+ if (args.Length > 0)
+ addr = args[0];
+ if (args.Length > 1)
+ queue = args[1];
+
+ Connection connection = null;
+ try
+ {
+ connection = new Connection(addr);
+ connection.Open();
+ Session session = connection.CreateSession();
+ String queueName = queue + "; {create: always}";
+ Sender sender = session.CreateSender(queueName);
+ session.Close();
+ connection.Close();
+ return 0;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Exception {0}.", e);
+ if (null != connection)
+ connection.Close();
+ }
+ return 1;
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj
new file mode 100644
index 0000000000..a458e706ad
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E31B349C-830C-4583-8BD9-30DA4398349F}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.declare_queues</RootNamespace>
+ <AssemblyName>csharp.example.declare_queues</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.example.declare_queues.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.example.drain/Options.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/Options.cs
new file mode 100644
index 0000000000..6059f76442
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/Options.cs
@@ -0,0 +1,175 @@
+/*
+* 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.
+*/
+
+namespace Org.Apache.Qpid.Messaging.Examples
+{
+ using System;
+
+ public class Options
+ {
+ private string url;
+ private string address;
+ private UInt64 timeout;
+ private int count;
+ private string id;
+ private string replyTo;
+ //private string[] properties;
+ //private string[] entries;
+ private string content;
+ private string connectionOptions;
+ private bool forever;
+
+ public Options(string[] args)
+ {
+ this.url = "amqp:tcp:127.0.0.1:5672";
+ this.address = "";
+ this.timeout = 0;
+ this.count = 1;
+ this.id = "";
+ this.replyTo = "";
+ this.content = "";
+ this.connectionOptions = "";
+ this.forever = false;
+ Parse(args);
+ }
+
+ private void Parse(string[] args)
+ {
+ int argCount = args.Length;
+ int current = 0;
+
+ while ((current + 1) < argCount)
+ {
+ string arg = args[current];
+ if (arg == "--broker")
+ {
+ this.url = args[++current];
+ }
+ else if (arg == "--address")
+ {
+ this.address = args[++current];
+ }
+ else if (arg == "--timeout")
+ {
+ arg = args[++current];
+ UInt64 i = UInt64.Parse(arg);
+ if (i >= 0)
+ {
+ this.timeout = i;
+ }
+ }
+ else if (arg == "--count")
+ {
+ arg = args[++current];
+ int i = int.Parse(arg);
+ if (i >= 0)
+ {
+ this.count = i;
+ }
+ }
+ else if (arg == "--id")
+ {
+ this.id = args[++current];
+ }
+ else if (arg == "--reply-to")
+ {
+ this.replyTo = args[++current];
+ }
+ else if (arg == "--properties")
+ {
+ throw new ArgumentException("TODO: properties not implemented");
+ }
+ else if (arg == "--entries")
+ {
+ throw new ArgumentException("TODO: entries not implemented");
+ }
+ else if (arg == "--content")
+ {
+ this.content = args[++current];
+ }
+ else if (arg == "--connection-options")
+ {
+ this.connectionOptions = args[++current];
+ }
+ else if (arg == "--forever")
+ {
+ this.forever = true;
+ }
+ else
+ {
+ throw new ArgumentException(String.Format("unknown argument \"{0}\"", arg));
+ }
+
+ current++;
+ }
+
+ if (current == argCount)
+ {
+ throw new ArgumentException("missing argument: address");
+ }
+
+ address = args[current];
+ }
+
+ public string Url
+ {
+ get { return this.url; }
+ }
+
+ public string Address
+ {
+ get { return this.address; }
+ }
+
+ public UInt64 Timeout
+ {
+ get { return this.timeout; }
+ }
+
+ public int Count
+ {
+ get { return this.count; }
+ }
+
+ public string Id
+ {
+ get { return this.id; }
+ }
+
+ public string ReplyTo
+ {
+ get { return this.replyTo; }
+ }
+
+ public string Content
+ {
+ get { return content; }
+ }
+
+ public string ConnectionOptions
+ {
+ get { return this.connectionOptions; }
+ }
+
+ public bool Forever
+ {
+ get { return this.forever; }
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..d949dde644
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/Properties/AssemblyInfo.cs
@@ -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 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("csharp.example.drain")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.example.drain")]
+[assembly: AssemblyCopyright("Copyright ? 2010")]
+[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("c60b17ab-a82c-4edf-ba95-1e88bd4c3e75")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs
new file mode 100644
index 0000000000..da8218bbf7
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.cs
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging.Examples {
+ class Drain {
+ //
+ // Sample invocation: csharp.example.drain.exe --broker localhost:5672 --timeout 30 my-queue
+ //
+ static int Main(string[] args) {
+ Options options = new Options(args);
+
+ Connection connection = null;
+ try
+ {
+ connection = new Connection(options.Url, options.ConnectionOptions);
+ connection.Open();
+ Session session = connection.CreateSession();
+ Receiver receiver = session.CreateReceiver(options.Address);
+ Duration timeout = options.Forever ?
+ DurationConstants.FORVER :
+ DurationConstants.SECOND * options.Timeout;
+ Message message = new Message();
+
+ while (receiver.Fetch(ref message, timeout))
+ {
+ Dictionary<string, object> properties = new Dictionary<string, object>();
+ properties = message.Properties;
+ Console.Write("Message(properties={0}, content='",
+ message.MapAsString(properties));
+
+ if ("amqp/map" == message.ContentType)
+ {
+ Dictionary<string, object> content = new Dictionary<string, object>();
+ message.GetContent(content);
+ Console.Write(message.MapAsString(content));
+ }
+ else if ("amqp/list" == message.ContentType)
+ {
+ Collection<object> content = new Collection<object>();
+ message.GetContent(content);
+ Console.Write(message.ListAsString(content));
+ }
+ else
+ {
+ Console.Write(message.GetContent());
+ }
+ Console.WriteLine("')");
+ session.Acknowledge();
+ }
+ receiver.Close();
+ session.Close();
+ connection.Close();
+ return 0;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Exception {0}.", e);
+ if (null != connection)
+ connection.Close();
+ }
+ return 1;
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.csproj
new file mode 100644
index 0000000000..75f419d0c5
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.drain/csharp.example.drain.csproj
@@ -0,0 +1,103 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C43DEB69-8088-420B-B0CA-C699535E6D08}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.drain</RootNamespace>
+ <AssemblyName>csharp.example.drain</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.example.drain.cs" />
+ <Compile Include="Options.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..17bbd842b0
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs
@@ -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 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("csharp.example.helloworld")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.example.helloworld")]
+[assembly: AssemblyCopyright("Copyright ? 2010")]
+[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("19ce67e4-db90-4480-88c4-3721f47634c7")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs
new file mode 100644
index 0000000000..336970a3ba
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.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;
+using Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging {
+ class Program {
+ static void Main(string[] args) {
+ String broker = args.Length > 0 ? args[0] : "localhost:5672";
+ String address = args.Length > 1 ? args[1] : "amq.topic";
+
+ Connection connection = null;
+ try {
+ connection = new Connection(broker);
+ connection.Open();
+ Session session = connection.CreateSession();
+
+ Receiver receiver = session.CreateReceiver(address);
+ Sender sender = session.CreateSender(address);
+
+ sender.Send(new Message("Hello world!"));
+
+ Message message = new Message();
+ message = receiver.Fetch(DurationConstants.SECOND * 1);
+ Console.WriteLine("{0}", message.GetContent());
+ session.Acknowledge();
+
+ connection.Close();
+ } catch (Exception e) {
+ Console.WriteLine("Exception {0}.", e);
+ if (null != connection)
+ connection.Close();
+ }
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj
new file mode 100644
index 0000000000..0307bea754
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8CC1C265-0507-44A3-9483-8FAF48513F4D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.helloworld</RootNamespace>
+ <AssemblyName>csharp.example.helloworld</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.example.helloworld.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.example.server/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..7f0fd52997
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/Properties/AssemblyInfo.cs
@@ -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 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("csharp.example.server")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.example.server")]
+[assembly: AssemblyCopyright("Copyright ? 2010")]
+[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("c60b17ab-a82c-4edf-ba95-1e88bd4c3e75")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/csharp.example.server.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/csharp.example.server.cs
new file mode 100644
index 0000000000..1d93649195
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/csharp.example.server.cs
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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 Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging.Examples {
+ class Server {
+ static int Main(string[] args) {
+ string url = "amqp:tcp:127.0.0.1:5672";
+ string connectionOptions = "";
+
+ if (args.Length > 0)
+ url = args[0];
+ // address args[1] is not used in this example
+ if (args.Length > 2)
+ connectionOptions = args[2];
+
+ try {
+ Connection connection = new Connection(url, connectionOptions);
+ connection.Open();
+ Session session = connection.CreateSession();
+ Receiver receiver = session.CreateReceiver("service_queue; {create: always}");
+
+ while (true) {
+ Message request = receiver.Fetch();
+ Address address = request.ReplyTo;
+
+ if (null != address) {
+ Sender sender = session.CreateSender(address);
+ String s = request.GetContent();
+ Message response = new Message(s.ToUpper());
+ sender.Send(response);
+ Console.WriteLine("Processed request: {0} -> {1}", request.GetContent(), response.GetContent());
+ session.Acknowledge();
+ } else {
+ Console.WriteLine("Error: no reply address specified for request: {0}", request.GetContent());
+ session.Reject(request);
+ }
+ }
+ // connection.Close(); // unreachable in this example
+ } catch (Exception e) {
+ Console.WriteLine("Exception {0}.", e);
+ }
+ return 1;
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/csharp.example.server.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/csharp.example.server.csproj
new file mode 100644
index 0000000000..d377018a30
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.server/csharp.example.server.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{090A081D-E8B5-4949-AA43-EE182B7101E3}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.server</RootNamespace>
+ <AssemblyName>csharp.example.server</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.example.server.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.example.spout/Options.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/Options.cs
new file mode 100644
index 0000000000..9ceb11e520
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/Options.cs
@@ -0,0 +1,185 @@
+/*
+* 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.
+*/
+
+namespace Org.Apache.Qpid.Messaging.Examples
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+
+ public class Options
+ {
+ private string url;
+ private string address;
+ private int timeout;
+ private int count;
+ private string id;
+ private string replyTo;
+ private Collection<string> properties;
+ private Collection<string> entries;
+ private string content;
+ private string connectionOptions;
+ private bool forever;
+
+ public Options(string[] args)
+ {
+ this.url = "amqp:tcp:127.0.0.1:5672";
+ this.address = "";
+ this.timeout = 0;
+ this.count = 1;
+ this.id = "";
+ this.replyTo = "";
+ properties = new Collection<string>();
+ entries = new Collection<string>();
+ this.content = "";
+ this.connectionOptions = "";
+ this.forever = false;
+ Parse(args);
+ }
+
+ private void Parse(string[] args)
+ {
+ int argCount = args.Length;
+ int current = 0;
+
+ while ((current + 1) < argCount)
+ {
+ string arg = args[current];
+ if (arg == "--broker")
+ {
+ this.url = args[++current];
+ }
+ else if (arg == "--address")
+ {
+ this.address = args[++current];
+ }
+ else if (arg == "--timeout")
+ {
+ arg = args[++current];
+ int i = int.Parse(arg);
+ if (i >= 0)
+ {
+ this.timeout = i;
+ }
+ }
+ else if (arg == "--count")
+ {
+ arg = args[++current];
+ int i = int.Parse(arg);
+ if (i >= 0)
+ {
+ this.count = i;
+ }
+ }
+ else if (arg == "--id")
+ {
+ this.id = args[++current];
+ }
+ else if (arg == "--reply-to")
+ {
+ this.replyTo = args[++current];
+ }
+ else if (arg == "--properties")
+ {
+ this.properties.Add(args[++current]);
+ }
+ else if (arg == "--map")
+ {
+ this.entries.Add(args[++current]);
+ }
+ else if (arg == "--content")
+ {
+ this.content = args[++current];
+ }
+ else if (arg == "--connection-options")
+ {
+ this.connectionOptions = args[++current];
+ }
+ else if (arg == "--forever")
+ {
+ this.forever = true;
+ }
+ else
+ {
+ throw new ArgumentException(String.Format("unknown argument \"{0}\"", arg));
+ }
+
+ current++;
+ }
+
+ if (current == argCount)
+ {
+ throw new ArgumentException("missing argument: address");
+ }
+
+ address = args[current];
+ }
+
+ public string Url
+ {
+ get { return this.url; }
+ }
+
+ public string Address
+ {
+ get { return this.address; }
+ }
+
+ public int Timeout
+ {
+ get { return this.timeout; }
+ }
+
+ public int Count
+ {
+ get { return this.count; }
+ }
+
+ public string Id
+ {
+ get { return this.id; }
+ }
+
+ public string ReplyTo
+ {
+ get { return this.replyTo; }
+ }
+
+ public Collection<string> Entries
+ {
+ get { return this.entries; }
+ }
+
+ public string Content
+ {
+ get { return content; }
+ }
+
+ public string ConnectionOptions
+ {
+ get { return this.connectionOptions; }
+ }
+
+ public bool Forever
+ {
+ get { return this.forever; }
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..f07c780571
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/Properties/AssemblyInfo.cs
@@ -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 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("csharp.example.spout")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.example.spout")]
+[assembly: AssemblyCopyright("Copyright ? 2010")]
+[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("c60b17ab-a82c-4edf-ba95-1e88bd4c3e75")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/csharp.example.spout.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/csharp.example.spout.cs
new file mode 100644
index 0000000000..531abadd4c
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/csharp.example.spout.cs
@@ -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.
+ *
+ */
+
+using System;
+using System.Diagnostics;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging.Examples {
+ class Spout {
+ //
+ // Sample invocation: csharp.example.spout.exe --broker localhost:5672 my-queue
+ //
+ static bool NameVal(string In, out string nameOut, out string valueOut)
+ {
+ int pos = In.IndexOf("=");
+ if (-1 == pos) {
+ nameOut = In;
+ valueOut = "";
+ return false;
+ } else {
+ nameOut = In.Substring(0, pos);
+ if (pos + 1 < In.Length) {
+ valueOut = In.Substring(pos + 1);
+ return true;
+ } else {
+ valueOut = "";
+ return false;
+ }
+ }
+ }
+
+ static void SetEntries(Collection<string> entries, Dictionary<string, object> content)
+ {
+ foreach (String entry in entries)
+ {
+ string name = "";
+ string value = "";
+ if (NameVal(entry, out name, out value))
+ content.Add(name, value);
+ else
+ content.Add(name, "");
+ }
+ }
+
+ static int Main(string[] args) {
+ Options options = new Options(args);
+
+ Connection connection = null;
+ try
+ {
+ connection = new Connection(options.Url, options.ConnectionOptions);
+ connection.Open();
+ Session session = connection.CreateSession();
+ Sender sender = session.CreateSender(options.Address);
+ Message message;
+ if (options.Entries.Count > 0)
+ {
+ Dictionary<string, object> content = new Dictionary<string, object>();
+ SetEntries(options.Entries, content);
+ message = new Message(content);
+ }
+ else
+ {
+ message = new Message(options.Content);
+ message.ContentType = "text/plain";
+ }
+ Address replyToAddr = new Address(options.ReplyTo);
+
+ Stopwatch stopwatch = new Stopwatch();
+ TimeSpan timespan = new TimeSpan(0,0,options.Timeout);
+ stopwatch.Start();
+ for (int count = 0;
+ (0 == options.Count || count < options.Count) &&
+ (0 == options.Timeout || stopwatch.Elapsed <= timespan);
+ count++)
+ {
+ if ("" != options.ReplyTo) message.ReplyTo = replyToAddr;
+ string id = options.Id ;
+ if ("" == id) {
+ Guid g = Guid.NewGuid();
+ id = g.ToString();
+ }
+ string spoutid = id + ":" + count;
+ message.SetProperty("spout-id", spoutid);
+ sender.Send(message);
+ }
+ session.Sync();
+ connection.Close();
+ return 0;
+ } catch (Exception e) {
+ Console.WriteLine("Exception {0}.", e);
+ if (null != connection)
+ connection.Close();
+ }
+ return 1;
+ }
+ }
+}
+
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/csharp.example.spout.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/csharp.example.spout.csproj
new file mode 100644
index 0000000000..c0e4d7fe1f
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.example.spout/csharp.example.spout.csproj
@@ -0,0 +1,106 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{EB36626D-36C2-41B3-B65E-762BAF27F137}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.spout</RootNamespace>
+ <AssemblyName>csharp.example.spout</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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="csharp.example.spout.cs" />
+ <Compile Include="Options.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.map.callback.receiver/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..a87f92ccdf
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/Properties/AssemblyInfo.cs
@@ -0,0 +1,54 @@
+/*
+* 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("csharp.map.callback.receiver")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.map.callback.receiver")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[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("002049f9-41c5-420f-9ff6-45bb652dded6")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
new file mode 100644
index 0000000000..b1ba949e07
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.cs
@@ -0,0 +1,286 @@
+/*
+ *
+ * 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 System.Collections.ObjectModel;
+using Org.Apache.Qpid.Messaging;
+using Org.Apache.Qpid.Messaging.SessionReceiver;
+
+namespace Org.Apache.Qpid.Messaging.Examples
+{
+ /// <summary>
+ /// A class with functions to display structured messages.
+ /// </summary>
+ public static class MessageViewer
+ {
+ /// <summary>
+ /// A Function to display a amqp/map message packaged as a Dictionary.
+ /// </summary>
+ /// <param name="dict">The AMQP map</param>
+ /// <param name="level">Nested depth</param>
+ public static void ShowDictionary(Dictionary<string, object> dict, int level)
+ {
+ foreach (KeyValuePair<string, object> kvp in dict)
+ {
+ Console.Write(new string(' ', level * 4));
+
+ if (QpidTypeCheck.ObjectIsMap(kvp.Value))
+ {
+ Console.WriteLine("Key: {0}, Value: Dictionary", kvp.Key);
+ ShowDictionary((Dictionary<string, object>)kvp.Value, level + 1);
+ }
+ else if (QpidTypeCheck.ObjectIsList(kvp.Value))
+ {
+ Console.WriteLine("Key: {0}, Value: List", kvp.Key);
+ ShowList((Collection<object>)kvp.Value, level + 1);
+ }
+ else
+ Console.WriteLine("Key: {0}, Value: {1}, Type: {2}",
+ kvp.Key, kvp.Value, kvp.Value.GetType().ToString());
+ }
+ }
+
+ /// <summary>
+ /// A function to display a ampq/list message packaged as a List.
+ /// </summary>
+ /// <param name="list">The AMQP list</param>
+ /// <param name="level">Nested depth</param>
+ public static void ShowList(Collection<object> list, int level)
+ {
+ foreach (object obj in list)
+ {
+ Console.Write(new string(' ', level * 4));
+
+ if (QpidTypeCheck.ObjectIsMap(obj))
+ {
+ Console.WriteLine("Dictionary");
+ ShowDictionary((Dictionary<string, object>)obj, level + 1);
+ }
+ else if (QpidTypeCheck.ObjectIsList(obj))
+ {
+ Console.WriteLine("List");
+ ShowList((Collection<object>)obj, level + 1);
+ }
+ else
+ Console.WriteLine("Value: {0}, Type: {1}",
+ obj.ToString(), obj.GetType().ToString());
+ }
+ }
+
+ /// <summary>
+ /// A function to diplay a Message. The native Object type is
+ /// decomposed into AMQP types.
+ /// </summary>
+ /// <param name="message">The Message</param>
+ public static void ShowMessage(Message message)
+ {
+ if ("amqp/map" == message.ContentType)
+ {
+ Console.WriteLine("Received a Dictionary");
+ Dictionary<string, object> content = new Dictionary<string, object>();
+ message.GetContent(content);
+ ShowDictionary(content, 0);
+ }
+ else if ("amqp/list" == message.ContentType)
+ {
+ Console.WriteLine("Received a List");
+ Collection<object> content = new Collection<object>();
+ message.GetContent(content);
+ ShowList(content, 0);
+ }
+ else
+ {
+ Console.WriteLine("Received a String");
+ Console.WriteLine(message.GetContent());
+ }
+ }
+ }
+
+
+
+ /// <summary>
+ /// A model class to demonstrate how a user may use the Qpid Messaging
+ /// interface to receive Session messages using a callback.
+ /// </summary>
+ class ReceiverProcess : ISessionReceiver
+ {
+ UInt32 messagesReceived = 0;
+
+ /// <summary>
+ /// SessionReceiver implements the ISessionReceiver interface.
+ /// It is the callback function that receives all messages for a Session.
+ /// It may be called any time server is running.
+ /// It is always called on server's private thread.
+ /// </summary>
+ /// <param name="receiver">The Receiver associated with the message.</param>
+ /// <param name="message">The Message</param>
+ public void SessionReceiver(Receiver receiver, Message message)
+ {
+ //
+ // Indicate message reception
+ //
+ Console.WriteLine("--- Message {0}", ++messagesReceived);
+
+ //
+ // Display the received message
+ //
+ MessageViewer.ShowMessage(message);
+
+ //
+ // Acknowledge the receipt of all received messages.
+ //
+ receiver.Session.Acknowledge();
+ }
+
+
+ /// <summary>
+ /// Usage
+ /// </summary>
+ /// <param name="url">Connection target</param>
+ /// <param name="addr">Address: broker exchange + routing key</param>
+ /// <param name="nSec">n seconds to keep callback open</param>
+ static void usage(string url, string addr, int nSec)
+ {
+
+ Console.WriteLine("usage: {0} [url [addr [nSec]]]",
+ System.Diagnostics.Process.GetCurrentProcess().ProcessName);
+ Console.WriteLine();
+ Console.WriteLine("A program to connect to a broker and receive");
+ Console.WriteLine("messages from a named exchange with a routing key.");
+ Console.WriteLine("The receiver uses a session callback and keeps the callback");
+ Console.WriteLine("server open for so many seconds.");
+ Console.WriteLine("The details of the message body's types and values are shown.");
+ Console.WriteLine();
+ Console.WriteLine(" url = target address for 'new Connection(url)'");
+ Console.WriteLine(" addr = address for 'session.CreateReceiver(addr)'");
+ Console.WriteLine(" nSec = time in seconds to keep the receiver callback open");
+ Console.WriteLine();
+ Console.WriteLine("Default values:");
+ Console.WriteLine(" {0} {1} {2} {3}",
+ System.Diagnostics.Process.GetCurrentProcess().ProcessName,
+ url, addr, nSec);
+ }
+
+
+ /// <summary>
+ /// A function to illustrate how to open a Session callback and
+ /// receive messages.
+ /// </summary>
+ /// <param name="args">Main program arguments</param>
+ public int TestProgram(string[] args)
+ {
+ string url = "amqp:tcp:localhost:5672";
+ string addr = "amq.direct/map_example";
+ int nSec = 30;
+ string connectionOptions = "";
+
+ if (1 == args.Length)
+ {
+ if (args[0].Equals("-h") || args[0].Equals("-H") || args[0].Equals("/?"))
+ {
+ usage(url, addr, nSec);
+ return 1;
+ }
+ }
+
+ if (args.Length > 0)
+ url = args[0];
+ if (args.Length > 1)
+ addr = args[1];
+ if (args.Length > 2)
+ nSec = System.Convert.ToInt32(args[2]);
+ if (args.Length > 3)
+ connectionOptions = args[3];
+
+ //
+ // Create and open an AMQP connection to the broker URL
+ //
+ Connection connection = new Connection(url, connectionOptions);
+ connection.Open();
+
+ //
+ // Create a session.
+ //
+ Session session = connection.CreateSession();
+
+ //
+ // Receive through callback
+ //
+ // Create callback server and implicitly start it
+ //
+ SessionReceiver.CallbackServer cbServer =
+ new SessionReceiver.CallbackServer(session, this);
+
+ //
+ // The callback server is running and executing callbacks on a
+ // separate thread.
+ //
+
+ //
+ // Create a receiver for the direct exchange using the
+ // routing key "map_example".
+ //
+ Receiver receiver = session.CreateReceiver(addr);
+
+ //
+ // Establish a capacity
+ //
+ receiver.Capacity = 100;
+
+ //
+ // Wait so many seconds for messages to arrive.
+ //
+ System.Threading.Thread.Sleep(nSec * 1000); // in mS
+
+ //
+ // Stop the callback server.
+ //
+ cbServer.Close();
+
+ //
+ // Close the receiver and the connection.
+ //
+ receiver.Close();
+ connection.Close();
+ return 0;
+ }
+ }
+
+
+ class MapCallbackReceiverMain
+ {
+ /// <summary>
+ /// Main program
+ /// </summary>
+ /// <param name="args">Main prgram args</param>
+ static int Main(string[] args)
+ {
+ // Invoke 'TestProgram' as non-static class.
+ ReceiverProcess mainProc = new ReceiverProcess();
+
+ int result = mainProc.TestProgram(args);
+
+ return result;
+ }
+ }
+}
+
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj
new file mode 100644
index 0000000000..1380fc4981
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj
@@ -0,0 +1,109 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{68A43817-2358-4A31-8FDF-FE21722BFBCF}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.map.callback.receiver</RootNamespace>
+ <AssemblyName>csharp.map.callback.receiver</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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="csharp.map.callback.receiver.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\src\sessionreceiver\org.apache.qpid.messaging.sessionreceiver.csproj">
+ <Project>{B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}</Project>
+ <Name>org.apache.qpid.messaging.sessionreceiver</Name>
+ </ProjectReference>
+ </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/examples/csharp.map.callback.sender/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..e633f76673
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/Properties/AssemblyInfo.cs
@@ -0,0 +1,54 @@
+/*
+* 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("csharp.map.callback.sender")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.map.callback.sender")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[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("1eec2eca-adbd-4394-8b01-f4c4645bb122")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.cs
new file mode 100644
index 0000000000..4cc88564e7
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.cs
@@ -0,0 +1,194 @@
+/*
+ *
+ * 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 System.Collections.ObjectModel;
+using Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging.Examples
+{
+ class MapSender
+ {
+ //
+ // usage
+ //
+ static void usage(string url, string addr, UInt32 count, string connOpts)
+ {
+
+ Console.WriteLine("usage: {0} [url [addr [count]]]",
+ System.Diagnostics.Process.GetCurrentProcess().ProcessName);
+ Console.WriteLine();
+ Console.WriteLine("A program to connect to a broker and send N");
+ Console.WriteLine("messages to a named exchange with a routing key.");
+ Console.WriteLine();
+ Console.WriteLine(" url = target address for 'new Connection(url)'");
+ Console.WriteLine(" addr = address for 'session.CreateReceiver(addr)'");
+ Console.WriteLine(" count = number of messages to send");
+ Console.WriteLine(" connectionOptions = options list");
+ Console.WriteLine();
+ Console.WriteLine("Default values:");
+ Console.WriteLine(" {0} {1} {2} {3} {4}",
+ System.Diagnostics.Process.GetCurrentProcess().ProcessName,
+ url, addr, count, connOpts);
+ }
+
+
+ //
+ // TestProgram
+ //
+ public int TestProgram(string[] args)
+ {
+ string url = "amqp:tcp:localhost:5672";
+ string addr = "amq.direct/map_example";
+ UInt32 count = 1;
+ string connectionOptions = "";
+
+ if (1 == args.Length)
+ {
+ if (args[0].Equals("-h") || args[0].Equals("-H") || args[0].Equals("/?"))
+ {
+ usage(url, addr, count, connectionOptions);
+ return 1;
+ }
+ }
+
+ if (args.Length > 0)
+ url = args[0];
+ if (args.Length > 1)
+ addr = args[1];
+ if (args.Length > 2)
+ count = System.Convert.ToUInt32(args[2]);
+ if (args.Length > 3)
+ connectionOptions = args[3];
+
+ //
+ // Create and open an AMQP connection to the broker URL
+ //
+ Connection connection = new Connection(url, connectionOptions);
+ connection.Open();
+
+ //
+ // Create a session and a sender to the direct exchange using the
+ // routing key "map_example".
+ //
+ Session session = connection.CreateSession();
+ Sender sender = session.CreateSender(addr);
+
+ //
+ // Create structured content for the message. This example builds a
+ // map of items including a nested map and a list of values.
+ //
+ Dictionary<string, object> content = new Dictionary<string, object>();
+ Dictionary<string, object> subMap = new Dictionary<string, object>();
+ Collection<object> colors = new Collection<object>();
+
+ // add simple types
+ content["id"] = 987654321;
+ content["name"] = "Widget";
+ content["percent"] = 0.99;
+
+ // add nested amqp/map
+ subMap["name"] = "Smith";
+ subMap["number"] = 354;
+ content["nestedMap"] = subMap;
+
+ // add an amqp/list
+ colors.Add("red");
+ colors.Add("green");
+ colors.Add("white");
+ content["colorsList"] = colors;
+
+ // add one of each supported amqp data type
+ bool mybool = true;
+ content["mybool"] = mybool;
+
+ byte mybyte = 4;
+ content["mybyte"] = mybyte;
+
+ UInt16 myUInt16 = 5;
+ content["myUInt16"] = myUInt16;
+
+ UInt32 myUInt32 = 6;
+ content["myUInt32"] = myUInt32;
+
+ UInt64 myUInt64 = 7;
+ content["myUInt64"] = myUInt64;
+
+ char mychar = 'h';
+ content["mychar"] = mychar;
+
+ Int16 myInt16 = 9;
+ content["myInt16"] = myInt16;
+
+ Int32 myInt32 = 10;
+ content["myInt32"] = myInt32;
+
+ Int64 myInt64 = 11;
+ content["myInt64"] = myInt64;
+
+ Single mySingle = (Single)12.12;
+ content["mySingle"] = mySingle;
+
+ Double myDouble = 13.13;
+ content["myDouble"] = myDouble;
+
+ Guid myGuid = new Guid("000102030405060708090a0b0c0d0e0f");
+ content["myGuid"] = myGuid;
+
+ //
+ // Construct a message with the map content and send it synchronously
+ // via the sender.
+ //
+ Message message = new Message(content);
+ for (UInt32 i = 0; i<count; i++)
+ sender.Send(message, true);
+
+ //
+ // Wait until broker receives all messages.
+ //
+ session.Sync();
+
+ //
+ // Close the connection.
+ //
+ connection.Close();
+
+ return 0;
+ }
+ }
+
+ class MapSenderMain
+ {
+ //
+ // Main
+ //
+ static int Main(string[] args)
+ {
+ // Invoke 'TestProgram' as non-static class.
+ MapSender mainProc = new MapSender();
+
+ int result = mainProc.TestProgram(args);
+
+ return result;
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj
new file mode 100644
index 0000000000..cb0a5705af
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj
@@ -0,0 +1,107 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{12F1C14F-5C7D-4075-9BAE-C091394FF99A}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.map.callback.sender</RootNamespace>
+ <AssemblyName>csharp.map.callback.sender</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <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)' == '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)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <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|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="csharp.map.callback.sender.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.map.receiver/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..694d6b9ce1
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/Properties/AssemblyInfo.cs
@@ -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 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("csharp.map.receiver")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.map.receiver")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[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("002049f9-41c5-420f-9ff6-45bb652dded6")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/csharp.map.receiver.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/csharp.map.receiver.cs
new file mode 100644
index 0000000000..5219ee789a
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/csharp.map.receiver.cs
@@ -0,0 +1,87 @@
+/*
+ *
+ * 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.examples
+{
+ class MapReceiver
+ {
+ // csharp.map.receiver example
+ //
+ // Send an amqp/map message to amqp:tcp:localhost:5672 amq.direct/map_example
+ // The map message
+ //
+ static int Main(string[] args)
+ {
+ string url = "amqp:tcp:localhost:5672";
+ string address = "message_queue; {create: always}";
+ string connectionOptions = "";
+
+ if (args.Length > 0)
+ url = args[0];
+ if (args.Length > 1)
+ address = args[1];
+ if (args.Length > 2)
+ connectionOptions = args[3];
+
+ //
+ // Create and open an AMQP connection to the broker URL
+ //
+ Connection connection = new Connection(url);
+ connection.Open();
+
+ //
+ // Create a session and a receiver fir the direct exchange using the
+ // routing key "map_example".
+ //
+ Session session = connection.CreateSession();
+ Receiver receiver = session.CreateReceiver(address);
+
+ //
+ // Fetch the message from the broker
+ //
+ Message message = receiver.Fetch(DurationConstants.MINUTE);
+
+ //
+ // Extract the structured content from the message.
+ //
+ Dictionary<string, object> content = new Dictionary<string, object>();
+ message.GetContent(content);
+ Console.WriteLine("{0}", message.AsString(content));
+
+ //
+ // Acknowledge the receipt of all received messages.
+ //
+ session.Acknowledge();
+
+ //
+ // Close the receiver and the connection.
+ //
+ receiver.Close();
+ connection.Close();
+ return 0;
+ }
+ }
+}
+
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/csharp.map.receiver.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/csharp.map.receiver.csproj
new file mode 100644
index 0000000000..82882be817
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.receiver/csharp.map.receiver.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.map.receiver</RootNamespace>
+ <AssemblyName>csharp.map.receiver</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.map.receiver.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/csharp.map.sender/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..ea29ac2417
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/Properties/AssemblyInfo.cs
@@ -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 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("csharp.map.sender")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("csharp.map.sender")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[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("1eec2eca-adbd-4394-8b01-f4c4645bb122")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.cs b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.cs
new file mode 100644
index 0000000000..9001eb8e0b
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.cs
@@ -0,0 +1,146 @@
+/*
+ *
+ * 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 System.Collections.ObjectModel;
+using Org.Apache.Qpid.Messaging;
+
+namespace Org.Apache.Qpid.Messaging.examples
+{
+ class MapSender
+ {
+ // csharp.map.sender example
+ //
+ // Send an amqp/map message to amqp:tcp:localhost:5672 amq.direct/map_example
+ // The map message contains simple types, a nested amqp/map,
+ // an ampq/list, and specific instances of each supported type.
+ //
+ static int Main(string[] args)
+ {
+ string url = "amqp:tcp:localhost:5672";
+ string address = "message_queue; {create: always}";
+ string connectionOptions = "";
+
+ if (args.Length > 0)
+ url = args[0];
+ if (args.Length > 1)
+ address = args[1];
+ if (args.Length > 2)
+ connectionOptions = args[2];
+
+ //
+ // Create and open an AMQP connection to the broker URL
+ //
+ Connection connection = new Connection(url, connectionOptions);
+ connection.Open();
+
+ //
+ // Create a session and a sender to the direct exchange
+ //
+ Session session = connection.CreateSession();
+ Sender sender = session.CreateSender(address);
+
+ //
+ // Create structured content for the message. This example builds a
+ // map of items including a nested map and a list of values.
+ //
+ Dictionary<string, object> content = new Dictionary<string, object>();
+ Dictionary<string, object> subMap = new Dictionary<string, object>();
+ Collection<object> colors = new Collection<object>();
+
+ // add simple types
+ content["id"] = 987654321;
+ content["name"] = "Widget";
+ content["percent"] = 0.99;
+
+ // add nested amqp/map
+ subMap["name"] = "Smith";
+ subMap["number"] = 354;
+ content["nestedMap"] = subMap;
+
+ // add an amqp/list
+ colors.Add("red");
+ colors.Add("green");
+ colors.Add("white");
+ // list contains null value
+ colors.Add(null);
+ content["colorsList"] = colors;
+
+ // add one of each supported amqp data type
+ bool mybool = true;
+ content["mybool"] = mybool;
+
+ byte mybyte = 4;
+ content["mybyte"] = mybyte;
+
+ UInt16 myUInt16 = 5 ;
+ content["myUInt16"] = myUInt16;
+
+ UInt32 myUInt32 = 6;
+ content["myUInt32"] = myUInt32;
+
+ UInt64 myUInt64 = 7;
+ content["myUInt64"] = myUInt64;
+
+ char mychar = 'h';
+ content["mychar"] = mychar;
+
+ Int16 myInt16 = 9;
+ content["myInt16"] = myInt16;
+
+ Int32 myInt32 = 10;
+ content["myInt32"] = myInt32;
+
+ Int64 myInt64 = 11;
+ content["myInt64"] = myInt64;
+
+ Single mySingle = (Single)12.12;
+ content["mySingle"] = mySingle;
+
+ Double myDouble = 13.13;
+ content["myDouble"] = myDouble;
+
+ Guid myGuid = new Guid("000102030405060708090a0b0c0d0e0f");
+ content["myGuid"] = myGuid;
+
+ content["myNull"] = null;
+
+ //
+ // Construct a message with the map content and send it synchronously
+ // via the sender.
+ //
+ Message message = new Message(content);
+ sender.Send(message, true);
+
+ //
+ // Wait until broker receives all messages.
+ //
+ session.Sync();
+
+ //
+ // Close the connection.
+ //
+ connection.Close();
+ return 0;
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.csproj b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.csproj
new file mode 100644
index 0000000000..0e42201b6d
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{5D8252F5-E1D3-44A0-94C7-7CB75E843C10}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.map.sender</RootNamespace>
+ <AssemblyName>csharp.map.sender</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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)' == '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)' == '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|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>
+ <Compile Include="csharp.map.sender.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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/examples/powershell.example.helloworld/powershell.example.helloworld.ps1 b/qpid/cpp/bindings/qpid/dotnet/examples/powershell.example.helloworld/powershell.example.helloworld.ps1
new file mode 100644
index 0000000000..e8c21bc3f6
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/powershell.example.helloworld/powershell.example.helloworld.ps1
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+#
+# Script for 32-bit powershell
+#
+
+[Reflection.Assembly]::LoadFile('W:\cpp\src\Debug\org.apache.qpid.messagingd.dll')
+$conn = new-object Org.Apache.Qpid.Messaging.Connection("localhost:5672")
+$conn.Open()
+$sess = $conn.CreateSession()
+$rcvr = $sess.CreateReceiver("amq.topic")
+$sender = $sess.CreateSender("amq.topic")
+$msg1 = new-object Org.Apache.Qpid.Messaging.Message("Hello world!")
+$sender.Send($msg1)
+$dur = new-object Org.Apache.Qpid.Messaging.Duration(1000)
+$msg2 = $rcvr.Fetch($dur)
+$msg2.GetContent()
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Application.Designer.vb b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Application.Designer.vb
new file mode 100644
index 0000000000..7b4d946036
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Application.Designer.vb
@@ -0,0 +1,32 @@
+'
+' Licensed to the Apache Software Foundation (ASF) under one
+' or more contributor license agreements. See the NOTICE file
+' distributed with this work for additional information
+' regarding copyright ownership. The ASF licenses this file
+' to you under the Apache License, Version 2.0 (the
+' "License"); you may not use this file except in compliance
+' with the License. You may obtain a copy of the License at
+'
+' http://www.apache.org/licenses/LICENSE-2.0
+'
+' Unless required by applicable law or agreed to in writing,
+' software distributed under the License is distributed on an
+' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+' KIND, either express or implied. See the License for the
+' specific language governing permissions and limitations
+' under the License.
+'
+
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.4927
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Application.myapp b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Application.myapp
new file mode 100644
index 0000000000..256be1aa9e
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Application.myapp
@@ -0,0 +1,28 @@
+<?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.
+-->
+<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <MySubMain>false</MySubMain>
+ <SingleInstance>false</SingleInstance>
+ <ShutdownMode>0</ShutdownMode>
+ <EnableVisualStyles>true</EnableVisualStyles>
+ <AuthenticationMode>0</AuthenticationMode>
+ <ApplicationType>2</ApplicationType>
+ <SaveMySettingsOnExit>true</SaveMySettingsOnExit>
+</MyApplicationData>
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/AssemblyInfo.vb b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/AssemblyInfo.vb
new file mode 100644
index 0000000000..d0727fe9fa
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/AssemblyInfo.vb
@@ -0,0 +1,54 @@
+'
+' 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.
+'
+
+Imports System
+Imports System.Reflection
+Imports 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.
+
+' Review the values of the assembly attributes
+
+<Assembly: AssemblyTitle("visualbasic.example.client")>
+<Assembly: AssemblyDescription("")>
+<Assembly: AssemblyCompany("Microsoft")>
+<Assembly: AssemblyProduct("visualbasic.example.client")>
+<Assembly: AssemblyCopyright("Copyright © Microsoft 2010")>
+<Assembly: AssemblyTrademark("")>
+
+<Assembly: ComVisible(False)>
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+<Assembly: Guid("ec9df8cf-c1d4-4938-9e72-93fb81d55700")>
+
+' 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("1.0.0.0")>
+<Assembly: AssemblyFileVersion("1.0.0.0")>
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Resources.Designer.vb b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Resources.Designer.vb
new file mode 100644
index 0000000000..fa8cc43f84
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Resources.Designer.vb
@@ -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.
+'
+
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.4927
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''<summary>
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''</summary>
+ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''<summary>
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Org.Apache.Qpid.Messaging.Examples.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''<summary>
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Resources.resx b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Resources.resx
new file mode 100644
index 0000000000..70432f3b74
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Resources.resx
@@ -0,0 +1,135 @@
+<?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.
+-->
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Settings.Designer.vb b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Settings.Designer.vb
new file mode 100644
index 0000000000..d02c7f85c6
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Settings.Designer.vb
@@ -0,0 +1,92 @@
+'
+' 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.
+'
+
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.4927
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0"), _
+ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
+ Friend Module MySettingsProperty
+
+ <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
+ Friend ReadOnly Property Settings() As Global.Org.Apache.Qpid.Messaging.Examples.My.MySettings
+ Get
+ Return Global.Org.Apache.Qpid.Messaging.Examples.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Settings.settings b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Settings.settings
new file mode 100644
index 0000000000..469395e45e
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/MyProject/Settings.settings
@@ -0,0 +1,25 @@
+<?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.
+-->
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vb b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vb
new file mode 100644
index 0000000000..f32cfd8bce
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vb
@@ -0,0 +1,72 @@
+'
+'
+' 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.
+'
+'
+
+Imports System
+Imports Org.Apache.Qpid.Messaging
+Namespace Org.Apache.Qpid.Messaging.Examples
+ Module Module1
+ Class Client
+ Public Shared Function Main(ByVal args() As String) As Integer
+ Dim url As String = "amqp:tcp:127.0.0.1:5672"
+ Dim connectionOptions As String = ""
+
+ If args.Length > 0 Then url = args(0)
+ If args.Length > 1 Then connectionOptions = args(1)
+
+ Dim connection As Connection
+ Try
+ connection = New Connection(url, connectionOptions)
+ connection.Open()
+
+ Dim session As Session = connection.CreateSession()
+
+ Dim sender As Sender = session.CreateSender("service_queue")
+
+ Dim responseQueue As Address = New Address("#response-queue; {create:always, delete:always}")
+ Dim receiver As Receiver = session.CreateReceiver(responseQueue)
+
+ Dim s(3) As String
+ s(0) = "Twas brillig, and the slithy toves"
+ s(1) = "Did gire and gymble in the wabe."
+ s(2) = "All mimsy were the borogroves,"
+ s(3) = "And the mome raths outgrabe."
+
+ Dim request As Message = New Message("")
+ request.ReplyTo = responseQueue
+
+ Dim i As Integer
+ For i = 0 To s.Length - 1
+ request.SetContent(s(i))
+ sender.Send(request)
+ Dim response As Message = receiver.Fetch()
+ Console.WriteLine("{0} -> {1}", request.GetContent(), response.GetContent())
+ Next i
+ connection.Close()
+ Main = 0
+ Catch e As Exception
+ Console.WriteLine("Exception {0}.", e)
+ connection.Close()
+ Main = 1
+ End Try
+ End Function
+ End Class
+ End Module
+End Namespace
diff --git a/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vbproj b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vbproj
new file mode 100644
index 0000000000..4463dc7902
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vbproj
@@ -0,0 +1,176 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{CFEA696E-115B-4AD1-AB56-804E360EDD51}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <StartupObject>Sub Main</StartupObject>
+ <RootNamespace>Org.Apache.Qpid.Messaging.Examples</RootNamespace>
+ <AssemblyName>visualbasic.example.client</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <MyType>Console</MyType>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <OptionExplicit>On</OptionExplicit>
+ <OptionCompare>Binary</OptionCompare>
+ <OptionStrict>Off</OptionStrict>
+ <OptionInfer>On</OptionInfer>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DocumentationFile>visualbasic.example.client.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DocumentationFile>visualbasic.example.client.xml</DocumentationFile>
+ <Optimize>true</Optimize>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RelWithDebInfo|x86' ">
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DocumentationFile>visualbasic.example.client.xml</DocumentationFile>
+ <Optimize>true</Optimize>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DocumentationFile>visualbasic.example.client.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DocumentationFile>visualbasic.example.client.xml</DocumentationFile>
+ <Optimize>true</Optimize>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RelWithDebInfo|x64' ">
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>$(QPID_BUILD_ROOT)\src\$(Configuration)\</OutputPath>
+ <DocumentationFile>visualbasic.example.client.xml</DocumentationFile>
+ <Optimize>true</Optimize>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Import Include="Microsoft.VisualBasic" />
+ <Import Include="System" />
+ <Import Include="System.Collections" />
+ <Import Include="System.Collections.Generic" />
+ <Import Include="System.Data" />
+ <Import Include="System.Diagnostics" />
+ <Import Include="System.Linq" />
+ <Import Include="System.Xml.Linq" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="visualbasic.example.client.vb" />
+ <Compile Include="MyProject\AssemblyInfo.vb" />
+ <Compile Include="MyProject\Application.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Application.myapp</DependentUpon>
+ </Compile>
+ <Compile Include="MyProject\Resources.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="MyProject\Settings.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="MyProject\Resources.resx">
+ <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.vb</LastGenOutput>
+ <CustomToolNamespace>My.Resources</CustomToolNamespace>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="MyProject\Application.myapp">
+ <Generator>MyApplicationCodeGenerator</Generator>
+ <LastGenOutput>Application.Designer.vb</LastGenOutput>
+ </None>
+ <None Include="MyProject\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <CustomToolNamespace>My</CustomToolNamespace>
+ <LastGenOutput>Settings.Designer.vb</LastGenOutput>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="My Project\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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/org.apache.qpid.messaging.sessionreceiver.sln b/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sessionreceiver.sln
new file mode 100644
index 0000000000..90e98a4bbe
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sessionreceiver.sln
@@ -0,0 +1,76 @@
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License
+#
+
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Org.Apache.Qpid.Messaging", "src\org.apache.qpid.messaging.vcproj", "{AA5A3B83-5F98-406D-A01C-5A921467A57D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "org.apache.qpid.messaging.sessionreceiver", "src\sessionreceiver\org.apache.qpid.messaging.sessionreceiver.csproj", "{B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ RelWithDebInfo|Win32 = RelWithDebInfo|Win32
+ RelWithDebInfo|x64 = RelWithDebInfo|x64
+ RelWithDebInfo|x86 = RelWithDebInfo|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Win32.Build.0 = Debug|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x64.ActiveCfg = Debug|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x64.Build.0 = Debug|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x86.ActiveCfg = Debug|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x86.Build.0 = Debug|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Win32.ActiveCfg = Release|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Win32.Build.0 = Release|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x64.ActiveCfg = Release|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x64.Build.0 = Release|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x86.ActiveCfg = Release|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x86.Build.0 = Release|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|Win32
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|Win32.ActiveCfg = Debug|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x64.ActiveCfg = Debug|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x64.Build.0 = Debug|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x86.ActiveCfg = Debug|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x86.Build.0 = Debug|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|Win32.ActiveCfg = Release|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x64.ActiveCfg = Release|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x64.Build.0 = Release|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x86.ActiveCfg = Release|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x86.Build.0 = Release|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln b/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln
new file mode 100644
index 0000000000..030bcc4b2a
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln
@@ -0,0 +1,348 @@
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License
+#
+
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Org.Apache.Qpid.Messaging", "src\org.apache.qpid.messaging.vcproj", "{AA5A3B83-5F98-406D-A01C-5A921467A57D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{34C477FB-B0CC-4AB9-A346-EA7B055469AC}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Direct", "Direct", "{DE58D329-10DC-4C8D-9EFA-230A57314089}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Pub-Sub", "Pub-Sub", "{878FDDF8-A870-41D6-9E36-0A050EC5ACAB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.direct.sender", "examples\csharp.direct.sender\csharp.direct.sender.csproj", "{7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D} = {AA5A3B83-5F98-406D-A01C-5A921467A57D}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.direct.receiver", "examples\csharp.direct.receiver\csharp.direct.receiver.csproj", "{52F880E7-D677-4C91-8516-D679CE0F46A8}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D} = {AA5A3B83-5F98-406D-A01C-5A921467A57D}
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{39E9D1BF-3A0B-4D86-BF6B-F463E1A2245A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "messaging.test", "test\messaging.test\messaging.test.csproj", "{AF2FBC78-266C-430C-BC29-9477AB596A36}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D} = {AA5A3B83-5F98-406D-A01C-5A921467A57D}
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StructuredMessage", "StructuredMessage", "{E99FEFEE-B866-4BBA-9AA3-79DDF1C92960}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.map.sender", "examples\csharp.map.sender\csharp.map.sender.csproj", "{5D8252F5-E1D3-44A0-94C7-7CB75E843C10}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D} = {AA5A3B83-5F98-406D-A01C-5A921467A57D}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.map.receiver", "examples\csharp.map.receiver\csharp.map.receiver.csproj", "{AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D} = {AA5A3B83-5F98-406D-A01C-5A921467A57D}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "org.apache.qpid.messaging.sessionreceiver", "src\sessionreceiver\org.apache.qpid.messaging.sessionreceiver.csproj", "{B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.map.callback.receiver", "examples\csharp.map.callback.receiver\csharp.map.callback.receiver.csproj", "{68A43817-2358-4A31-8FDF-FE21722BFBCF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.map.callback.sender", "examples\csharp.map.callback.sender\csharp.map.callback.sender.csproj", "{12F1C14F-5C7D-4075-9BAE-C091394FF99A}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client-Server", "Client-Server", "{9232212E-F3C6-4D18-8D25-0C31DD5FF3DB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.client", "examples\csharp.example.client\csharp.example.client.csproj", "{0DE01712-C2D1-4CA4-B42C-5856456A8696}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.server", "examples\csharp.example.server\csharp.example.server.csproj", "{090A081D-E8B5-4949-AA43-EE182B7101E3}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Drain-Spout", "Drain-Spout", "{89CE04CB-21DE-4ABB-9236-50529DD8C022}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.drain", "examples\csharp.example.drain\csharp.example.drain.csproj", "{C43DEB69-8088-420B-B0CA-C699535E6D08}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.spout", "examples\csharp.example.spout\csharp.example.spout.csproj", "{EB36626D-36C2-41B3-B65E-762BAF27F137}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.declare_queues", "examples\csharp.example.declare_queues\csharp.example.declare_queues.csproj", "{E31B349C-830C-4583-8BD9-30DA4398349F}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "visualbasic.example.client", "examples\visualbasic.example.client\visualbasic.example.client.vbproj", "{CFEA696E-115B-4AD1-AB56-804E360EDD51}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hello World", "Hello World", "{4408A2DA-ED2D-44AE-A465-0B6D75E1FF86}"
+ ProjectSection(SolutionItems) = preProject
+ examples\powershell.example.helloworld\powershell.example.helloworld.ps1 = examples\powershell.example.helloworld\powershell.example.helloworld.ps1
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.helloworld", "examples\csharp.example.helloworld\csharp.example.helloworld.csproj", "{8CC1C265-0507-44A3-9483-8FAF48513F4D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ RelWithDebInfo|Win32 = RelWithDebInfo|Win32
+ RelWithDebInfo|x64 = RelWithDebInfo|x64
+ RelWithDebInfo|x86 = RelWithDebInfo|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Win32.Build.0 = Debug|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x64.ActiveCfg = Debug|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x64.Build.0 = Debug|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x86.ActiveCfg = Debug|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|x86.Build.0 = Debug|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Win32.ActiveCfg = Release|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Win32.Build.0 = Release|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x64.ActiveCfg = Release|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x64.Build.0 = Release|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|x86.ActiveCfg = Release|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {AA5A3B83-5F98-406D-A01C-5A921467A57D}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|Win32
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|x64.ActiveCfg = Debug|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|x64.Build.0 = Debug|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|x86.ActiveCfg = Debug|x86
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|x86.Build.0 = Debug|x86
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|x64.ActiveCfg = Release|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|x64.Build.0 = Release|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|x86.ActiveCfg = Release|x86
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|x86.Build.0 = Release|x86
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|x64.ActiveCfg = Debug|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|x64.Build.0 = Debug|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|x86.ActiveCfg = Debug|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|x86.Build.0 = Debug|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|x64.ActiveCfg = Release|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|x64.Build.0 = Release|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|x86.ActiveCfg = Release|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|x86.Build.0 = Release|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|x64.ActiveCfg = Debug|x64
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|x64.Build.0 = Debug|x64
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|x86.ActiveCfg = Debug|x86
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|x86.Build.0 = Debug|x86
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|x64.ActiveCfg = Release|x64
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|x64.Build.0 = Release|x64
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|x86.ActiveCfg = Release|x86
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|x86.Build.0 = Release|x86
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {AF2FBC78-266C-430C-BC29-9477AB596A36}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Debug|x64.ActiveCfg = Debug|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Debug|x64.Build.0 = Debug|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Debug|x86.ActiveCfg = Debug|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Debug|x86.Build.0 = Debug|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Release|x64.ActiveCfg = Release|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Release|x64.Build.0 = Release|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Release|x86.ActiveCfg = Release|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Release|x86.Build.0 = Release|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Debug|x64.ActiveCfg = Debug|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Debug|x64.Build.0 = Debug|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Debug|x86.ActiveCfg = Debug|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Debug|x86.Build.0 = Debug|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Release|x64.ActiveCfg = Release|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Release|x64.Build.0 = Release|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Release|x86.ActiveCfg = Release|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Release|x86.Build.0 = Release|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x64.ActiveCfg = Debug|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x64.Build.0 = Debug|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x86.ActiveCfg = Debug|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Debug|x86.Build.0 = Debug|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x64.ActiveCfg = Release|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x64.Build.0 = Release|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x86.ActiveCfg = Release|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.Release|x86.Build.0 = Release|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {B0A51CEC-30A2-4C2E-90BE-AE95107EAA05}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Debug|x64.ActiveCfg = Debug|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Debug|x64.Build.0 = Debug|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Debug|x86.ActiveCfg = Debug|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Debug|x86.Build.0 = Debug|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Release|x64.ActiveCfg = Release|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Release|x64.Build.0 = Release|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Release|x86.ActiveCfg = Release|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Release|x86.Build.0 = Release|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Debug|x64.ActiveCfg = Debug|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Debug|x64.Build.0 = Debug|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Debug|x86.ActiveCfg = Debug|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Debug|x86.Build.0 = Debug|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Release|x64.ActiveCfg = Release|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Release|x64.Build.0 = Release|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Release|x86.ActiveCfg = Release|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Release|x86.Build.0 = Release|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|Win32.ActiveCfg = Debug|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|x64.ActiveCfg = Debug|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|x64.Build.0 = Debug|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|x86.ActiveCfg = Debug|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|x86.Build.0 = Debug|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|Win32.ActiveCfg = Release|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|x64.ActiveCfg = Release|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|x64.Build.0 = Release|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|x86.ActiveCfg = Release|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|x86.Build.0 = Release|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|Win32.ActiveCfg = Debug|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|x64.ActiveCfg = Debug|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|x64.Build.0 = Debug|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|x86.ActiveCfg = Debug|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|x86.Build.0 = Debug|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|Win32.ActiveCfg = Release|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|x64.ActiveCfg = Release|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|x64.Build.0 = Release|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|x86.ActiveCfg = Release|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|x86.Build.0 = Release|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|Win32.ActiveCfg = Debug|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|x64.ActiveCfg = Debug|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|x64.Build.0 = Debug|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|x86.ActiveCfg = Debug|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|x86.Build.0 = Debug|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|Win32.ActiveCfg = Release|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|x64.ActiveCfg = Release|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|x64.Build.0 = Release|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|x86.ActiveCfg = Release|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|x86.Build.0 = Release|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|Win32.ActiveCfg = Debug|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|x64.ActiveCfg = Debug|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|x64.Build.0 = Debug|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|x86.ActiveCfg = Debug|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|x86.Build.0 = Debug|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|Win32.ActiveCfg = Release|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|x64.ActiveCfg = Release|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|x64.Build.0 = Release|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|x86.ActiveCfg = Release|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|x86.Build.0 = Release|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|Win32.ActiveCfg = Debug|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|x64.ActiveCfg = Debug|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|x64.Build.0 = Debug|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|x86.ActiveCfg = Debug|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|x86.Build.0 = Debug|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|Win32.ActiveCfg = Release|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x64.ActiveCfg = Release|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x64.Build.0 = Release|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x86.ActiveCfg = Release|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x86.Build.0 = Release|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|Win32.ActiveCfg = Debug|x86
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|x64.ActiveCfg = Debug|x64
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|x64.Build.0 = Debug|x64
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|x86.ActiveCfg = Debug|x86
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|x86.Build.0 = Debug|x86
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|Win32.ActiveCfg = Release|x86
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|x64.ActiveCfg = Release|x64
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|x64.Build.0 = Release|x64
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|x86.ActiveCfg = Release|x86
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|x86.Build.0 = Release|x86
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|Win32.ActiveCfg = Debug|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x64.ActiveCfg = Debug|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x64.Build.0 = Debug|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x86.ActiveCfg = Debug|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x86.Build.0 = Debug|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|Win32.ActiveCfg = Release|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x64.ActiveCfg = Release|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x64.Build.0 = Release|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x86.ActiveCfg = Release|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x86.Build.0 = Release|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {DE58D329-10DC-4C8D-9EFA-230A57314089} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC}
+ {878FDDF8-A870-41D6-9E36-0A050EC5ACAB} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC}
+ {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC}
+ {9232212E-F3C6-4D18-8D25-0C31DD5FF3DB} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC}
+ {89CE04CB-21DE-4ABB-9236-50529DD8C022} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC}
+ {4408A2DA-ED2D-44AE-A465-0B6D75E1FF86} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC}
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068} = {DE58D329-10DC-4C8D-9EFA-230A57314089}
+ {52F880E7-D677-4C91-8516-D679CE0F46A8} = {DE58D329-10DC-4C8D-9EFA-230A57314089}
+ {AF2FBC78-266C-430C-BC29-9477AB596A36} = {39E9D1BF-3A0B-4D86-BF6B-F463E1A2245A}
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960}
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960}
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960}
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960}
+ {CFEA696E-115B-4AD1-AB56-804E360EDD51} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960}
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696} = {9232212E-F3C6-4D18-8D25-0C31DD5FF3DB}
+ {090A081D-E8B5-4949-AA43-EE182B7101E3} = {9232212E-F3C6-4D18-8D25-0C31DD5FF3DB}
+ {C43DEB69-8088-420B-B0CA-C699535E6D08} = {89CE04CB-21DE-4ABB-9236-50529DD8C022}
+ {EB36626D-36C2-41B3-B65E-762BAF27F137} = {89CE04CB-21DE-4ABB-9236-50529DD8C022}
+ {E31B349C-830C-4583-8BD9-30DA4398349F} = {89CE04CB-21DE-4ABB-9236-50529DD8C022}
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D} = {4408A2DA-ED2D-44AE-A465-0B6D75E1FF86}
+ EndGlobalSection
+EndGlobal
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();
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/Properties/AssemblyInfo.cs b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..cf50e88200
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/Properties/AssemblyInfo.cs
@@ -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 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("messaging.test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("messaging.test")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[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("fdf30e75-69ba-45c2-a196-df09085dd56a")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.address.cs b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.address.cs
new file mode 100644
index 0000000000..22ad186c9a
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.address.cs
@@ -0,0 +1,157 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+namespace Org.Apache.Qpid.Messaging.UnitTest
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using Org.Apache.Qpid.Messaging;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class AddressTests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ //
+ // Address test
+ //
+ [Test]
+ public void AddressConstructor_Empty()
+ {
+ Address addr = new Address();
+
+ StringAssert.IsMatch("", addr.ToStr());
+
+ StringAssert.IsMatch("", addr.Name);
+ StringAssert.IsMatch("", addr.Subject);
+ Dictionary<string, object> opts = addr.Options;
+ Assert.AreEqual(0, opts.Count);
+ StringAssert.IsMatch("", addr.Type);
+ }
+
+
+ [Test]
+ public void AddressConstructor_Name()
+ {
+ Address addr = new Address("name1");
+
+ StringAssert.IsMatch("", addr.ToStr());
+
+ StringAssert.IsMatch("name1", addr.Name);
+ StringAssert.IsMatch("", addr.Subject);
+ Dictionary<string, object> opts = addr.Options;
+ Assert.AreEqual(0, opts.Count);
+ StringAssert.IsMatch("", addr.Type);
+ }
+
+
+ [Test]
+ public void AddressConstructor_NameSubjOpts()
+ {
+ Dictionary<string, object> options = new Dictionary<string, object>();
+ options["one"] = 1;
+ options["two"] = "two";
+
+ Address addr = new Address("name2", "subj2", options);
+
+ StringAssert.IsMatch("name2/subj2;{node:{type:}, one:1, two:two}", addr.ToStr());
+
+ StringAssert.IsMatch("name2", addr.Name);
+ StringAssert.IsMatch("subj2", addr.Subject);
+ Dictionary<string, object> opts = addr.Options;
+ Assert.AreEqual(3, opts.Count);
+ StringAssert.IsMatch("", addr.Type);
+ }
+
+ [Test]
+ public void AddressConstructor_NameSubjOptsType()
+ {
+ Dictionary<string, object> options = new Dictionary<string, object>();
+ options["one"] = 1;
+ options["two"] = "two";
+
+ Address addr = new Address("name3", "subj3", options, "type3");
+
+ StringAssert.IsMatch("name3/subj3;{node:{type:type3}, one:1, two:two}", addr.ToStr());
+
+ StringAssert.IsMatch("name3", addr.Name);
+ StringAssert.IsMatch("subj3", addr.Subject);
+ Dictionary<string, object> opts = addr.Options;
+ Assert.AreEqual(3, opts.Count);
+ StringAssert.IsMatch("type3", addr.Type);
+ }
+
+ [Test]
+ public void AddressProperty()
+ {
+ Dictionary<string, object> options = new Dictionary<string, object>();
+ options["one"] = 1;
+ options["two"] = "two";
+ options["pi"] = 3.14159;
+ Dictionary<string, object> opts;
+
+ Address addr = new Address();
+
+ addr.Name = "name4";
+
+ StringAssert.IsMatch("name4", addr.Name);
+ StringAssert.IsMatch("", addr.Subject);
+ opts = addr.Options;
+ Assert.AreEqual(0, opts.Count);
+ StringAssert.IsMatch("", addr.Type);
+
+ addr.Subject = "subject4";
+
+ StringAssert.IsMatch("name4", addr.Name);
+ StringAssert.IsMatch("subject4", addr.Subject);
+ opts = addr.Options;
+ Assert.AreEqual(0, opts.Count);
+ StringAssert.IsMatch("", addr.Type);
+
+ addr.Type = "type4";
+
+ StringAssert.IsMatch("name4", addr.Name);
+ StringAssert.IsMatch("subject4", addr.Subject);
+ opts = addr.Options;
+ Assert.AreEqual(1, opts.Count);
+ StringAssert.IsMatch("type4", addr.Type);
+
+ addr.Options = options;
+
+ StringAssert.IsMatch("name4", addr.Name);
+ StringAssert.IsMatch("subject4", addr.Subject);
+ opts = addr.Options;
+ Assert.AreEqual(3, opts.Count);
+ StringAssert.IsMatch("", addr.Type);
+ }
+
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs
new file mode 100644
index 0000000000..dd368b5e5e
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.connection.cs
@@ -0,0 +1,100 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+namespace Org.Apache.Qpid.Messaging.UnitTest
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using Org.Apache.Qpid.Messaging;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class ConnectionTests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ //
+ // Doing without a real connection
+ //
+ [Test]
+ public void ConnectionCreate_1()
+ {
+ Connection myConn = new Connection("url");
+ Assert.IsFalse(myConn.IsOpen);
+ }
+
+ [Test]
+ public void ConnectionCreate_2()
+ {
+ Dictionary<string, object> options = new Dictionary<string, object>();
+ options["id"] = 987654321;
+ options["name"] = "Widget";
+ options["percent"] = 0.99;
+
+ Connection myConn = new Connection("url", options);
+ Assert.IsFalse(myConn.IsOpen);
+ }
+
+ [Test]
+ public void ConnectionCreate_3()
+ {
+ Connection myConn = new Connection("url", "{reconnect:True}");
+ Assert.IsFalse(myConn.IsOpen);
+ }
+
+ [Test]
+ public void ConnectionSetOption()
+ {
+ Dictionary<string, object> options = new Dictionary<string, object>();
+ options["id"] = 987654321;
+ options["name"] = "Widget";
+ options["percent"] = 0.99;
+
+ Connection myConn = new Connection("url", options);
+ myConn.SetOption("name", "purple");
+
+ Assert.IsFalse(myConn.IsOpen);
+ }
+
+ [Test]
+ public void ConnectionClose()
+ {
+ Dictionary<string, object> options = new Dictionary<string, object>();
+ options["id"] = 987654321;
+ options["name"] = "Widget";
+ options["percent"] = 0.99;
+
+ Connection myConn = new Connection("url", options);
+ myConn.Close();
+
+ Assert.IsFalse(myConn.IsOpen);
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs
new file mode 100644
index 0000000000..dc7af0a7c8
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+//
+// Note:
+// NUnit tests require all libraries to be on the project path
+// or in the project working directory. If an unmanaged DLL
+// (boost_xxx, for instance) is missing then NUnit will give
+// the error message:
+// System.IO.FileNotFoundException :
+// The specified module could not be found.
+// (Exception from HRESULT: 0x8007007E)
+//
+// Users may need to adjust this project's reference to the
+// NUnit assembly.
+//
+
+namespace Org.Apache.Qpid.Messaging.UnitTest
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using Org.Apache.Qpid.Messaging;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class BasicTests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ //
+ // Types representing amqp.map and amqp.list
+ //
+ [Test]
+ public void TypeTestForDictionary()
+ {
+ Dictionary<string, object> dx = new Dictionary<string, object>();
+
+ StringAssert.Contains("System.Collections.Generic.Dictionary`2[System.String,System.Object]", dx.GetType().ToString());
+ }
+
+ [Test]
+ public void TypeTestForCollection()
+ {
+ Collection<object> cx = new Collection<object>();
+
+ StringAssert.Contains("System.Collections.ObjectModel.Collection`1[System.Object]", cx.GetType().ToString());
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj
new file mode 100644
index 0000000000..7ec4d743a3
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj
@@ -0,0 +1,180 @@
+<?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>{AF2FBC78-266C-430C-BC29-9477AB596A36}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>messaging.test</RootNamespace>
+ <AssemblyName>messaging.test</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <StartupObject>
+ </StartupObject>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </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>bin\RelWithDebInfo\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RelWithDebInfo|x86' ">
+ <OutputPath>bin\x86\RelWithDebInfo\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RelWithDebInfo|x64' ">
+ <OutputPath>bin\x64\RelWithDebInfo\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="nunit.framework, Version=2.5.3.9345, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files (x86)\NUnit 2.5.3\bin\net-1.1\framework\nunit.framework.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="messaging.test.address.cs" />
+ <Compile Include="messaging.test.connection.cs" />
+ <Compile Include="messaging.test.cs" />
+ <Compile Include="messaging.test.duration.cs" />
+ <Compile Include="messaging.test.message.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\org.apache.qpid.messaging.vcproj">
+ <Project>{AA5A3B83-5F98-406D-A01C-5A921467A57D}</Project>
+ <Name>Org.Apache.Qpid.Messaging</Name>
+ </ProjectReference>
+ </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>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.duration.cs b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.duration.cs
new file mode 100644
index 0000000000..2512d7936c
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.duration.cs
@@ -0,0 +1,99 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+namespace Org.Apache.Qpid.Messaging.UnitTest
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using Org.Apache.Qpid.Messaging;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class DurationTests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void ValueOfUSERVALUE()
+ {
+ Duration myDuration = new Duration(1234);
+ Assert.AreEqual(1234, myDuration.Milliseconds);
+ }
+
+ [Test]
+ public void ValueOfFOREVER()
+ {
+ bool result = DurationConstants.FORVER.Milliseconds > 1.0E18;
+ Assert.True(result);
+ }
+
+ [Test]
+ public void ValueOfIMMEDIATE()
+ {
+ Assert.AreEqual(0, DurationConstants.IMMEDIATE.Milliseconds);
+ }
+
+ [Test]
+ public void ValueOfSECOND()
+ {
+ Assert.AreEqual(1000, DurationConstants.SECOND.Milliseconds);
+ }
+
+
+ [Test]
+ public void ValueOfMINUTE()
+ {
+ Assert.AreEqual(60000, DurationConstants.MINUTE.Milliseconds);
+ }
+
+ [Test]
+ public void ValueOfDefaultIsFOREVER()
+ {
+ Duration isInfinite = new Duration();
+
+ bool result = isInfinite.Milliseconds > 1.0E18;
+ Assert.True(result);
+ }
+
+ [Test]
+ public void ComputedValueFiveMinutes_1()
+ {
+ Duration fiveMinutes = new Duration(DurationConstants.MINUTE.Milliseconds * 5);
+ Assert.AreEqual(5 * 60000, fiveMinutes.Milliseconds);
+ }
+
+ [Test]
+ public void ComputedValueFiveMinutes_2()
+ {
+ Duration fiveMinutes = new Duration(5 * DurationConstants.MINUTE.Milliseconds);
+ Assert.AreEqual(5 * 60000, fiveMinutes.Milliseconds);
+ }
+ }
+} \ No newline at end of file
diff --git a/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs
new file mode 100644
index 0000000000..ac834047ad
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.message.cs
@@ -0,0 +1,294 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+namespace Org.Apache.Qpid.Messaging.UnitTest
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using Org.Apache.Qpid.Messaging;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class MessageTests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void SimpleMessageSize()
+ {
+ Message m2 = new Message("rarey");
+ UInt64 m2Size = m2.ContentSize;
+ Assert.AreEqual(5, m2Size);
+ }
+
+ [Test]
+ public void SimpleMessageStringContent()
+ {
+ Message m2 = new Message("rarely");
+ string mString = m2.GetContent();
+
+ StringAssert.IsMatch("rarely", mString);
+ }
+
+ [Test]
+ public void MessageReceiveContentAsByteArray()
+ {
+ Message m2 = new Message("while");
+ UInt64 m2Size = m2.ContentSize;
+
+ byte[] myRaw = new byte [m2Size];
+
+ m2.GetContent(myRaw);
+
+ Assert.IsTrue(true);
+ }
+
+ [Test]
+ public void MessageAsByteArray()
+ {
+ byte[] rawData = new byte[10];
+ for (byte i = 0; i < 10; i++)
+ rawData[i] = i;
+ Message m3 = new Message(rawData);
+
+ byte[] readback = new byte[m3.ContentSize];
+ m3.GetContent(readback);
+
+ for (byte i = 0; i < 10; i++)
+ Assert.AreEqual(i, readback[i]);
+ }
+
+ [Test]
+ public void MessageAsByteArraySlice()
+ {
+ byte[] rawData = new byte[10];
+ for (byte i = 0; i < 10; i++)
+ rawData[i] = i;
+ Message m3 = new Message(rawData, 1, 8);
+
+ Assert.AreEqual(8, m3.ContentSize);
+
+ byte[] readback = new byte[m3.ContentSize];
+ m3.GetContent(readback);
+
+ for (byte i = 0; i < 8; i++)
+ Assert.AreEqual(i + 1, readback[i]);
+ }
+
+
+ [Test]
+ public void MessageProperties()
+ {
+ Message msgGetSet = new Message("12345");
+
+ msgGetSet.Subject = "Subject";
+ msgGetSet.MessageId = "MessageId";
+ msgGetSet.UserId = "UserId";
+ msgGetSet.CorrelationId = "CorrelationId";
+ msgGetSet.Ttl = DurationConstants.SECOND;
+ msgGetSet.Priority = (byte)'z';
+ msgGetSet.Durable = false;
+ msgGetSet.Redelivered = true;
+
+ Dictionary<string, object> props = new Dictionary<string,object>();
+ props.Add("firstProperty", 1);
+ props.Add("secondProperty", 2);
+ msgGetSet.Properties = props;
+
+ Address replyToAddr = new Address("replyTo");
+ replyToAddr.Subject = "topsecret";
+ msgGetSet.ReplyTo = replyToAddr;
+
+ StringAssert.IsMatch("Subject", msgGetSet.Subject);
+ StringAssert.IsMatch("", msgGetSet.ContentType);
+ StringAssert.IsMatch("MessageId", msgGetSet.MessageId);
+ StringAssert.IsMatch("UserId", msgGetSet.UserId);
+ StringAssert.IsMatch("CorrelationId", msgGetSet.CorrelationId);
+ Assert.AreEqual(1000, msgGetSet.Ttl.Milliseconds);
+ Assert.AreEqual((byte)'z', msgGetSet.Priority);
+ Assert.IsFalse( msgGetSet.Durable);
+ Assert.IsTrue( msgGetSet.Redelivered);
+
+ Dictionary<string, object> gotProps = msgGetSet.Properties;
+ StringAssert.IsMatch("1", gotProps["firstProperty"].ToString());
+ StringAssert.IsMatch("2", gotProps["secondProperty"].ToString());
+
+ Address gotReply = msgGetSet.ReplyTo;
+ StringAssert.IsMatch("replyTo", gotReply.Name);
+ StringAssert.IsMatch("topsecret", msgGetSet.ReplyTo.Subject);
+ }
+
+ [Test]
+ public void SimpleMessageCopy()
+ {
+ Message m2 = new Message("rarely");
+ Message m3 = m2;
+
+ StringAssert.IsMatch("rarely", m3.GetContent());
+ }
+
+ [Test]
+ public void MessageAsMap_AllVariableTypes()
+ {
+ //
+ // Create structured content for the message. This example builds a
+ // map of items including a nested map and a list of values.
+ //
+ Dictionary<string, object> content = new Dictionary<string, object>();
+ Dictionary<string, object> subMap = new Dictionary<string, object>();
+ Collection<object> colors = new Collection<object>();
+
+ // add simple types
+ content["id"] = 987654321;
+ content["name"] = "Widget";
+ content["percent"] = 0.99;
+
+ // add nested amqp/map
+ subMap["name"] = "Smith";
+ subMap["number"] = 354;
+ content["nestedMap"] = subMap;
+
+ // add an amqp/list
+ colors.Add("red");
+ colors.Add("green");
+ colors.Add("white");
+ // list contains null value
+ colors.Add(null);
+ content["colorsList"] = colors;
+
+ // add one of each supported amqp data type
+ bool mybool = true;
+ content["mybool"] = mybool;
+
+ byte mybyte = 4;
+ content["mybyte"] = mybyte;
+
+ UInt16 myUInt16 = 5;
+ content["myUInt16"] = myUInt16;
+
+ UInt32 myUInt32 = 6;
+ content["myUInt32"] = myUInt32;
+
+ UInt64 myUInt64 = 7;
+ content["myUInt64"] = myUInt64;
+
+ char mychar = 'h';
+ content["mychar"] = mychar;
+
+ Int16 myInt16 = 9;
+ content["myInt16"] = myInt16;
+
+ Int32 myInt32 = 10;
+ content["myInt32"] = myInt32;
+
+ Int64 myInt64 = 11;
+ content["myInt64"] = myInt64;
+
+ Single mySingle = (Single)12.12;
+ content["mySingle"] = mySingle;
+
+ Double myDouble = 13.13;
+ content["myDouble"] = myDouble;
+
+ Guid myGuid = new Guid("000102030405060708090a0b0c0d0e0f");
+ content["myGuid"] = myGuid;
+
+ content["myNull"] = null;
+
+ // Create the message
+ Message message = new Message(content);
+
+ // Copy the message
+ Message rxMsg = message;
+
+ // Extract the content
+ Dictionary<string, object> rxContent = new Dictionary<string, object>();
+
+ rxMsg.GetContent(rxContent);
+
+ Dictionary<string, object> rxSubMap = (Dictionary<string, object>)rxContent["nestedMap"];
+
+ Collection<object> rxColors = (Collection<object>)rxContent["colorsList"];
+
+ StringAssert.IsMatch("System.Boolean", rxContent["mybool"].GetType().ToString());
+ bool rxbool = (bool)rxContent["mybool"];
+
+ StringAssert.IsMatch("System.SByte", rxContent["mybyte"].GetType().ToString());
+ sbyte rxbyte = (sbyte)rxContent["mybyte"];
+
+ StringAssert.IsMatch("System.UInt16", rxContent["myUInt16"].GetType().ToString());
+ UInt16 rxUInt16 = (UInt16)rxContent["myUInt16"];
+
+ StringAssert.IsMatch("System.UInt32", rxContent["myUInt32"].GetType().ToString());
+ UInt32 rxUInt32 = (UInt32)rxContent["myUInt32"];
+
+ StringAssert.IsMatch("System.UInt64", rxContent["myUInt64"].GetType().ToString());
+ UInt64 rxUInt64 = (UInt64)rxContent["myUInt64"];
+
+ StringAssert.IsMatch("System.Int32", rxContent["mychar"].GetType().ToString());
+ char rxchar = System.Convert.ToChar(rxContent["mychar"]);
+
+ StringAssert.IsMatch("System.Int16", rxContent["myInt16"].GetType().ToString());
+ Int16 rxInt16 = (Int16)rxContent["myInt16"];
+
+ StringAssert.IsMatch("System.Int32", rxContent["myInt32"].GetType().ToString());
+ Int32 rxInt32 = (Int32)rxContent["myInt32"];
+
+ StringAssert.IsMatch("System.Int64", rxContent["myInt64"].GetType().ToString());
+ Int64 rxInt64 = (Int64)rxContent["myInt64"];
+
+ StringAssert.IsMatch("System.Single", rxContent["mySingle"].GetType().ToString());
+ Single rxSingle = (Single)rxContent["mySingle"];
+
+ StringAssert.IsMatch("System.Double", rxContent["myDouble"].GetType().ToString());
+ Double rxDouble = (Double)rxContent["myDouble"];
+
+ StringAssert.IsMatch("System.Guid", rxContent["myGuid"].GetType().ToString());
+ Guid rxGuid = (Guid)rxContent["myGuid"];
+
+ // Verify the values
+
+ StringAssert.IsMatch("Smith", rxSubMap["name"].ToString());
+ Assert.AreEqual(4, rxColors.Count);
+ Assert.IsTrue(rxbool);
+ Assert.AreEqual(4, rxbyte);
+ Assert.AreEqual(5, rxUInt16);
+ Assert.AreEqual(6, rxUInt32);
+ Assert.AreEqual(7, rxUInt64);
+ Assert.AreEqual((char)'h', rxchar);
+ Assert.AreEqual(9, rxInt16);
+ Assert.AreEqual(10, rxInt32);
+ Assert.AreEqual(11, rxInt64);
+ Assert.AreEqual((Single)12.12, rxSingle);
+ Assert.AreEqual((Double)13.13, rxDouble);
+ StringAssert.IsMatch("00010203-0405-0607-0809-0a0b0c0d0e0f", rxGuid.ToString());
+ }
+ }
+}
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.direct.receiver/csharp.direct.receiver.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.direct.receiver/csharp.direct.receiver.csproj
new file mode 100644
index 0000000000..8a45098f73
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.direct.receiver/csharp.direct.receiver.csproj
@@ -0,0 +1,101 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{52F880E7-D677-4C91-8516-D679CE0F46A8}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.direct.receiver</RootNamespace>
+ <AssemblyName>csharp.direct.receiver</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.direct.receiver.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.direct.sender/csharp.direct.sender.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.direct.sender/csharp.direct.sender.csproj
new file mode 100644
index 0000000000..5f39484ee0
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.direct.sender/csharp.direct.sender.csproj
@@ -0,0 +1,84 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.direct.sender</RootNamespace>
+ <AssemblyName>csharp.direct.sender</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.direct.sender.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.client/csharp.example.client.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.client/csharp.example.client.csproj
new file mode 100644
index 0000000000..f07274c339
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.client/csharp.example.client.csproj
@@ -0,0 +1,101 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0DE01712-C2D1-4CA4-B42C-5856456A8696}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.client</RootNamespace>
+ <AssemblyName>csharp.example.client</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.example.client.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj
new file mode 100644
index 0000000000..e520a3351f
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.declare_queues/csharp.example.declare_queues.csproj
@@ -0,0 +1,101 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E31B349C-830C-4583-8BD9-30DA4398349F}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.declare_queues</RootNamespace>
+ <AssemblyName>csharp.example.declare_queues</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.example.declare_queues.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.drain/csharp.example.drain.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.drain/csharp.example.drain.csproj
new file mode 100644
index 0000000000..8b4b89541c
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.drain/csharp.example.drain.csproj
@@ -0,0 +1,102 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C43DEB69-8088-420B-B0CA-C699535E6D08}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.drain</RootNamespace>
+ <AssemblyName>csharp.example.drain</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.example.drain.cs" />
+ <Compile Include="Options.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.helloworld/csharp.example.helloworld.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.helloworld/csharp.example.helloworld.csproj
new file mode 100644
index 0000000000..627495348b
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.helloworld/csharp.example.helloworld.csproj
@@ -0,0 +1,101 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8CC1C265-0507-44A3-9483-8FAF48513F4D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.helloworld</RootNamespace>
+ <AssemblyName>csharp.example.helloworld</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.example.helloworld.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.server/csharp.example.server.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.server/csharp.example.server.csproj
new file mode 100644
index 0000000000..473078f7ca
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.server/csharp.example.server.csproj
@@ -0,0 +1,101 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{090A081D-E8B5-4949-AA43-EE182B7101E3}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.server</RootNamespace>
+ <AssemblyName>csharp.example.server</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.example.server.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.spout/csharp.example.spout.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.spout/csharp.example.spout.csproj
new file mode 100644
index 0000000000..26009880a4
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.example.spout/csharp.example.spout.csproj
@@ -0,0 +1,103 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{EB36626D-36C2-41B3-B65E-762BAF27F137}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.example.spout</RootNamespace>
+ <AssemblyName>csharp.example.spout</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.example.spout.cs" />
+ <Compile Include="Options.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj
new file mode 100644
index 0000000000..02f8a63282
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.callback.receiver/csharp.map.callback.receiver.csproj
@@ -0,0 +1,106 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{68A43817-2358-4A31-8FDF-FE21722BFBCF}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.map.callback.receiver</RootNamespace>
+ <AssemblyName>csharp.map.callback.receiver</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ <Reference Include="org.apache.qpid.messaging.sessionreceiver, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.sessionreceiver.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.map.callback.receiver.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj
new file mode 100644
index 0000000000..56b9f285a3
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.callback.sender/csharp.map.callback.sender.csproj
@@ -0,0 +1,105 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{12F1C14F-5C7D-4075-9BAE-C091394FF99A}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.map.callback.sender</RootNamespace>
+ <AssemblyName>csharp.map.callback.sender</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.map.callback.sender.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.receiver/csharp.map.receiver.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.receiver/csharp.map.receiver.csproj
new file mode 100644
index 0000000000..ac0a4e144d
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.receiver/csharp.map.receiver.csproj
@@ -0,0 +1,101 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.map.receiver</RootNamespace>
+ <AssemblyName>csharp.map.receiver</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.map.receiver.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.sender/csharp.map.sender.csproj b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.sender/csharp.map.sender.csproj
new file mode 100644
index 0000000000..eef669291b
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/examples/csharp.map.sender/csharp.map.sender.csproj
@@ -0,0 +1,101 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{5D8252F5-E1D3-44A0-94C7-7CB75E843C10}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>csharp.map.sender</RootNamespace>
+ <AssemblyName>csharp.map.sender</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</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>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <OutputPath>$(ProjectDir)..\..\..\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="org.apache.qpid.messaging, Version=1.0.3890.18681, Culture=neutral, PublicKeyToken=7e57166074abee8c, processorArchitecture=$(Platform)">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>$(ProjectDir)..\..\..\bin\org.apache.qpid.messaging.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="csharp.map.sender.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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>
diff --git a/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/winsdk_dotnet_examples.sln b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/winsdk_dotnet_examples.sln
new file mode 100644
index 0000000000..6db55b5590
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/dotnet/winsdk_sources/winsdk_dotnet_examples.sln
@@ -0,0 +1,178 @@
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License
+#
+
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.direct.sender", "examples\csharp.direct.sender\csharp.direct.sender.csproj", "{7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.direct.receiver", "examples\csharp.direct.receiver\csharp.direct.receiver.csproj", "{52F880E7-D677-4C91-8516-D679CE0F46A8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.map.sender", "examples\csharp.map.sender\csharp.map.sender.csproj", "{5D8252F5-E1D3-44A0-94C7-7CB75E843C10}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.map.receiver", "examples\csharp.map.receiver\csharp.map.receiver.csproj", "{AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.map.callback.receiver", "examples\csharp.map.callback.receiver\csharp.map.callback.receiver.csproj", "{68A43817-2358-4A31-8FDF-FE21722BFBCF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.map.callback.sender", "examples\csharp.map.callback.sender\csharp.map.callback.sender.csproj", "{12F1C14F-5C7D-4075-9BAE-C091394FF99A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.client", "examples\csharp.example.client\csharp.example.client.csproj", "{0DE01712-C2D1-4CA4-B42C-5856456A8696}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.server", "examples\csharp.example.server\csharp.example.server.csproj", "{090A081D-E8B5-4949-AA43-EE182B7101E3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.drain", "examples\csharp.example.drain\csharp.example.drain.csproj", "{C43DEB69-8088-420B-B0CA-C699535E6D08}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.spout", "examples\csharp.example.spout\csharp.example.spout.csproj", "{EB36626D-36C2-41B3-B65E-762BAF27F137}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.declare_queues", "examples\csharp.example.declare_queues\csharp.example.declare_queues.csproj", "{E31B349C-830C-4583-8BD9-30DA4398349F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.helloworld", "examples\csharp.example.helloworld\csharp.example.helloworld.csproj", "{8CC1C265-0507-44A3-9483-8FAF48513F4D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|Win32.ActiveCfg = Debug|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|x64.ActiveCfg = Debug|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|x64.Build.0 = Debug|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|x86.ActiveCfg = Debug|x86
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|x86.Build.0 = Debug|x86
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|Win32.ActiveCfg = Release|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|x64.ActiveCfg = Release|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|x64.Build.0 = Release|x64
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|x86.ActiveCfg = Release|x86
+ {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|x86.Build.0 = Release|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|x64.ActiveCfg = Debug|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|x64.Build.0 = Debug|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|x86.ActiveCfg = Debug|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|x86.Build.0 = Debug|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|x64.ActiveCfg = Release|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|x64.Build.0 = Release|x64
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|x86.ActiveCfg = Release|x86
+ {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|x86.Build.0 = Release|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Debug|x64.ActiveCfg = Debug|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Debug|x64.Build.0 = Debug|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Debug|x86.ActiveCfg = Debug|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Debug|x86.Build.0 = Debug|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Release|x64.ActiveCfg = Release|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Release|x64.Build.0 = Release|x64
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Release|x86.ActiveCfg = Release|x86
+ {5D8252F5-E1D3-44A0-94C7-7CB75E843C10}.Release|x86.Build.0 = Release|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Debug|x64.ActiveCfg = Debug|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Debug|x64.Build.0 = Debug|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Debug|x86.ActiveCfg = Debug|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Debug|x86.Build.0 = Debug|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Release|x64.ActiveCfg = Release|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Release|x64.Build.0 = Release|x64
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Release|x86.ActiveCfg = Release|x86
+ {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9}.Release|x86.Build.0 = Release|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Debug|x64.ActiveCfg = Debug|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Debug|x64.Build.0 = Debug|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Debug|x86.ActiveCfg = Debug|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Debug|x86.Build.0 = Debug|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Release|x64.ActiveCfg = Release|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Release|x64.Build.0 = Release|x64
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Release|x86.ActiveCfg = Release|x86
+ {68A43817-2358-4A31-8FDF-FE21722BFBCF}.Release|x86.Build.0 = Release|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Debug|x64.ActiveCfg = Debug|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Debug|x64.Build.0 = Debug|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Debug|x86.ActiveCfg = Debug|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Debug|x86.Build.0 = Debug|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Release|x64.ActiveCfg = Release|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Release|x64.Build.0 = Release|x64
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Release|x86.ActiveCfg = Release|x86
+ {12F1C14F-5C7D-4075-9BAE-C091394FF99A}.Release|x86.Build.0 = Release|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|Win32.ActiveCfg = Debug|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|x64.ActiveCfg = Debug|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|x64.Build.0 = Debug|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|x86.ActiveCfg = Debug|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Debug|x86.Build.0 = Debug|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|Win32.ActiveCfg = Release|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|x64.ActiveCfg = Release|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|x64.Build.0 = Release|x64
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|x86.ActiveCfg = Release|x86
+ {0DE01712-C2D1-4CA4-B42C-5856456A8696}.Release|x86.Build.0 = Release|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|Win32.ActiveCfg = Debug|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|x64.ActiveCfg = Debug|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|x64.Build.0 = Debug|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|x86.ActiveCfg = Debug|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Debug|x86.Build.0 = Debug|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|Win32.ActiveCfg = Release|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|x64.ActiveCfg = Release|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|x64.Build.0 = Release|x64
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|x86.ActiveCfg = Release|x86
+ {090A081D-E8B5-4949-AA43-EE182B7101E3}.Release|x86.Build.0 = Release|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|Win32.ActiveCfg = Debug|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|x64.ActiveCfg = Debug|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|x64.Build.0 = Debug|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|x86.ActiveCfg = Debug|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Debug|x86.Build.0 = Debug|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|Win32.ActiveCfg = Release|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|x64.ActiveCfg = Release|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|x64.Build.0 = Release|x64
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|x86.ActiveCfg = Release|x86
+ {C43DEB69-8088-420B-B0CA-C699535E6D08}.Release|x86.Build.0 = Release|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|Win32.ActiveCfg = Debug|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|x64.ActiveCfg = Debug|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|x64.Build.0 = Debug|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|x86.ActiveCfg = Debug|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Debug|x86.Build.0 = Debug|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|Win32.ActiveCfg = Release|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|x64.ActiveCfg = Release|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|x64.Build.0 = Release|x64
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|x86.ActiveCfg = Release|x86
+ {EB36626D-36C2-41B3-B65E-762BAF27F137}.Release|x86.Build.0 = Release|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|Win32.ActiveCfg = Debug|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|x64.ActiveCfg = Debug|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|x64.Build.0 = Debug|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|x86.ActiveCfg = Debug|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Debug|x86.Build.0 = Debug|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|Win32.ActiveCfg = Release|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x64.ActiveCfg = Release|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x64.Build.0 = Release|x64
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x86.ActiveCfg = Release|x86
+ {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x86.Build.0 = Release|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|Win32.ActiveCfg = Debug|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x64.ActiveCfg = Debug|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x64.Build.0 = Debug|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x86.ActiveCfg = Debug|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x86.Build.0 = Debug|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|Win32.ActiveCfg = Release|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x64.ActiveCfg = Release|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x64.Build.0 = Release|x64
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x86.ActiveCfg = Release|x86
+ {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x86.Build.0 = Release|x86
+ {7A13FEB0-3D89-4CCF-AA87-416A3D06303F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7A13FEB0-3D89-4CCF-AA87-416A3D06303F}.Debug|Win32.Build.0 = Debug|Win32
+ {7A13FEB0-3D89-4CCF-AA87-416A3D06303F}.Debug|x64.ActiveCfg = Debug|Win32
+ {7A13FEB0-3D89-4CCF-AA87-416A3D06303F}.Debug|x86.ActiveCfg = Debug|Win32
+ {7A13FEB0-3D89-4CCF-AA87-416A3D06303F}.Release|Win32.ActiveCfg = Release|Win32
+ {7A13FEB0-3D89-4CCF-AA87-416A3D06303F}.Release|Win32.Build.0 = Release|Win32
+ {7A13FEB0-3D89-4CCF-AA87-416A3D06303F}.Release|x64.ActiveCfg = Release|Win32
+ {7A13FEB0-3D89-4CCF-AA87-416A3D06303F}.Release|x86.ActiveCfg = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/qpid/cpp/bindings/qpid/examples/perl/README b/qpid/cpp/bindings/qpid/examples/perl/README
new file mode 100644
index 0000000000..1e113f1fa0
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/README
@@ -0,0 +1,26 @@
+# 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.
+
+
+The examples in this directory are written against the raw Perl
+binding ("cqpid"). This binding is identical to the C++ messaging (in
+namespace qpid::messaging).
+
+It is desired that a layer will be written over this interface (called
+"qpid") that provides a more Perl-specific API. When this occurs,
+these examples will be changed to use the new Perl API.
+
diff --git a/qpid/cpp/bindings/qpid/examples/perl/client.pl b/qpid/cpp/bindings/qpid/examples/perl/client.pl
new file mode 100644
index 0000000000..19d9d3f14f
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/client.pl
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+use strict;
+use warnings;
+
+use cqpid_perl;
+
+my $url = ( @ARGV == 1 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
+my $connectionOptions = ( @ARGV > 1 ) ? $ARGV[1] : "";
+
+
+my $connection = new cqpid_perl::Connection($url, $connectionOptions);
+
+eval {
+$connection->open();
+my $session = $connection->createSession();
+
+my $sender = $session->createSender("service_queue");
+
+#create temp queue & receiver...
+my $responseQueue = new cqpid_perl::Address("#response-queue; {create:always, delete:always}");
+my $receiver = $session->createReceiver($responseQueue);
+
+#Now send some messages...
+
+my @s = (
+ "Twas brillig, and the slithy toves",
+ "Did gire and gymble in the wabe.",
+ "All mimsy were the borogroves,",
+ "And the mome raths outgrabe."
+ );
+
+my $request = new cqpid_perl::Message();
+$request->setReplyTo($responseQueue);
+for (my $i=0; $i<4; $i++) {
+ $request->setContent($s[$i]);
+ $sender->send($request);
+ my $response = $receiver->fetch();
+ print $request->getContent() . " -> " . $response->getContent() . "\n";
+}
+
+$connection->close();
+};
+
+if ($@) {
+ die $@;
+}
+
+
diff --git a/qpid/cpp/bindings/qpid/examples/perl/drain.pl b/qpid/cpp/bindings/qpid/examples/perl/drain.pl
new file mode 100644
index 0000000000..60ac0c50ed
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/drain.pl
@@ -0,0 +1,98 @@
+#!/usr/bin/perl
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+use strict;
+use warnings;
+
+use cqpid_perl;
+use Getopt::Long;
+
+my $url = "127.0.0.1";
+my $timeout = 60;
+my $forever = 0;
+my $count = 1;
+my $connectionOptions = "";
+my $address = "amq.direct";
+
+my $result = GetOptions(
+ "broker|b=s" => \ $url,
+ "timeout|t=i" => \ $timeout,
+ "forever|f" => \ $forever,
+ "connection-options=s" => \ $connectionOptions,
+ "count|c=i" => \ $count,
+);
+
+if (! $result) {
+ print "Usage: perl drain.pl [OPTIONS]\n";
+}
+
+if ($#ARGV ge 0) {
+ $address = $ARGV[0]
+}
+
+sub getTimeout {
+ return ($forever) ? $cqpid_perl::Duration::FOREVER : new cqpid_perl::Duration($timeout*1000);
+}
+
+
+my $connection = new cqpid_perl::Connection($url, $connectionOptions);
+
+eval {
+ $connection->open();
+ my $session = $connection->createSession();
+ my $receiver = $session->createReceiver($address);
+ my $timeout = getTimeout();
+
+ my $message = new cqpid_perl::Message();
+ my $i = 0;
+
+ while($receiver->fetch($message, $timeout)) {
+ print "Message(properties=" . $message->getProperties() . ",content='";
+ if ($message->getContentType() eq "amqp/map") {
+ my $content = cqpid_perl::decodeMap($message);
+ map{ print "\n$_ => $content->{$_}"; } keys %{$content};
+ }
+ else {
+ print $message->getContent();
+ }
+ print "')\n";
+
+ my $replyto = $message->getReplyTo();
+ if ($replyto->getName()) {
+ print "Replying to " . $message->getReplyTo()->str() . "...\n";
+ my $sender = $session->createSender($replyto);
+ my $response = new cqpid_perl::Message("received by the server.");
+ $sender->send($response);
+ }
+ $session->acknowledge();
+
+ if ($count and (++$i ==$count)) {
+ last;
+ }
+ }
+ $receiver->close();
+ $session->close();
+ $connection->close();
+};
+
+if ($@) {
+ $connection->close();
+ die $@;
+}
+
diff --git a/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl b/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl
new file mode 100644
index 0000000000..a96b98a002
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/hello_world.pl
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+use strict;
+use warnings;
+use Data::Dumper;
+
+use cqpid_perl;
+
+my $broker = ( @ARGV > 0 ) ? $ARGV[0] : "localhost:5672";
+my $address = ( @ARGV > 1 ) ? $ARGV[0] : "amq.topic";
+my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[1] : "";
+
+my $connection = new cqpid_perl::Connection($broker, $connectionOptions);
+
+eval {
+ $connection->open();
+ my $session = $connection->createSession();
+
+ my $receiver = $session->createReceiver($address);
+ my $sender = $session->createSender($address);
+
+ $sender->send(new cqpid_perl::Message("Hello world!"));
+
+ #my $duration = new cqpid_perl::Duration(1000);
+ #print ">>>" . $duration->getMilliseconds() . "\n";
+
+ my $message = $receiver->fetch($cqpid_perl::Duration::SECOND);
+
+ #$message->setDurable(1);
+ #print "Durable: " . $message->getDurable() . "\n";
+ #print Dumper($message->getProperties());
+
+ print $message->getContent() . "\n";
+ $session->acknowledge();
+
+ $connection->close();
+};
+
+die $@ if ($@);
diff --git a/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl b/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl
new file mode 100644
index 0000000000..cebf2ceee6
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/hello_xml.pl
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+use strict;
+use warnings;
+
+use cqpid_perl;
+
+my $broker = ( @ARGV > 0 ) ? $ARGV[0] : "localhost:5672";
+my $connectionOptions = ( @ARGV > 1 ) ? $ARGV[1] : "";
+
+my $query = <<END;
+ let \$w := ./weather
+ return \$w/station = 'Raleigh-Durham International Airport (KRDU)'
+ and \$w/temperature_f > 50
+ and \$w/temperature_f - \$w/dewpoint > 5
+ and \$w/wind_speed_mph > 7
+ and \$w/wind_speed_mph < 20
+END
+
+my $address = <<END;
+xml-exchange; {
+create: always,
+node: { type: topic, x-declare: { type: xml } },
+link: {
+x-bindings: [{ exchange: xml-exchange, key: weather, arguments: { xquery:" $query" } }]
+}}
+END
+
+
+my $connection = new cqpid_perl::Connection($broker, $connectionOptions);
+
+eval {
+ $connection->open();
+ my $session = $connection->createSession();
+
+ my $receiver = $session->createReceiver($address);
+
+ my $message = new cqpid_perl::Message();
+
+ my $content = <<END;
+ <weather>
+ <station>Raleigh-Durham International Airport (KRDU)</station>
+ <wind_speed_mph>16</wind_speed_mph>
+ <temperature_f>70</temperature_f>
+ <dewpoint>35</dewpoint>
+ </weather>
+END
+
+ $message->setContent($content);
+ my $sender = $session->createSender('xml-exchange/weather');
+ $sender->send($message);
+
+ my $response = $receiver->fetch();
+ print $response->getContent() . "\n";
+
+ $connection->close();
+};
+
+die $@ if ($@);
diff --git a/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl b/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl
new file mode 100644
index 0000000000..2e2611e38f
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/map_receiver.pl
@@ -0,0 +1,47 @@
+#! /usr/bin/perl5
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+use strict;
+use warnings;
+use Data::Dumper;
+
+use cqpid_perl;
+
+my $url = ( @ARGV > 0 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
+my $address = ( @ARGV > 1 ) ? $ARGV[0] : "message_queue; {create: always}";
+my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[1] : "";
+
+my $connection = new cqpid_perl::Connection($url, $connectionOptions);
+
+eval {
+ $connection->open();
+ my $session = $connection->createSession();
+ my $receiver = $session->createReceiver($address);
+
+ my $content = cqpid_perl::decodeMap($receiver->fetch());
+ #my $content = cqpid_perl::decodeList($receiver->fetch());
+
+ print Dumper($content);
+
+ $session->acknowledge();
+ $receiver->close();
+ $connection->close();
+};
+
+die $@ if ($@);
diff --git a/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl b/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl
new file mode 100644
index 0000000000..4107cd48b9
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/map_sender.pl
@@ -0,0 +1,50 @@
+#! /usr/bin/perl5
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+use strict;
+use warnings;
+use Data::Dumper;
+
+use cqpid_perl;
+
+my $url = ( @ARGV > 0 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
+my $address = ( @ARGV > 1 ) ? $ARGV[1] : "message_queue; {create: always}";
+my $connectionOptions = ( @ARGV > 2 ) ? $ARGV[2] : "";
+
+my $connection = new cqpid_perl::Connection($url, $connectionOptions);
+
+eval {
+ $connection->open();
+
+ my $session = $connection->createSession();
+ my $sender = $session->createSender($address);
+
+ my $message = new cqpid_perl::Message();
+ my $content = { id => 987654321,
+ name => "Widget",
+ percent => sprintf("%.2f", 0.99),
+ colours => [ qw (red green white) ],
+ };
+ cqpid_perl::encode($content, $message);
+ $sender->send($message, 1);
+
+ $connection->close();
+};
+
+die $@ if ($@);
diff --git a/qpid/cpp/bindings/qpid/examples/perl/server.pl b/qpid/cpp/bindings/qpid/examples/perl/server.pl
new file mode 100644
index 0000000000..b14da565b9
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/server.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+use strict;
+use warnings;
+
+use cqpid_perl;
+
+my $url = ( @ARGV == 1 ) ? $ARGV[0] : "amqp:tcp:127.0.0.1:5672";
+my $connectionOptions = ( @ARGV > 1 ) ? $ARGV[1] : "";
+
+
+my $connection = new cqpid_perl::Connection($url, $connectionOptions);
+
+eval {
+ $connection->open();
+ my $session = $connection->createSession();
+
+ my $receiver = $session->createReceiver("service_queue; {create: always}");
+
+ while (1) {
+ my $request = $receiver->fetch();
+ my $address = $request->getReplyTo();
+ if ($address) {
+ my $sender = $session->createSender($address);
+ my $s = $request->getContent();
+ $s = uc($s);
+ my $response = new cqpid_perl::Message($s);
+ $sender->send($response);
+ print "Processed request: " . $request->getContent() . " -> " . $response->getContent() . "\n";
+ $session->acknowledge();
+ }
+ else {
+ print "Error: no reply address specified for request: " . $request->getContent() . "\n";
+ $session->reject($request);
+ }
+ }
+
+$connection->close();
+};
+
+if ($@) {
+ die $@;
+}
+
+
diff --git a/qpid/cpp/bindings/qpid/examples/perl/spout.pl b/qpid/cpp/bindings/qpid/examples/perl/spout.pl
new file mode 100644
index 0000000000..7365e732bf
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/examples/perl/spout.pl
@@ -0,0 +1,136 @@
+#!/usr/bin/perl
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+use strict;
+use warnings;
+
+use cqpid_perl;
+use Getopt::Long;
+use Time::Local;
+
+my $url = "127.0.0.1";
+my $timeout = 0;
+my $count = 1;
+my $id = "";
+my $replyto = "";
+my @properties;
+my @entries;
+my $content = "";
+my $connectionOptions = "";
+my $address = "amq.direct";
+
+my $result = GetOptions(
+ "broker|b=s" => \ $url,
+ "timeout|t=i" => \ $timeout,
+ "count|c=i" => \ $count,
+ "id|i=s" => \ $id,
+ "replyto=s" => \ $replyto,
+ "property|p=s@" => \ @properties,
+ "map|m=s@" => \ @entries,
+ "content=s" => \ $content,
+ "connection-options=s" => \ $connectionOptions,
+);
+
+
+if (! $result) {
+ print "Usage: perl drain.pl [OPTIONS]\n";
+}
+
+
+if ($#ARGV ge 0) {
+ $address = $ARGV[0]
+}
+
+
+sub setEntries {
+ my ($content) = @_;
+
+ foreach (@entries) {
+ my ($name, $value) = split("=", $_);
+ $content->{$name} = $value;
+ }
+}
+
+
+sub setProperties {
+ my ($message) = @_;
+
+ foreach (@properties) {
+ my ($name, $value) = split("=", $_);
+ $message->getProperties()->{$name} = $value;
+ }
+}
+
+my $connection = new cqpid_perl::Connection($url, $connectionOptions);
+
+eval {
+ $connection->open();
+ my $session = $connection->createSession();
+ my $sender = $session->createSender($address);
+
+ my $message = new cqpid_perl::Message();
+ setProperties($message) if (@properties);
+ if (@entries) {
+ my $content = {};
+ setEntries($content);
+ cqpid_perl::encode($content, $message);
+ }
+ elsif ($content) {
+ $message->setContent($content);
+ $message->setContentType("text/plain");
+ }
+
+ my $receiver;
+ if ($replyto) {
+ my $responseQueue = new cqpid_perl::Address($replyto);
+ $receiver = $session->createReceiver($responseQueue);
+ $message->setReplyTo($responseQueue);
+ }
+
+ my $start = localtime;
+ my @s = split(/[:\s]/, $start);
+ my $s = "$s[3]$s[4]$s[5]";
+ my $n = $s;
+
+ for (my $i = 0;
+ ($i < $count || $count == 0) and
+ ($timeout == 0 || abs($n - $s) < $timeout);
+ $i++) {
+
+ $sender->send($message);
+
+ if ($receiver) {
+ my $response = $receiver->fetch();
+ print "$i -> " . $response->getContent() . "\n";
+ }
+
+ my $now = localtime;
+ my @n = split(/[:\s]/, $now);
+ my $n = "$n[3]$n[4]$n[5]";
+ }
+ $session->sync();
+ $connection->close();
+};
+
+if ($@) {
+ $connection->close();
+ die $@;
+}
+
+
diff --git a/qpid/cpp/bindings/qpid/perl/CMakeLists.txt b/qpid/cpp/bindings/qpid/perl/CMakeLists.txt
new file mode 100644
index 0000000000..6edaf284b1
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/perl/CMakeLists.txt
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+##------------------------------------------------------
+## Use Swig to generate a literal binding to the C++ API
+##------------------------------------------------------
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/perl.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/perl.i PROPERTIES SWIG_FLAGS "-I${qpid-cpp_SOURCE_DIR}/include")
+
+swig_add_module(cqpid_perl perl ${CMAKE_CURRENT_SOURCE_DIR}/perl.i)
+swig_link_libraries(cqpid_perl qpidmessaging qpidtypes qmf2 ${PERL_LIBRARY})
+
+set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing -I${PERL_INCLUDE_PATH} -I${qpid-cpp_SOURCE_DIR}/include")
+
+##----------------------------------
+## Install the complete Perl binding
+##----------------------------------
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcqpid_perl.so
+ ${CMAKE_CURRENT_BINARY_DIR}/cqpid_perl.pm
+ DESTINATION ${PERL_VENDORARCH}
+ COMPONENT ${QPID_COMPONENT_CLIENT}
+ )
diff --git a/qpid/cpp/bindings/qpid/perl/Makefile.am b/qpid/cpp/bindings/qpid/perl/Makefile.am
new file mode 100644
index 0000000000..da082896e8
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/perl/Makefile.am
@@ -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.
+#
+
+if HAVE_PERL_DEVEL
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src -I$(top_builddir)/src -I$(PERL_INC)
+
+EXTRA_DIST = CMakeLists.txt perl.i
+BUILT_SOURCES = cqpid_perl.cpp
+SWIG_FLAGS = -w362,401
+
+cqpid_perl.cpp: $(srcdir)/perl.i $(srcdir)/../qpid.i $(srcdir)/../../swig_perl_typemaps.i
+ $(SWIG) -perl -c++ $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I/usr/include -o cqpid_perl.cpp $(srcdir)/perl.i
+
+lib_LTLIBRARIES = libcqpid_perl.la
+cqpid_perl_PERL = cqpid_perl.pm
+
+libcqpid_perl_la_LDFLAGS = -avoid-version -shared
+libcqpid_perl_la_LIBADD = -L$(top_builddir)/src/.libs -lqpidmessaging -lqpidtypes \
+ $(top_builddir)/src/libqpidmessaging.la $(top_builddir)/src/libqpidtypes.la
+libcqpid_perl_la_CXXFLAGS = $(INCLUDES) -fno-strict-aliasing
+nodist_libcqpid_perl_la_SOURCES = cqpid_perl.cpp
+
+CLEANFILES = cqpid_perl.cpp cqpid_perl.pm
+
+endif # HAVE_PERL_DEVEL
diff --git a/qpid/cpp/bindings/qpid/perl/perl.i b/qpid/cpp/bindings/qpid/perl/perl.i
new file mode 100644
index 0000000000..38ac91761f
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/perl/perl.i
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+%module cqpid_perl
+%include "std_string.i"
+%include "../../swig_perl_typemaps.i"
+
+/* Define the general-purpose exception handling */
+%exception {
+ try {
+ $action
+ }
+ catch (qpid::messaging::MessagingException& mex) {
+ Perl_croak(aTHX_ mex.what());
+ }
+}
+
+%include "../qpid.i"
+
diff --git a/qpid/cpp/bindings/qpid/python/CMakeLists.txt b/qpid/cpp/bindings/qpid/python/CMakeLists.txt
new file mode 100644
index 0000000000..5e4649cd7c
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/python/CMakeLists.txt
@@ -0,0 +1,45 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+##------------------------------------------------------
+## Use Swig to generate a literal binding to the C++ API
+##------------------------------------------------------
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/python.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/python.i PROPERTIES SWIG_FLAGS "-I${qpid-cpp_SOURCE_DIR}/include")
+
+swig_add_module(cqpid python ${CMAKE_CURRENT_SOURCE_DIR}/python.i)
+swig_link_libraries(cqpid qpidmessaging qpidtypes qmf2 ${PYTHON_LIBRARIES})
+
+set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing -I${PYTHON_INCLUDE_PATH} -I${qpid-cpp_SOURCE_DIR}/include")
+
+##------------------------------------
+## Install the complete Python binding
+##------------------------------------
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
+install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m py_compile cqpid.py
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
+install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile cqpid.py
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cqpid.py
+ ${CMAKE_CURRENT_BINARY_DIR}/cqpid.pyc
+ ${CMAKE_CURRENT_BINARY_DIR}/cqpid.pyo
+ ${CMAKE_CURRENT_BINARY_DIR}/_cqpid.so
+ DESTINATION ${PYTHON_SITE_PACKAGES}
+ COMPONENT ${QPID_COMPONENT_CLIENT}
+ )
diff --git a/qpid/cpp/bindings/qpid/python/Makefile.am b/qpid/cpp/bindings/qpid/python/Makefile.am
new file mode 100644
index 0000000000..dd25f34829
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/python/Makefile.am
@@ -0,0 +1,49 @@
+#
+# 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.
+#
+
+if HAVE_PYTHON_DEVEL
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src/qmf -I$(top_srcdir)/src -I$(top_builddir)/src
+
+generated_file_list = \
+ cqpid.cpp \
+ cqpid.py
+
+EXTRA_DIST = CMakeLists.txt python.i
+BUILT_SOURCES = $(generated_file_list)
+SWIG_FLAGS = -w362,401
+
+$(generated_file_list): $(srcdir)/python.i $(srcdir)/../qpid.i $(srcdir)/../../swig_python_typemaps.i
+ $(SWIG) -c++ -python $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I$(top_srcdir)/src/qmf -I/usr/include -o cqpid.cpp $(srcdir)/python.i
+
+pylibdir = $(PYTHON_LIB)
+
+lib_LTLIBRARIES = _cqpid.la
+cqpiddir = $(pyexecdir)
+cqpid_PYTHON = cqpid.py
+
+_cqpid_la_LDFLAGS = -avoid-version -module -shared
+_cqpid_la_LIBADD = $(PYTHON_LIBS) -L$(top_builddir)/src/.libs -lqpidmessaging -lqpidtypes $(top_builddir)/src/libqpidmessaging.la $(top_builddir)/src/libqpidtypes.la
+_cqpid_la_CXXFLAGS = $(INCLUDES) -I$(PYTHON_INC) -fno-strict-aliasing
+nodist__cqpid_la_SOURCES = cqpid.cpp
+
+CLEANFILES = $(generated_file_list)
+
+endif # HAVE_PYTHON_DEVEL
+
diff --git a/qpid/cpp/bindings/qpid/python/python.i b/qpid/cpp/bindings/qpid/python/python.i
new file mode 100644
index 0000000000..bf61cb10b7
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/python/python.i
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+%module cqpid
+%include "std_string.i"
+%include "../../swig_python_typemaps.i"
+
+/* Define the general-purpose exception handling */
+%exception {
+ std::string error;
+ Py_BEGIN_ALLOW_THREADS;
+ try {
+ $action
+ } catch (qpid::types::Exception& ex) {
+ error = ex.what();
+ }
+ Py_END_ALLOW_THREADS;
+ if (!error.empty()) {
+ PyErr_SetString(PyExc_RuntimeError, error.c_str());
+ return NULL;
+ }
+}
+
+%include "../qpid.i"
+
diff --git a/qpid/cpp/bindings/qpid/qpid.i b/qpid/cpp/bindings/qpid/qpid.i
new file mode 100644
index 0000000000..352bafa3c8
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/qpid.i
@@ -0,0 +1,70 @@
+/*
+ * 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 <qpid/messaging/exceptions.h>
+#include <qpid/messaging/Address.h>
+#include <qpid/messaging/Connection.h>
+#include <qpid/messaging/Session.h>
+#include <qpid/messaging/Receiver.h>
+#include <qpid/messaging/Sender.h>
+#include <qpid/messaging/Message.h>
+#include <qpid/messaging/Duration.h>
+#include <qpid/messaging/FailoverUpdates.h>
+
+//
+// Wrapper functions for map-decode and list-decode. This allows us to avoid
+// the complexity of output parameter mapping.
+//
+qpid::types::Variant::Map& decodeMap(const qpid::messaging::Message& msg) {
+ static qpid::types::Variant::Map map;
+ map.clear();
+ qpid::messaging::decode(msg, map);
+ return map;
+}
+
+qpid::types::Variant::List& decodeList(const qpid::messaging::Message& msg) {
+ static qpid::types::Variant::List list;
+ list.clear();
+ qpid::messaging::decode(msg, list);
+ return list;
+}
+
+%}
+
+%include <qpid/ImportExport.h>
+%include <qpid/messaging/ImportExport.h>
+%include <qpid/messaging/Address.h>
+%include <qpid/messaging/Duration.h>
+%include <qpid/messaging/Message.h>
+%include <qpid/messaging/Receiver.h>
+%include <qpid/messaging/Sender.h>
+%include <qpid/messaging/Session.h>
+%include <qpid/messaging/Connection.h>
+%include <qpid/messaging/FailoverUpdates.h>
+
+qpid::types::Variant::Map& decodeMap(const qpid::messaging::Message&);
+qpid::types::Variant::List& decodeList(const qpid::messaging::Message&);
+
+
+%{
+
+%};
+
diff --git a/qpid/cpp/bindings/qpid/ruby/CMakeLists.txt b/qpid/cpp/bindings/qpid/ruby/CMakeLists.txt
new file mode 100644
index 0000000000..96c00154ba
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/CMakeLists.txt
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+##------------------------------------------------------
+## Use Swig to generate a literal binding to the C++ API
+##------------------------------------------------------
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/ruby.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/ruby.i PROPERTIES SWIG_FLAGS "-I${qpid-cpp_SOURCE_DIR}/include")
+
+swig_add_module(cqpid ruby ${CMAKE_CURRENT_SOURCE_DIR}/ruby.i)
+swig_link_libraries(cqpid qpidmessaging qpidtypes qmf2 ${RUBY_LIBRARY})
+
+set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing -I${RUBY_INCLUDE_DIR} -I${qpid-cpp_SOURCE_DIR}/include")
+
+##----------------------------------
+## Install the complete Ruby binding
+##----------------------------------
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcqpid.so
+ RENAME cqpid.so
+ DESTINATION ${RUBY_SITEARCH_DIR}
+ COMPONENT ${QPID_COMPONENT_CLIENT}
+ )
diff --git a/qpid/cpp/bindings/qpid/ruby/Makefile.am b/qpid/cpp/bindings/qpid/ruby/Makefile.am
new file mode 100644
index 0000000000..a2a5dd76bd
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/Makefile.am
@@ -0,0 +1,44 @@
+#
+# 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.
+#
+
+if HAVE_RUBY_DEVEL
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src -I$(top_builddir)/src
+
+EXTRA_DIST = CMakeLists.txt ruby.i
+BUILT_SOURCES = cqpid.cpp
+SWIG_FLAGS = -w362,401
+
+rubylibdir = $(RUBY_LIB)
+
+cqpid.cpp: $(srcdir)/ruby.i $(srcdir)/../qpid.i $(srcdir)/../../swig_ruby_typemaps.i
+ $(SWIG) -ruby -c++ $(SWIG_FLAGS) $(INCLUDES) $(QPID_CXXFLAGS) -I/usr/include -o cqpid.cpp $(srcdir)/ruby.i
+
+rubylibarchdir = $(RUBY_LIB_ARCH)
+rubylibarch_LTLIBRARIES = cqpid.la
+
+cqpid_la_LDFLAGS = -avoid-version -module -shared -shrext ".$(RUBY_DLEXT)"
+cqpid_la_LIBADD = $(RUBY_LIBS) -L$(top_builddir)/src/.libs -lqpidmessaging -lqpidtypes \
+ $(top_builddir)/src/libqpidmessaging.la $(top_builddir)/src/libqpidtypes.la
+cqpid_la_CXXFLAGS = $(INCLUDES) -I$(RUBY_INC) -I$(RUBY_INC_ARCH) -fno-strict-aliasing
+nodist_cqpid_la_SOURCES = cqpid.cpp
+
+CLEANFILES = cqpid.cpp
+
+endif # HAVE_RUBY_DEVEL
diff --git a/qpid/cpp/bindings/qpid/ruby/ruby.i b/qpid/cpp/bindings/qpid/ruby/ruby.i
new file mode 100644
index 0000000000..76463f7ddd
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/ruby.i
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+%module cqpid
+%include "std_string.i"
+%include "../../swig_ruby_typemaps.i"
+
+/* Define the general-purpose exception handling */
+%exception {
+ try {
+ $action
+ }
+ catch (qpid::messaging::MessagingException& mex) {
+ static VALUE merror = rb_define_class("MessagingError", rb_eStandardError);
+ rb_raise(merror, mex.what());
+ }
+}
+
+%include "../qpid.i"
+
diff --git a/qpid/cpp/bindings/swig_perl_typemaps.i b/qpid/cpp/bindings/swig_perl_typemaps.i
new file mode 100644
index 0000000000..831576a7d4
--- /dev/null
+++ b/qpid/cpp/bindings/swig_perl_typemaps.i
@@ -0,0 +1,330 @@
+/*
+ * 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.
+ */
+
+%wrapper %{
+
+#include <stdarg.h>
+
+ SV* MapToPerl(const qpid::types::Variant::Map*);
+ SV* ListToPerl(const qpid::types::Variant::List*);
+ void PerlToMap(SV*, qpid::types::Variant::Map*);
+ void PerlToList(SV*, qpid::types::Variant::List*);
+
+ qpid::types::Variant PerlToVariant(SV* value) {
+ if (SvROK(value)) {
+ if (SvTYPE(SvRV(value)) == SVt_PVHV) {
+ qpid::types::Variant::Map map;
+ PerlToMap(value, &map);
+ return qpid::types::Variant(map);
+ }
+ else if (SvTYPE(SvRV(value)) == SVt_PVAV) {
+ qpid::types::Variant::List list;
+ PerlToList(value, &list);
+ return qpid::types::Variant(list);
+ }
+ }
+ else {
+ if (SvIOK(value)) {
+ return qpid::types::Variant((int64_t) SvIV(value));
+ }
+ else if (SvNOK(value)) {
+ return qpid::types::Variant((float)SvNV(value));
+ }
+ else if (SvPOK(value)) {
+ return qpid::types::Variant(std::string(SvPV_nolen(value)));
+ }
+ }
+ return qpid::types::Variant();
+ }
+
+ SV* VariantToPerl(const qpid::types::Variant* v) {
+ SV* result = newSV(0);
+ try {
+ switch (v->getType()) {
+ case qpid::types::VAR_VOID: {
+ sv_setiv(result, (IV)0);
+ break;
+ }
+ case qpid::types::VAR_BOOL : {
+ result = boolSV(v->asBool());
+ break;
+ }
+ case qpid::types::VAR_UINT8 :
+ case qpid::types::VAR_UINT16 :
+ case qpid::types::VAR_UINT32 : {
+ sv_setuv(result, (UV)v->asUint32());
+ break;
+ }
+ case qpid::types::VAR_UINT64 : {
+ sv_setuv(result, (UV)v->asUint64());
+ break;
+ }
+ case qpid::types::VAR_INT8 :
+ case qpid::types::VAR_INT16 :
+ case qpid::types::VAR_INT32 : {
+ sv_setiv(result, (IV)v->asInt32());
+ break;
+ }
+ case qpid::types::VAR_INT64 : {
+ sv_setiv(result, (IV)v->asInt64());
+ break;
+ }
+ case qpid::types::VAR_FLOAT : {
+ sv_setnv(result, (double)v->asFloat());
+ break;
+ }
+ case qpid::types::VAR_DOUBLE : {
+ sv_setnv(result, (double)v->asDouble());
+ break;
+ }
+ case qpid::types::VAR_STRING : {
+ const std::string val(v->asString());
+ result = newSVpvn(val.c_str(), val.size());
+ break;
+ }
+ case qpid::types::VAR_MAP : {
+ result = MapToPerl(&(v->asMap()));
+ break;
+ }
+ case qpid::types::VAR_LIST : {
+ result = ListToPerl(&(v->asList()));
+ break;
+ }
+ case qpid::types::VAR_UUID : {
+ }
+ }
+ } catch (qpid::types::Exception& ex) {
+ Perl_croak(aTHX_ ex.what());
+ }
+
+ return result;
+ }
+
+ SV* MapToPerl(const qpid::types::Variant::Map* map) {
+ SV *result = newSV(0);
+ HV *hv = (HV *)sv_2mortal((SV *)newHV());
+ qpid::types::Variant::Map::const_iterator iter;
+ for (iter = map->begin(); iter != map->end(); iter++) {
+ const std::string key(iter->first);
+ SV* perlval = VariantToPerl(&(iter->second));
+ hv_store(hv, key.c_str(), key.size(), perlval, 0);
+ }
+ SvSetSV(result, newRV_noinc((SV *)hv));
+ return result;
+ }
+
+ SV* ListToPerl(const qpid::types::Variant::List* list) {
+ SV* result = newSV(0);
+ AV* av = (AV *)sv_2mortal((SV *)newAV());
+ qpid::types::Variant::List::const_iterator iter;
+ for (iter = list->begin(); iter != list->end(); iter++) {
+ SV* perlval = VariantToPerl(&(*iter));
+ av_push(av, perlval);
+ }
+ SvSetSV(result, newRV_noinc((SV *)av));
+ return result;
+ }
+
+ void PerlToMap(SV* hash, qpid::types::Variant::Map* map) {
+ map->clear();
+ HV* hv = (HV *)SvRV(hash);
+ HE* he;
+ while((he = hv_iternext(hv)) != NULL) {
+ SV* svkey = HeSVKEY_force(he);
+ SV* svval = HeVAL(he);
+ (*map)[std::string(SvPV_nolen(svkey))] = PerlToVariant(svval);
+ }
+ }
+
+ void PerlToList(SV* ary, qpid::types::Variant::List* list) {
+ list->clear();
+ AV * av = (AV *)SvRV(ary);
+ I32 len = av_len(av) + 1;
+ if (len > 0) {
+ for (I32 i = 0; i < len; i++) {
+ list->push_back(PerlToVariant(*av_fetch(av, i, 0)));
+ }
+ }
+ }
+%}
+
+%typemap (in) void * {
+ $1 = (void *)SvIV($input);
+}
+
+%typemap (out) void * {
+ sv_setiv($result, (IV)$1);
+ argvi++;
+}
+
+%typemap (in) uint16_t, uint32_t, uint64_t {
+ if (SvIOK($input)) {
+ $1 = ($1_ltype)SvUV($input);
+ }
+ else {
+ SWIG_exception_fail(SWIG_ValueError, "not an integer");
+ }
+}
+
+%typemap (out) uint16_t, uint32_t, uint64_t {
+ sv_setuv($result, (UV)$1);
+ argvi++;
+}
+
+%typemap (in) int32_t, int64_t {
+ if (SvIOK($input)) {
+ $1 = ($1_ltype)SvIV($input);
+ }
+ else {
+ SWIG_exception_fail(SWIG_ValueError, "not an integer");
+ }
+}
+
+%typemap (out) int32_t, int64_t {
+ sv_setiv($result, (IV)$1);
+ argvi++;
+}
+
+%typemap(in) bool {
+ $1 = (bool)SvTRUE($input);
+}
+
+%typemap (out) bool {
+ $result = boolSV($1);
+ argvi++;
+}
+
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_UINT64) uint64_t {
+ $1 = SvIOK($input) ? 1 : 0;
+}
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_UINT32) uint32_t {
+ $1 = SvIOK($input) ? 1 : 0;
+}
+
+
+/*
+ * Variant types: C++ --> Perl
+ */
+%typemap(out) qpid::types::Variant::Map {
+ $result = MapToPerl(&$1);
+ argvi++;
+}
+
+%typemap(out) qpid::types::Variant::Map& {
+ $result = MapToPerl($1);
+ argvi++;
+}
+
+%typemap(out) qpid::types::Variant::List {
+ $result = ListToPerl(&$1);
+ argvi++;
+}
+
+%typemap(out) qpid::types::Variant::List& {
+ $result = ListToPerl($1);
+ argvi++;
+}
+
+%typemap(out) qpid::types::Variant& {
+ $result = VariantToPerl($1);
+ argvi++;
+}
+
+
+/*
+ * Variant types: Perl --> C++
+ */
+%typemap(in) qpid::types::Variant& {
+ $1 = new qpid::types::Variant(PerlToVariant($input));
+}
+
+%typemap(in) qpid::types::Variant::Map& {
+ $1 = new qpid::types::Variant::Map();
+ PerlToMap($input, $1);
+
+}
+
+%typemap(in) qpid::types::Variant::List& {
+ $1 = new qpid::types::Variant::List();
+ PerlToList($input, $1);
+
+}
+
+%typemap(in) const qpid::types::Variant::Map const & {
+ $1 = new qpid::types::Variant::Map();
+ PerlToMap($input, $1);
+}
+
+%typemap(in) const qpid::types::Variant::List const & {
+ $1 = new qpid::types::Variant::List();
+ PerlToList($input, $1);
+}
+
+%typemap(freearg) qpid::types::Variant& {
+ delete $1;
+}
+
+%typemap(freearg) qpid::types::Variant::Map& {
+ delete $1;
+}
+
+%typemap(freearg) qpid::types::Variant::List& {
+ delete $1;
+}
+
+
+/*
+ * Variant types: typecheck maps
+ */
+%typemap(typecheck) qpid::types::Variant::Map& {
+ $1 = (SvTYPE(SvRV($input)) == SVt_PVHV) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant::List& {
+ $1 = (SvTYPE(SvRV($input)) == SVt_PVAV) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant& {
+ $1 = (SvIOK($input) ||
+ SvNOK($input) ||
+ SvPOK($input) ) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant::Map const & {
+ $1 = (SvTYPE(SvRV($input)) == SVt_PVHV) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant::List const & {
+ $1 = (SvTYPE(SvRV($input)) == SVt_PVAV) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant const & {
+ $1 = (SvIOK($input) ||
+ SvNOK($input) ||
+ SvPOK($input) ) ? 1 : 0;
+}
+
+/* No boolean type for perl.
+ Boolean is simply and integer in perl
+*/
+%typecheck(SWIG_TYPECHECK_BOOL) bool {
+ $1 = (SvIOK($input)) ? 1 : 0;
+}
diff --git a/qpid/cpp/bindings/swig_python_typemaps.i b/qpid/cpp/bindings/swig_python_typemaps.i
new file mode 100644
index 0000000000..b69784a6de
--- /dev/null
+++ b/qpid/cpp/bindings/swig_python_typemaps.i
@@ -0,0 +1,400 @@
+/*
+ * 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.
+ */
+
+%wrapper %{
+
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#endif
+
+
+ PyObject* MapToPy(const qpid::types::Variant::Map*);
+ PyObject* ListToPy(const qpid::types::Variant::List*);
+ void PyToMap(PyObject*, qpid::types::Variant::Map*);
+ void PyToList(PyObject*, qpid::types::Variant::List*);
+
+ qpid::types::Variant PyToVariant(PyObject* value) {
+ if (PyBool_Check(value)) return qpid::types::Variant(bool(PyInt_AS_LONG(value) ? true : false));
+ if (PyFloat_Check(value)) return qpid::types::Variant(PyFloat_AS_DOUBLE(value));
+ if (PyInt_Check(value)) return qpid::types::Variant(int64_t(PyInt_AS_LONG(value)));
+ if (PyLong_Check(value)) return qpid::types::Variant(int64_t(PyLong_AsLongLong(value)));
+ if (PyString_Check(value)) return qpid::types::Variant(std::string(PyString_AS_STRING(value)));
+ if (PyDict_Check(value)) {
+ qpid::types::Variant::Map map;
+ PyToMap(value, &map);
+ return qpid::types::Variant(map);
+ }
+ if (PyList_Check(value)) {
+ qpid::types::Variant::List list;
+ PyToList(value, &list);
+ return qpid::types::Variant(list);
+ }
+ return qpid::types::Variant();
+ }
+
+ PyObject* VariantToPy(const qpid::types::Variant* v) {
+ PyObject* result;
+ try {
+ switch (v->getType()) {
+ case qpid::types::VAR_VOID: {
+ result = Py_None;
+ break;
+ }
+ case qpid::types::VAR_BOOL : {
+ result = v->asBool() ? Py_True : Py_False;
+ break;
+ }
+ case qpid::types::VAR_UINT8 :
+ case qpid::types::VAR_UINT16 :
+ case qpid::types::VAR_UINT32 : {
+ result = PyInt_FromLong((long) v->asUint32());
+ break;
+ }
+ case qpid::types::VAR_UINT64 : {
+ result = PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) v->asUint64());
+ break;
+ }
+ case qpid::types::VAR_INT8 :
+ case qpid::types::VAR_INT16 :
+ case qpid::types::VAR_INT32 : {
+ result = PyInt_FromLong((long) v->asInt32());
+ break;
+ }
+ case qpid::types::VAR_INT64 : {
+ result = PyLong_FromLongLong((PY_LONG_LONG) v->asInt64());
+ break;
+ }
+ case qpid::types::VAR_FLOAT : {
+ result = PyFloat_FromDouble((double) v->asFloat());
+ break;
+ }
+ case qpid::types::VAR_DOUBLE : {
+ result = PyFloat_FromDouble((double) v->asDouble());
+ break;
+ }
+ case qpid::types::VAR_STRING : {
+ const std::string val(v->asString());
+ result = PyString_FromStringAndSize(val.c_str(), val.size());
+ break;
+ }
+ case qpid::types::VAR_MAP : {
+ result = MapToPy(&(v->asMap()));
+ break;
+ }
+ case qpid::types::VAR_LIST : {
+ result = ListToPy(&(v->asList()));
+ break;
+ }
+ case qpid::types::VAR_UUID : {
+ }
+ }
+ } catch (qpid::types::Exception& ex) {
+ PyErr_SetString(PyExc_RuntimeError, ex.what());
+ result = 0;
+ }
+
+ if (result)
+ Py_INCREF(result);
+ return result;
+ }
+
+ PyObject* MapToPy(const qpid::types::Variant::Map* map) {
+ PyObject* result = PyDict_New();
+ qpid::types::Variant::Map::const_iterator iter;
+ for (iter = map->begin(); iter != map->end(); iter++) {
+ const std::string key(iter->first);
+ PyObject* pyval = VariantToPy(&(iter->second));
+ if (pyval == 0)
+ return 0;
+ PyDict_SetItem(result, PyString_FromStringAndSize(key.c_str(), key.size()), pyval);
+ }
+ return result;
+ }
+
+ PyObject* ListToPy(const qpid::types::Variant::List* list) {
+ PyObject* result = PyList_New(list->size());
+ qpid::types::Variant::List::const_iterator iter;
+ Py_ssize_t idx(0);
+ for (iter = list->begin(); iter != list->end(); iter++) {
+ PyObject* pyval = VariantToPy(&(*iter));
+ if (pyval == 0)
+ return 0;
+ PyList_SetItem(result, idx, pyval);
+ idx++;
+ }
+ return result;
+ }
+
+ void PyToMap(PyObject* obj, qpid::types::Variant::Map* map) {
+ map->clear();
+ Py_ssize_t iter(0);
+ PyObject *key;
+ PyObject *val;
+ while (PyDict_Next(obj, &iter, &key, &val))
+ (*map)[std::string(PyString_AS_STRING(key))] = PyToVariant(val);
+ }
+
+ void PyToList(PyObject* obj, qpid::types::Variant::List* list) {
+ list->clear();
+ Py_ssize_t count(PyList_Size(obj));
+ for (Py_ssize_t idx = 0; idx < count; idx++)
+ list->push_back(PyToVariant(PyList_GetItem(obj, idx)));
+ }
+
+%}
+
+
+/* unsigned32 Convert from Python --> C */
+%typemap(in) uint32_t {
+ if (PyInt_Check($input)) {
+ $1 = (uint32_t) PyInt_AsUnsignedLongMask($input);
+ } else if (PyLong_Check($input)) {
+ $1 = (uint32_t) PyLong_AsUnsignedLong($input);
+ } else {
+ SWIG_exception_fail(SWIG_ValueError, "unknown integer type");
+ }
+}
+
+/* unsinged32 Convert from C --> Python */
+%typemap(out) uint32_t {
+ $result = PyInt_FromLong((long)$1);
+}
+
+
+/* unsigned16 Convert from Python --> C */
+%typemap(in) uint16_t {
+ if (PyInt_Check($input)) {
+ $1 = (uint16_t) PyInt_AsUnsignedLongMask($input);
+ } else if (PyLong_Check($input)) {
+ $1 = (uint16_t) PyLong_AsUnsignedLong($input);
+ } else {
+ SWIG_exception_fail(SWIG_ValueError, "unknown integer type");
+ }
+}
+
+/* unsigned16 Convert from C --> Python */
+%typemap(out) uint16_t {
+ $result = PyInt_FromLong((long)$1);
+}
+
+
+/* signed32 Convert from Python --> C */
+%typemap(in) int32_t {
+ if (PyInt_Check($input)) {
+ $1 = (int32_t) PyInt_AsLong($input);
+ } else if (PyLong_Check($input)) {
+ $1 = (int32_t) PyLong_AsLong($input);
+ } else {
+ SWIG_exception_fail(SWIG_ValueError, "unknown integer type");
+ }
+}
+
+/* signed32 Convert from C --> Python */
+%typemap(out) int32_t {
+ $result = PyInt_FromLong((long)$1);
+}
+
+
+/* unsigned64 Convert from Python --> C */
+%typemap(in) uint64_t {
+%#ifdef HAVE_LONG_LONG
+ if (PyLong_Check($input)) {
+ $1 = (uint64_t)PyLong_AsUnsignedLongLong($input);
+ } else if (PyInt_Check($input)) {
+ $1 = (uint64_t)PyInt_AsUnsignedLongLongMask($input);
+ } else
+%#endif
+ {
+ SWIG_exception_fail(SWIG_ValueError, "unsupported integer size - uint64_t input too large");
+ }
+}
+
+/* unsigned64 Convert from C --> Python */
+%typemap(out) uint64_t {
+%#ifdef HAVE_LONG_LONG
+ $result = PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)$1);
+%#else
+ SWIG_exception_fail(SWIG_ValueError, "unsupported integer size - uint64_t output too large");
+%#endif
+}
+
+/* signed64 Convert from Python --> C */
+%typemap(in) int64_t {
+%#ifdef HAVE_LONG_LONG
+ if (PyLong_Check($input)) {
+ $1 = (int64_t)PyLong_AsLongLong($input);
+ } else if (PyInt_Check($input)) {
+ $1 = (int64_t)PyInt_AsLong($input);
+ } else
+%#endif
+ {
+ SWIG_exception_fail(SWIG_ValueError, "unsupported integer size - int64_t input too large");
+ }
+}
+
+/* signed64 Convert from C --> Python */
+%typemap(out) int64_t {
+%#ifdef HAVE_LONG_LONG
+ $result = PyLong_FromLongLong((PY_LONG_LONG)$1);
+%#else
+ SWIG_exception_fail(SWIG_ValueError, "unsupported integer size - int64_t output too large");
+%#endif
+}
+
+
+/* Convert from Python --> C */
+%typemap(in) void * {
+ $1 = (void *)$input;
+}
+
+/* Convert from C --> Python */
+%typemap(out) void * {
+ $result = (PyObject *) $1;
+ Py_INCREF($result);
+}
+
+/*
+ * Variant types: C++ --> Python
+ */
+%typemap(out) qpid::types::Variant::Map {
+ $result = MapToPy(&$1);
+ if ($result)
+ Py_INCREF($result);
+}
+
+%typemap(out) qpid::types::Variant::Map& {
+ $result = MapToPy($1);
+ if ($result)
+ Py_INCREF($result);
+}
+
+%typemap(out) qpid::types::Variant::List {
+ $result = ListToPy(&$1);
+ if ($result)
+ Py_INCREF($result);
+}
+
+%typemap(out) qpid::types::Variant::List& {
+ $result = ListToPy($1);
+ if ($result)
+ Py_INCREF($result);
+}
+
+%typemap(out) qpid::types::Variant& {
+ $result = VariantToPy($1);
+ if ($result)
+ Py_INCREF($result);
+}
+
+
+/*
+ * Variant types: Ruby --> C++
+ */
+%typemap(in) qpid::types::Variant& {
+ $1 = new qpid::types::Variant(PyToVariant($input));
+}
+
+%typemap(in) qpid::types::Variant::Map& {
+ $1 = new qpid::types::Variant::Map();
+ PyToMap($input, $1);
+}
+
+%typemap(in) qpid::types::Variant::List& {
+ $1 = new qpid::types::Variant::List();
+ PyToList($input, $1);
+}
+
+%typemap(in) const qpid::types::Variant::Map const & {
+ $1 = new qpid::types::Variant::Map();
+ PyToMap($input, $1);
+}
+
+%typemap(in) const qpid::types::Variant::List const & {
+ $1 = new qpid::types::Variant::List();
+ PyToList($input, $1);
+}
+
+%typemap(freearg) qpid::types::Variant& {
+ delete $1;
+}
+
+%typemap(freearg) qpid::types::Variant::Map& {
+ delete $1;
+}
+
+%typemap(freearg) qpid::types::Variant::List& {
+ delete $1;
+}
+
+
+/*
+ * Variant types: typecheck maps
+ */
+%typemap(typecheck) qpid::types::Variant::Map& {
+ $1 = PyDict_Check($input) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant::List& {
+ $1 = PyList_Check($input) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant& {
+ $1 = (PyFloat_Check($input) ||
+ PyString_Check($input) ||
+ PyInt_Check($input) ||
+ PyLong_Check($input) ||
+ PyDict_Check($input) ||
+ PyList_Check($input) ||
+ PyBool_Check($input)) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant::Map const & {
+ $1 = PyDict_Check($input) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant::List const & {
+ $1 = PyList_Check($input) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant const & {
+ $1 = (PyFloat_Check($input) ||
+ PyString_Check($input) ||
+ PyInt_Check($input) ||
+ PyLong_Check($input) ||
+ PyDict_Check($input) ||
+ PyList_Check($input) ||
+ PyBool_Check($input)) ? 1 : 0;
+}
+
+%typemap(typecheck) bool {
+ $1 = PyBool_Check($input) ? 1 : 0;
+}
+
+
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_UINT64) uint64_t {
+ $1 = PyLong_Check($input) ? 1 : 0;
+}
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_UINT32) uint32_t {
+ $1 = PyInt_Check($input) ? 1 : 0;
+}
+
diff --git a/qpid/cpp/bindings/swig_ruby_typemaps.i b/qpid/cpp/bindings/swig_ruby_typemaps.i
new file mode 100644
index 0000000000..79e679663d
--- /dev/null
+++ b/qpid/cpp/bindings/swig_ruby_typemaps.i
@@ -0,0 +1,348 @@
+/*
+ * 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.
+ */
+
+%wrapper %{
+
+#include <stdarg.h>
+
+ VALUE MapToRb(const qpid::types::Variant::Map*);
+ VALUE ListToRb(const qpid::types::Variant::List*);
+ void RbToMap(VALUE, qpid::types::Variant::Map*);
+ void RbToList(VALUE, qpid::types::Variant::List*);
+
+ qpid::types::Variant RbToVariant(VALUE value) {
+ switch (TYPE(value)) {
+ case T_FLOAT: return qpid::types::Variant(NUM2DBL(value));
+ case T_STRING: return qpid::types::Variant(StringValuePtr(value));
+ case T_FIXNUM: return qpid::types::Variant((int64_t) FIX2LONG(value));
+ case T_BIGNUM: return qpid::types::Variant((int64_t) NUM2LL(value));
+ case T_TRUE: return qpid::types::Variant(true);
+ case T_FALSE: return qpid::types::Variant(false);
+ case T_HASH: {
+ qpid::types::Variant::Map map;
+ RbToMap(value, &map);
+ return qpid::types::Variant(map);
+ }
+ case T_ARRAY: {
+ qpid::types::Variant::List list;
+ RbToList(value, &list);
+ return qpid::types::Variant(list);
+ }
+ default: return qpid::types::Variant();
+ }
+ }
+
+ VALUE VariantToRb(const qpid::types::Variant* v) {
+ VALUE result;
+ try {
+ switch (v->getType()) {
+ case qpid::types::VAR_VOID: {
+ result = Qnil;
+ break;
+ }
+ case qpid::types::VAR_BOOL : {
+ result = v->asBool() ? Qtrue : Qfalse;
+ break;
+ }
+ case qpid::types::VAR_UINT8 :
+ case qpid::types::VAR_UINT16 :
+ case qpid::types::VAR_UINT32 : {
+ result = UINT2NUM(v->asUint32());
+ break;
+ }
+ case qpid::types::VAR_UINT64 : {
+ result = ULL2NUM(v->asUint64());
+ break;
+ }
+ case qpid::types::VAR_INT8 :
+ case qpid::types::VAR_INT16 :
+ case qpid::types::VAR_INT32 : {
+ result = INT2NUM(v->asInt32());
+ break;
+ }
+ case qpid::types::VAR_INT64 : {
+ result = LL2NUM(v->asInt64());
+ break;
+ }
+ case qpid::types::VAR_FLOAT : {
+ result = rb_float_new((double) v->asFloat());
+ break;
+ }
+ case qpid::types::VAR_DOUBLE : {
+ result = rb_float_new(v->asDouble());
+ break;
+ }
+ case qpid::types::VAR_STRING : {
+ const std::string val(v->asString());
+ result = rb_str_new(val.c_str(), val.size());
+ break;
+ }
+ case qpid::types::VAR_MAP : {
+ result = MapToRb(&(v->asMap()));
+ break;
+ }
+ case qpid::types::VAR_LIST : {
+ result = ListToRb(&(v->asList()));
+ break;
+ }
+ case qpid::types::VAR_UUID : {
+ }
+ }
+ } catch (qpid::types::Exception& ex) {
+ static VALUE error = rb_define_class("Error", rb_eStandardError);
+ rb_raise(error, ex.what());
+ }
+
+ return result;
+ }
+
+ VALUE MapToRb(const qpid::types::Variant::Map* map) {
+ VALUE result = rb_hash_new();
+ qpid::types::Variant::Map::const_iterator iter;
+ for (iter = map->begin(); iter != map->end(); iter++) {
+ const std::string key(iter->first);
+ VALUE rbval = VariantToRb(&(iter->second));
+ rb_hash_aset(result, rb_str_new(key.c_str(), key.size()), rbval);
+ }
+ return result;
+ }
+
+ VALUE ListToRb(const qpid::types::Variant::List* list) {
+ VALUE result = rb_ary_new2(list->size());
+ qpid::types::Variant::List::const_iterator iter;
+ for (iter = list->begin(); iter != list->end(); iter++) {
+ VALUE rbval = VariantToRb(&(*iter));
+ rb_ary_push(result, rbval);
+ }
+ return result;
+ }
+
+ VALUE HashIter(VALUE data_ary, VALUE context) {
+ VALUE key = rb_ary_entry(data_ary, 0);
+ VALUE val = rb_ary_entry(data_ary, 1);
+ qpid::types::Variant::Map* map((qpid::types::Variant::Map*) context);
+ (*map)[std::string(StringValuePtr(key))] = RbToVariant(val);
+ return data_ary;
+ }
+
+ VALUE AryIter(VALUE data, VALUE context) {
+ qpid::types::Variant::List* list((qpid::types::Variant::List*) context);
+ list->push_back(RbToVariant(data));
+ return data;
+ }
+
+ void RbToMap(VALUE hash, qpid::types::Variant::Map* map) {
+ map->clear();
+ rb_iterate(rb_each, hash, (VALUE(*)(ANYARGS))HashIter, (VALUE) map);
+ }
+
+ void RbToList(VALUE ary, qpid::types::Variant::List* list) {
+ list->clear();
+ rb_iterate(rb_each, ary, (VALUE(*)(ANYARGS))AryIter, (VALUE) list);
+ }
+%}
+
+%typemap (in) void *
+{
+ $1 = (void *) $input;
+}
+
+%typemap (out) void *
+{
+ $result = (VALUE) $1;
+}
+
+%typemap (in) uint16_t
+{
+ $1 = NUM2UINT ($input);
+}
+
+%typemap (out) uint16_t
+{
+ $result = UINT2NUM((uint16_t) $1);
+}
+
+%typemap (in) uint32_t
+{
+ if (TYPE($input) == T_BIGNUM)
+ $1 = NUM2UINT($input);
+ else
+ $1 = FIX2UINT($input);
+}
+
+%typemap (out) uint32_t
+{
+ $result = UINT2NUM((uint32_t) $1);
+}
+
+%typemap (in) int32_t
+{
+ if (TYPE($input) == T_BIGNUM)
+ $1 = NUM2INT($input);
+ else
+ $1 = FIX2INT($input);
+}
+
+%typemap (out) int32_t
+{
+ $result = INT2NUM((int32_t) $1);
+}
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_INTEGER) uint32_t {
+ $1 = FIXNUM_P($input);
+}
+
+%typemap (in) uint64_t
+{
+ if (TYPE($input) == T_BIGNUM)
+ $1 = NUM2ULL($input);
+ else
+ $1 = (uint64_t) FIX2ULONG($input);
+}
+
+%typemap (out) uint64_t
+{
+ $result = ULL2NUM((uint64_t) $1);
+}
+
+%typemap (in) int64_t
+{
+ if (TYPE($input) == T_BIGNUM)
+ $1 = NUM2LL($input);
+ else
+ $1 = (int64_t) FIX2LONG($input);
+}
+
+%typemap (out) int64_t
+{
+ $result = LL2NUM((int64_t) $1);
+}
+
+/*
+ * Variant types: C++ --> Ruby
+ */
+%typemap(out) qpid::types::Variant::Map {
+ $result = MapToRb(&$1);
+}
+
+%typemap(out) qpid::types::Variant::Map& {
+ $result = MapToRb($1);
+}
+
+%typemap(out) qpid::types::Variant::List {
+ $result = ListToRb(&$1);
+}
+
+%typemap(out) qpid::types::Variant::List& {
+ $result = ListToRb($1);
+}
+
+%typemap(out) qpid::types::Variant& {
+ $result = VariantToRb($1);
+}
+
+
+/*
+ * Variant types: Ruby --> C++
+ */
+%typemap(in) qpid::types::Variant& {
+ $1 = new qpid::types::Variant(RbToVariant($input));
+}
+
+%typemap(in) qpid::types::Variant::Map& {
+ $1 = new qpid::types::Variant::Map();
+ RbToMap($input, $1);
+}
+
+%typemap(in) qpid::types::Variant::List& {
+ $1 = new qpid::types::Variant::List();
+ RbToList($input, $1);
+}
+
+%typemap(in) const qpid::types::Variant::Map const & {
+ $1 = new qpid::types::Variant::Map();
+ RbToMap($input, $1);
+}
+
+%typemap(in) const qpid::types::Variant::List const & {
+ $1 = new qpid::types::Variant::List();
+ RbToList($input, $1);
+}
+
+%typemap(freearg) qpid::types::Variant& {
+ delete $1;
+}
+
+%typemap(freearg) qpid::types::Variant::Map& {
+ delete $1;
+}
+
+%typemap(freearg) qpid::types::Variant::List& {
+ delete $1;
+}
+
+
+/*
+ * Variant types: typecheck maps
+ */
+%typemap(typecheck) qpid::types::Variant::Map& {
+ $1 = (TYPE($input) == T_HASH) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant::List& {
+ $1 = (TYPE($input) == T_ARRAY) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant& {
+ $1 = (TYPE($input) == T_FLOAT ||
+ TYPE($input) == T_STRING ||
+ TYPE($input) == T_FIXNUM ||
+ TYPE($input) == T_BIGNUM ||
+ TYPE($input) == T_TRUE ||
+ TYPE($input) == T_FALSE) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant::Map const & {
+ $1 = (TYPE($input) == T_HASH) ? 1 : 0;
+}
+
+%typemap(typecheck) qpid::types::Variant::List const & {
+ $1 = (TYPE($input) == T_ARRAY) ? 1 : 0;
+}
+
+%typemap(typecheck) const qpid::types::Variant const & {
+ $1 = (TYPE($input) == T_FLOAT ||
+ TYPE($input) == T_STRING ||
+ TYPE($input) == T_FIXNUM ||
+ TYPE($input) == T_BIGNUM ||
+ TYPE($input) == T_TRUE ||
+ TYPE($input) == T_FALSE) ? 1 : 0;
+}
+
+%typemap(typecheck) bool {
+ $1 = (TYPE($input) == T_TRUE ||
+ TYPE($input) == T_FALSE) ? 1 : 0;
+}
+
+
+
+%typemap (typecheck, precedence=SWIG_TYPECHECK_INTEGER) uint64_t {
+ $1 = FIXNUM_P($input);
+}
+