From ec0ea98d66cddab138fe2ff4d93f66c3f9e2212a Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Mon, 10 May 2010 20:33:19 +0000 Subject: QPID-2589 - Applied patch from Chuck Rolke. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@942892 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/bindings/qpid/dotnet/ReadMe.txt | 33 +++ .../Properties/AssemblyInfo.cs | 36 +++ .../csharp.direct.receiver.cs | 57 +++++ .../csharp.direct.receiver.csproj | 63 +++++ .../Properties/AssemblyInfo.cs | 36 +++ .../csharp.direct.sender/csharp.direct.sender.cs | 42 ++++ .../csharp.direct.sender.csproj | 63 +++++ .../qpid/dotnet/org.apache.qpid.messaging.sln | 89 +++++++ qpid/cpp/bindings/qpid/dotnet/src/AssemblyInfo.cpp | 57 +++++ qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp | 115 +++++++++ qpid/cpp/bindings/qpid/dotnet/src/Connection.h | 63 +++++ qpid/cpp/bindings/qpid/dotnet/src/Duration.cpp | 107 ++++++++ qpid/cpp/bindings/qpid/dotnet/src/Duration.h | 67 +++++ qpid/cpp/bindings/qpid/dotnet/src/Message.cpp | 202 +++++++++++++++ qpid/cpp/bindings/qpid/dotnet/src/Message.h | 92 +++++++ qpid/cpp/bindings/qpid/dotnet/src/QpidMarshal.h | 61 +++++ qpid/cpp/bindings/qpid/dotnet/src/ReadMe.txt | 40 +++ qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp | 164 ++++++++++++ qpid/cpp/bindings/qpid/dotnet/src/Receiver.h | 88 +++++++ qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp | 121 +++++++++ qpid/cpp/bindings/qpid/dotnet/src/Sender.h | 77 ++++++ qpid/cpp/bindings/qpid/dotnet/src/Session.cpp | 186 ++++++++++++++ qpid/cpp/bindings/qpid/dotnet/src/Session.h | 93 +++++++ qpid/cpp/bindings/qpid/dotnet/src/app.rc | 62 +++++ .../dotnet/src/org.apache.qpid.messaging.vcproj | 278 +++++++++++++++++++++ qpid/cpp/bindings/qpid/dotnet/src/resource.h | 22 ++ .../test/messaging.test/Properties/AssemblyInfo.cs | 36 +++ .../dotnet/test/messaging.test/messaging.test.cs | 38 +++ .../test/messaging.test/messaging.test.csproj | 63 +++++ 29 files changed, 2451 insertions(+) create mode 100644 qpid/cpp/bindings/qpid/dotnet/ReadMe.txt create mode 100644 qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/Properties/AssemblyInfo.cs create mode 100644 qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.cs create mode 100644 qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.csproj create mode 100644 qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/Properties/AssemblyInfo.cs create mode 100644 qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.cs create mode 100644 qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.csproj create mode 100644 qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/AssemblyInfo.cpp create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Connection.h create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Duration.cpp create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Duration.h create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Message.cpp create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Message.h create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/QpidMarshal.h create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/ReadMe.txt create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Receiver.h create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Sender.h create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Session.cpp create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/Session.h create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/app.rc create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj create mode 100644 qpid/cpp/bindings/qpid/dotnet/src/resource.h create mode 100644 qpid/cpp/bindings/qpid/dotnet/test/messaging.test/Properties/AssemblyInfo.cs create mode 100644 qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs create mode 100644 qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj (limited to 'qpid/cpp/bindings') diff --git a/qpid/cpp/bindings/qpid/dotnet/ReadMe.txt b/qpid/cpp/bindings/qpid/dotnet/ReadMe.txt new file mode 100644 index 0000000000..66ac7ae50e --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/ReadMe.txt @@ -0,0 +1,33 @@ +Qpid.cpp.bindings.qpid.dotnet binding package. + +1. Features +=========== + +This binding package is a .NET Interop wrapper around the Qpid Messaging interface. +It exposes the Messaging interface through a series of managed code classes that +may be used by any .NET language. + +2. Prerequisites +================ + +1. A build of the Qpid C++ libraries is available. + +2. Refer to this library using environment variable QPID_BUILD_ROOT. + + for example: SET QPID_BUILD_ROOT=D:\users\submitter\svn\qpid\cpp + +3. Building the solution +======================== + +1. Build the solution. + +4. Runing the examples +====================== + +CWIP + +5. Running the tests +==================== + +CWIP + 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..2582331c99 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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..db54600882 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using org.apache.qpid.messaging; + +namespace CSharpDirect +{ + class Program + { + // Direct receiver example + // + // Receive 10 messages from localhost:5672, amq.direct/key + // + static void Main(string[] args) + { + String host = "localhost:5672"; + String addr = "amq.direct/key"; + int nMsg = 10; + + Connection conn = new Connection(host); + + conn.open(); + + if (!conn.isOpen()) + { + Console.WriteLine("Failed to open connection to host : {0}", host); + } + else + { + + Session sess = conn.createSession(); + + Duration dur = new Duration(1000 * 3600 * 24); // Wait one day + + Receiver rcv = sess.createReceiver(addr); + + Message msg = new Message(""); + + for (int i = 0; i < nMsg; i++) + { + try + { + Message msg2 = rcv.fetch(dur); + Console.WriteLine("Rcvd msg {0} : {1}", i, msg2.getContent()); + } + catch (Exception e) + { + Console.WriteLine("Exception {0}.", e); + } + } + + conn.close(); + } + } + } +} \ 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..8cb4826a01 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.receiver/csharp.direct.receiver.csproj @@ -0,0 +1,63 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {52F880E7-D677-4C91-8516-D679CE0F46A8} + Exe + Properties + csharp.direct.receiver + csharp.direct.receiver + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\bin\Debug\org.apache.qpid.messagingd.dll + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + 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..1cd6e30688 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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..3ad6c58a2c --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using org.apache.qpid.messaging; + +namespace csharp.direct.sender +{ + class Program + { + static void Main(string[] args) + { + String host = "localhost:5672"; + String addr = "amq.direct/key"; + int nMsg = 10; + + Connection conn = new Connection(host); + + conn.open(); + + if (!conn.isOpen()) + { + Console.WriteLine("Failed to open connection to host : {0}", host); + } + else + { + Session sess = conn.createSession(); + + Sender snd = sess.createSender(addr); + + for (int i = 0; i < nMsg; i++) + { + Message msg = new Message(String.Format("Test Message {0}", i)); + + snd.send(msg); + } + + conn.close(); + } + } + } +} 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..f109d64b80 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/examples/csharp.direct.sender/csharp.direct.sender.csproj @@ -0,0 +1,63 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068} + Exe + Properties + csharp.direct.sender + csharp.direct.sender + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\bin\Debug\org.apache.qpid.messagingd.dll + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + 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..9708b38f97 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln @@ -0,0 +1,89 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +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 +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {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}.Release|Any CPU.ActiveCfg = Release|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Mixed Platforms.Build.0 = Release|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Win32.ActiveCfg = Release|Win32 + {AA5A3B83-5F98-406D-A01C-5A921467A57D}.Release|Win32.Build.0 = Release|Win32 + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Debug|Win32.ActiveCfg = Debug|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|Any CPU.Build.0 = Release|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068}.Release|Win32.ActiveCfg = Release|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Debug|Win32.ActiveCfg = Debug|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|Any CPU.Build.0 = Release|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {52F880E7-D677-4C91-8516-D679CE0F46A8}.Release|Win32.ActiveCfg = Release|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Debug|Win32.ActiveCfg = Debug|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|Any CPU.Build.0 = Release|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {AF2FBC78-266C-430C-BC29-9477AB596A36}.Release|Win32.ActiveCfg = Release|Any CPU + 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} + {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} + EndGlobalSection +EndGlobal 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..58b93f6b24 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Connection.cpp @@ -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. +*/ + +#include +#include +#include +#include +#include + +#include "qpid/messaging/Connection.h" +#include "qpid/messaging/Session.h" + +#include "QpidMarshal.h" +#include "Connection.h" +#include "Session.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Connection is a managed wrapper for a qpid::messaging::Connection + /// + + // Public constructor + Connection::Connection(System::String ^ url) : + connectionp(new ::qpid::messaging::Connection(QpidMarshal::ToNative(url))) + { + } + + Connection::Connection(System::String ^ url, System::String ^ options) : + connectionp(new ::qpid::messaging::Connection(QpidMarshal::ToNative(url), + QpidMarshal::ToNative(options))) + { + } + + + // Destructor + Connection::~Connection() + { + Cleanup(); + } + + + // Finalizer + Connection::!Connection() + { + Cleanup(); + } + + + // Destroys kept object + // TODO: add lock + void Connection::Cleanup() + { + if (NULL != connectionp) + { + delete connectionp; + connectionp = NULL; + } + } + + Session ^ Connection::createSession() + { + return createSession(""); + } + + + Session ^ Connection::createSession(System::String ^ name) + { + // allocate native session + ::qpid::messaging::Session * sessionp = new ::qpid::messaging::Session; + + // create native session + *sessionp = connectionp->createSession(QpidMarshal::ToNative(name)); + + // create managed session + Session ^ newSession = gcnew Session(sessionp, this); + + return newSession; + } + + + void Connection::open() + { + connectionp->open(); + } + + bool Connection::isOpen() + { + return connectionp->isOpen(); + } + + void Connection::close() + { + connectionp->close(); + } +}}}} 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..e16cb1e24e --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Connection.h @@ -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. +*/ + +#pragma once + +#include +#include +#include +#include +#include + +#include "qpid/messaging/Connection.h" +#include "qpid/messaging/Session.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Connection is a managed wrapper for a qpid::messaging::Connection + /// + + ref class Session; + + public ref class Connection + { + private: + // The kept object in the Messaging C++ DLL + ::qpid::messaging::Connection * connectionp; + + // Kept object deletion code + void Cleanup(); + + public: + Connection(System::String ^ url); + Connection(System::String ^ url, System::String ^ options); + ~Connection(); + !Connection(); + + Session ^ createSession(); + Session ^ createSession(System::String ^ name); + void open(); + bool isOpen(); + void close(); + }; +}}}} 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 +#include +#include +#include +#include + +#include "qpid/messaging/Duration.h" + +#include "Duration.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Duration is a time interval in milliseconds. + /// It is a managed wrapper for a ::qpid::messaging::Duration + /// + + // 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..9b763a7fdf --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Duration.h @@ -0,0 +1,67 @@ +/* +* 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 +#include +#include +#include +#include + +#include "qpid/messaging/Duration.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Duration is a time interval in milliseconds. + /// It is a managed wrapper for a ::qpid::messaging::Duration + /// + + public ref class Duration + { + private: + // Experimental constructor + Duration(const ::qpid::messaging::Duration *); + + // Kept object deletion code + void Cleanup(); + + public: + Duration(System::UInt64 milliseconds); + ~Duration(); + !Duration(); + + // The kept object in the Messaging C++ DLL + const ::qpid::messaging::Duration * durationp; + + System::UInt64 getMilliseconds(); + + // Return value(s) for constant durations + // NOTE: These return the duration mS and not a Duration + // object like the C++ code gets. + System::UInt64 FOREVER(); + System::UInt64 IMMEDIATE(); + System::UInt64 SECOND(); + System::UInt64 MINUTE(); + }; +}}}} 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..90ca4e8915 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Message.cpp @@ -0,0 +1,202 @@ +/* +* 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 +#include +#include +#include +#include + +#include "qpid/messaging/Message.h" + +#include "QpidMarshal.h" +#include "Message.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Message is a managed wrapper for a ::qpid::messaging::Message + /// + + // This constructor is used to create a message from bytes to put into the message + Message::Message(System::String ^ bytes) : + messagep(new ::qpid::messaging::Message(QpidMarshal::ToNative(bytes))) + { + } + + // This constructor creates a message from a native received message + Message::Message(::qpid::messaging::Message * msgp) : + messagep(msgp) + { + } + + // Destructor + Message::~Message() + { + Cleanup(); + } + + + // Finalizer + Message::!Message() + { + Cleanup(); + } + + // Copy constructor + Message::Message(const Message % rhs) + { + messagep = rhs.messagep; + } + + // Destroys kept object + // TODO: add lock + void Message::Cleanup() + { + if (NULL != messagep) + { + delete messagep; + messagep = NULL; + } + } + + //void Message::setReplyTo(System::String ^ address) + //{ + // messagep->setReplyTo(QpidMarshal::ToNative(address)); + //} + + //System::String ^ Message::getReplyTo() + //{ + // return gcnew String(messagep->getReplyTo().c_str()); + //} + + + void Message::setSubject(System::String ^ subject) + { + messagep->setSubject(QpidMarshal::ToNative(subject)); + } + + System::String ^ Message::getSubject() + { + return gcnew String(messagep->getSubject().c_str()); + } + + + void Message::setContentType(System::String ^ ct) + { + messagep->setContentType(QpidMarshal::ToNative(ct)); + } + + System::String ^ Message::getContentType() + { + return gcnew String(messagep->getContentType().c_str()); + } + + + void Message::setMessageId(System::String ^ mId) + { + messagep->setMessageId(QpidMarshal::ToNative(mId)); + } + + System::String ^ Message::getMessageId() + { + return gcnew String(messagep->getMessageId().c_str()); + } + + + void Message::setUserId(System::String ^ uId) + { + messagep->setUserId(QpidMarshal::ToNative(uId)); + } + + System::String ^ Message::getUserId() + { + return gcnew String(messagep->getUserId().c_str()); + } + + + void Message::setCorrelationId(System::String ^ cId) + { + messagep->setCorrelationId(QpidMarshal::ToNative(cId)); + } + + System::String ^ Message::getCorrelationId() + { + return gcnew String(messagep->getCorrelationId().c_str()); + } + + + void Message::setPriority(unsigned char priority) + { + messagep->setPriority(priority); + } + + unsigned char Message::getPriority() + { + return messagep->getPriority(); + } + + + //void setTtl(Duration ttl); + //Duration getTtl(); + + void Message::setDurable(bool durable) + { + messagep->setDurable(durable); + } + + bool Message::getDurable() + { + return messagep->getDurable(); + } + + + bool Message::getRedelivered() + { + return messagep->getRedelivered(); + } + + void Message::setRedelivered(bool redelivered) + { + messagep->setRedelivered(redelivered); + } + + + //System::String ^ Message::getProperties() + //{ + // pqid::types::Variant::Map * mapp = new + // return gcnew String(messagep->getReplyTo().c_str()); + //} + + + void Message::setContent(System::String ^ content) + { + messagep->setContent(QpidMarshal::ToNative(content)); + } + + + System::String ^ Message::getContent() + { + return gcnew String(messagep->getContent().c_str()); + } + +}}}} 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..2219112d3f --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Message.h @@ -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. +*/ +#pragma once + +#include +#include +#include +#include +#include + +#include "qpid/messaging/Message.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Message is a managed wrapper for a ::qpid::messaging::Message + /// + + + public ref class Message + { + + private: + // Kept object deletion code + void Cleanup(); + + public: + Message(System::String ^ bytes); + Message(::qpid::messaging::Message * msgp); + ~Message(); + !Message(); + Message(const Message % rhs); + + // The kept object in the Messaging C++ DLL + ::qpid::messaging::Message * messagep; + + //void setReplyTo(System::String ^ address); + //System::String ^ getReplyTo(); + + void setSubject(System::String ^ subject); + System::String ^ getSubject(); + + void setContentType(System::String ^ ct); + System::String ^ getContentType(); + + void setMessageId(System::String ^ mId); + System::String ^ getMessageId(); + + void setUserId(System::String ^ uId); + System::String ^ getUserId(); + + void setCorrelationId(System::String ^ cId); + System::String ^ getCorrelationId(); + + void setPriority(unsigned char priority); + unsigned char getPriority(); + + //void setTtl(Duration ttl); + //Duration getTtl(); + + void setDurable(bool durable); + bool getDurable(); + + bool getRedelivered(); + void setRedelivered(bool redelivered); + + //System::String ^ getProperties(); + + void setContent(System::String ^ content); + + System::String ^ getContent(); + }; +}}}} 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..7667db848c --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/QpidMarshal.h @@ -0,0 +1,61 @@ +/* +* 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 +{ +public: + + /// + /// Convert managed String into native UTF8-encoded string + /// + + static std::string ToNative (System::String^ managed) + { + if (managed->Length == 0) + { + return std::string(); + } + + array^ mbytes = Encoding::UTF8->GetBytes(managed); + if (mbytes->Length == 0) + { + return std::string(); + } + + pin_ptr pinnedBuf = &mbytes[0]; + std::string native((char *) pinnedBuf, mbytes->Length); + return native; + } +}; + +}}}} 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..a75e35bbf3 --- /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..3902ea75c2 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.cpp @@ -0,0 +1,164 @@ +/* +* 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 +#include +#include +#include +#include + +#include "qpid/messaging/Receiver.h" +#include "qpid/messaging/Session.h" +#include "qpid/messaging/Message.h" + +#include "Receiver.h" +#include "Session.h" +#include "Message.h" +#include "Duration.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Receiver is a managed wrapper for a ::qpid::messaging::Receiver + /// + + Receiver::Receiver(::qpid::messaging::Receiver * r, + Session ^ sessRef) : + receiverp(r), + parentSession(sessRef) + { + } + + + // Destructor + Receiver::~Receiver() + { + Cleanup(); + } + + + // Finalizer + Receiver::!Receiver() + { + Cleanup(); + } + + + // Copy constructor + Receiver::Receiver(const Receiver ^ rhs) + { + receiverp = rhs->receiverp; + parentSession = rhs->parentSession; + } + + + // Destroys kept object + // TODO: add lock + void Receiver::Cleanup() + { + if (NULL != receiverp) + { + delete receiverp; + receiverp = NULL; + } + } + + bool Receiver::get(Message ^ mmsgp) + { + return receiverp->Receiver::get(*((*mmsgp).messagep)); + } + + bool Receiver::get(Message ^ mmsgp, Duration ^ durationp) + { + return receiverp->Receiver::get(*((*mmsgp).messagep), + *((*durationp).durationp)); + } + + Message ^ Receiver::get(Duration ^ durationp) + { + // allocate a message + ::qpid::messaging::Message * msgp = new ::qpid::messaging::Message; + + // get the message + *msgp = receiverp->::qpid::messaging::Receiver::get(*((*durationp).durationp)); + + // create new managed message with received message embedded in it + Message ^ newMessage = gcnew Message(msgp); + + return newMessage; + } + + bool Receiver::fetch(Message ^ mmsgp) + { + return receiverp->::qpid::messaging::Receiver::fetch(*((*mmsgp).messagep)); + } + + bool Receiver::fetch(Message ^ mmsgp, Duration ^ durationp) + { + return receiverp->::qpid::messaging::Receiver::fetch(*((*mmsgp).messagep), + *((*durationp).durationp)); + } + + Message ^ Receiver::fetch(Duration ^ durationp) + { + // allocate a message + ::qpid::messaging::Message * msgp = new ::qpid::messaging::Message; + + // get the message + *msgp = receiverp->::qpid::messaging::Receiver::fetch(*((*durationp).durationp)); + + // create new managed message with received message embedded in it + Message ^ newMessage = gcnew Message(msgp); + + return newMessage; + } + + System::UInt32 Receiver::getCapacity() + { + return receiverp->getCapacity(); + } + + System::UInt32 Receiver::getAvailable() + { + return receiverp->getAvailable(); + } + + System::UInt32 Receiver::getUnsettled() + { + return receiverp->getUnsettled(); + } + + void Receiver::close() + { + receiverp->close(); + } + + System::String ^ Receiver::getName() + { + return gcnew System::String(receiverp->getName().c_str()); + } + + Session ^ Receiver::getSession() + { + return parentSession; + } +}}}} 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..ef2cf1a702 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Receiver.h @@ -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. +*/ +#pragma once + +#include +#include +#include +#include +#include + +#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 { + + /// + /// Mreceiver is a managed wrapper for a ::qpid::messaging::Receiver + /// + + ref class Session; + ref class Message; + ref class Duration; + + public ref class Receiver + { + private: + // The kept object in the Messaging C++ DLL + ::qpid::messaging::Receiver * receiverp; + + // The session that created this Receiver + Session ^ parentSession; + + // Kept object lifetime flag + bool disposed; + + // Kept object deletion code + void Cleanup(); + + public: + Receiver(::qpid::messaging::Receiver * r, + Session ^ sessRef); + ~Receiver(); + !Receiver(); + Receiver(const Receiver ^ rhs); + + bool get(Message ^ mmsgp); + bool get(Message ^ mmsgp, Duration ^ durationp); + Message ^ get(Duration ^ durationp); + + bool fetch(Message ^ mmsgp); + bool fetch(Message ^ mmsgp, Duration ^ durationp); + Message ^ fetch(Duration ^ durationp); + + System::UInt32 getCapacity(); + System::UInt32 getAvailable(); + System::UInt32 getUnsettled(); + void close(); + System::String ^ getName(); + Session ^ getSession(); + }; +}}}} 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..0550995970 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Sender.cpp @@ -0,0 +1,121 @@ +/* +* 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 +#include +#include +#include +#include + +#include "qpid/messaging/Sender.h" +#include "qpid/messaging/Session.h" +#include "qpid/messaging/Message.h" + +#include "Sender.h" +#include "Session.h" +#include "Message.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Sender a managed wrapper for a ::qpid::messaging::Sender + /// + + Sender::Sender(::qpid::messaging::Sender * s, + Session ^ sessRef) : + senderp(s), + parentSession(sessRef) + { + } + + + // Destructor + Sender::~Sender() + { + Cleanup(); + } + + + // Finalizer + Sender::!Sender() + { + Cleanup(); + } + + // Copy constructor + Sender::Sender(const Sender % rhs) + { + senderp = rhs.senderp; + parentSession = rhs.parentSession; + } + + // Destroys kept object + // TODO: add lock + void Sender::Cleanup() + { + if (NULL != senderp) + { + delete senderp; + senderp = NULL; + } + } + + void Sender::send(Message ^ mmsgp) + { + senderp->::qpid::messaging::Sender::send(*((*mmsgp).messagep)); + } + + void Sender::send(Message ^ mmsgp, bool sync) + { + senderp->::qpid::messaging::Sender::send(*((*mmsgp).messagep), sync); + } + + void Sender::setCapacity(System::UInt32 capacity) + { + senderp->setCapacity(capacity); + } + + System::UInt32 Sender::getCapacity() + { + return senderp->getCapacity(); + } + + System::UInt32 Sender::getUnsettled() + { + return senderp->getUnsettled(); + } + + System::UInt32 Sender::getAvailable() + { + return senderp->getAvailable(); + } + + System::String ^ Sender::getName() + { + return gcnew System::String(senderp->getName().c_str()); + } + + Session ^ Sender::getSession() + { + return parentSession; + } +}}}} 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..482d434a55 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Sender.h @@ -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. +*/ +#pragma once + +#include +#include +#include +#include +#include + +#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 { + + /// + /// Sender is a managed wrapper for a ::qpid::messaging::Sender + /// + + 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; + + // Kept object deletion code + void Cleanup(); + + public: + Sender(::qpid::messaging::Sender * s, + Session ^ sessRef); + ~Sender(); + !Sender(); + Sender(const Sender % rhs); + + void send(Message ^ mmsgp); + void send(Message ^ mmsgp, bool sync); + void setCapacity(System::UInt32 capacity); + System::UInt32 getCapacity(); + System::UInt32 getUnsettled(); + System::UInt32 getAvailable(); + System::String ^ getName(); + Session ^ getSession(); + }; +}}}} 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..04db52988e --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Session.cpp @@ -0,0 +1,186 @@ +/* +* 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 +#include +#include +#include +#include + +#include "qpid/messaging/Session.h" + +#include "QpidMarshal.h" +#include "Session.h" +#include "Connection.h" +#include "Duration.h" +#include "Receiver.h" +#include "Sender.h" + +namespace org { +namespace apache { +namespace qpid { +namespace messaging { + + /// + /// Session is a managed wrapper for a ::qpid::messaging::Session + /// + + // constructor + Session::Session(::qpid::messaging::Session * sp, Connection ^ connRef) : + sessionp(sp), + parentConnectionp(connRef) + { + } + + + // Destructor + Session::~Session() + { + Cleanup(); + } + + + // Finalizer + Session::!Session() + { + Cleanup(); + } + + // copy constructor + Session::Session(const Session % rhs) + { + sessionp = rhs.sessionp; + parentConnectionp = rhs.parentConnectionp; + } + + + // Destroys kept object + // TODO: add lock + void Session::Cleanup() + { + if (NULL != sessionp) + { + delete sessionp; + sessionp = NULL; + } + } + + void Session::close() + { + sessionp->close(); + } + + void Session::commit() + { + sessionp->commit(); + } + + void Session::rollback() + { + sessionp->rollback(); + } + + void Session::acknowledge() + { + sessionp->acknowledge(); + } + + void Session::acknowledge(bool sync) + { + sessionp->acknowledge(sync); + } + + void Session::sync() + { + sessionp->sync(); + } + + void Session::sync(bool block) + { + sessionp->sync(block); + } + + System::UInt32 Session::getReceivable() + { + return sessionp->getReceivable(); + } + + System::UInt32 Session::getUnsettledAcks() + { + return sessionp->getUnsettledAcks(); + } + + //bool Session::nextReceiver(Receiver) + //{ + // sessionp->nextReceiver(Receiver) + //} + + //bool Session::nextReceiver(Receiver, Duration timeout) + //{ + // sessionp->nextReceiver(); + //} + + //Receiver Session::nextReceiver(Duration timeout) + //{ + //} + + + Sender ^ Session::createSender (System::String ^ address) + { + // allocate a native sender + ::qpid::messaging::Sender * senderp = new ::qpid::messaging::Sender; + + // create the sender + *senderp = sessionp->::qpid::messaging::Session::createSender(QpidMarshal::ToNative(address)); + + // create a managed sender + Sender ^ newSender = gcnew Sender(senderp, this); + + return newSender; + } + + Receiver ^ Session::createReceiver(System::String ^ address) + { + // allocate a native receiver + ::qpid::messaging::Receiver * receiverp = new ::qpid::messaging::Receiver; + + // create the receiver + *receiverp = sessionp->createReceiver(QpidMarshal::ToNative(address)); + + // create a managed receiver + Receiver ^ newReceiver = gcnew Receiver(receiverp, this); + + return newReceiver; + } + + Connection ^ Session::getConnection() + { + return parentConnectionp; + } + + bool Session::hasError() + { + return sessionp->hasError(); + } + + void Session::checkError() + { + sessionp->checkError(); + } +}}}} 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..3d1230e0a6 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/Session.h @@ -0,0 +1,93 @@ +/* +* 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 +#include +#include +#include +#include + +#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 { + + /// + /// Session is a managed wrapper for a ::qpid::messaging::Session + /// + + ref class Connection; + ref class Duration; + ref class Receiver; + ref class Sender; + + 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; + + // Kept object deletion code + void Cleanup(); + + public: + Session(::qpid::messaging::Session * sessionp, + Connection ^ connRef); + ~Session(); + !Session(); + Session(const Session % rhs); + + void close(); + void commit(); + void rollback(); + void acknowledge(); + void acknowledge(bool sync); + //void reject(Message); + //void release(Message); + void sync(); + void sync(bool block); + System::UInt32 getReceivable(); + System::UInt32 getUnsettledAcks(); + //bool nextReceiver(Receiver); + //bool nextReceiver(Receiver, Duration timeout); + //Receiver nextReceiver(Duration timeout); + //bool nextReceiver() + Sender ^ createSender (System::String ^ address); + Receiver ^ createReceiver(System::String ^ address); + Connection ^ getConnection(); + bool hasError(); + void checkError(); + }; +}}}} 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..b3f0d67631 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/app.rc @@ -0,0 +1,62 @@ +// 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) + +#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.vcproj b/qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj new file mode 100644 index 0000000000..e8e4bc695e --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/org.apache.qpid.messaging.vcproj @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/cpp/bindings/qpid/dotnet/src/resource.h b/qpid/cpp/bindings/qpid/dotnet/src/resource.h new file mode 100644 index 0000000000..e2f47357fe --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/src/resource.h @@ -0,0 +1,22 @@ +/* +* 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. +*/ + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc 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..699630e3f0 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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.cs b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs new file mode 100644 index 0000000000..63a85486d3 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using org.apache.qpid.messaging; + +namespace org.apache.qpid.messaging +{ + class Program + { + static void Main(string[] args) + { + // + // Duration test - stub until proper nunit tests are ready... + // + Duration myDuration = new Duration(1234); + + Console.WriteLine("Duration should be : 1234, is : {0}", + myDuration.getMilliseconds()); + + Console.WriteLine("Duration FOREVER should be : 1.8x10^19 (realbig), is : {0}", + myDuration.FOREVER()); + + Console.WriteLine("Duration IMMEDIATE should be : 0, is : {0}", + myDuration.IMMEDIATE()); + + Console.WriteLine("Duration SECOND should be : 1,000, is : {0}", + myDuration.SECOND()); + + Console.WriteLine("Duration MINUTE should be : 60,000, is : {0}", + myDuration.MINUTE()); + + // + // and so on + // + } + } +} 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..0c9d6af140 --- /dev/null +++ b/qpid/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.csproj @@ -0,0 +1,63 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {AF2FBC78-266C-430C-BC29-9477AB596A36} + Exe + Properties + messaging.test + messaging.test + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\bin\Debug\org.apache.qpid.messagingd.dll + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + -- cgit v1.2.1