diff options
author | Aidan Skinner <aidan@apache.org> | 2009-12-03 22:03:51 +0000 |
---|---|---|
committer | Aidan Skinner <aidan@apache.org> | 2009-12-03 22:03:51 +0000 |
commit | f5f57b9857d0853a235ac1594a4d3921760eaa85 (patch) | |
tree | bb1da85631bdbccc4265eea865a99d2494c7a7a5 /qpid/dotnet | |
parent | 9d5667f57e671114f66d64f8b7c4a3cf2f9b0c04 (diff) | |
download | qpid-python-f5f57b9857d0853a235ac1594a4d3921760eaa85.tar.gz |
fix line endings. sigh
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@886940 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet')
151 files changed, 14379 insertions, 14379 deletions
diff --git a/qpid/dotnet/client-010/README.txt b/qpid/dotnet/client-010/README.txt index 54875f4356..7f7ac2c6f3 100644 --- a/qpid/dotnet/client-010/README.txt +++ b/qpid/dotnet/client-010/README.txt @@ -1,67 +1,67 @@ -Info
-====
-
-AMQP 0.10 Native .NET client supporting WCF and xcel
-
-This client is self contained, all dependancies are in this
-directory.
-
-
-Setup
-=====
-
-Install:
- Microsoft Visual Studio 2005 (VS2005)
- NAnt 0.85 - only required for builds outside VS2005 (.net 1.1, .net 2.0, mono 2.0)
- Ant 1.6.5
- Cygwin (or alternatively build via cmd but alter instructions below accordingly)
-
-Set up PATH to include Nant.exe:
-
- $ PATH=/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727:$PATH
-
-Set up PATH to include ant:
-
- $ PATH=$ANT_HOME/bin:$PATH
-
-
-Building
-========
-
-Generate code from <project home>/dotnet/client-010/gentool:
-
- $ cd <project home>/dotnet/client-010/gentool
- $ ant
-
-You can build from Visual Studio 2005 normally. Alternatively, you
-can build debug releases for any supported framework from the
-command line using Nant:
-
-To build .NET 2.0 executables (to bin/net-2.0):
-
- $ cd <project home>/dotnet/client-010/
- $ nant
-
-
-To build for Mono on Linux (to bin/mono-2.0):
-
- $ cd <project home>/dotnet/client-010/
- $ nant -t:mono-2.0
-
-Releasing
-=========
-
-For .NET 2.0
-
- $ cd <project home>/dotnet/client-010/
- $ nant release-pkg
-
-Generates ./bin/net-2.0/release/Qpid.NET-net-2.0-yyyyMMdd.zip
-
-For Mono
-
- $ cd <project home>/dotnet/client-010/
- $ nant -t:mono-2.0 release-pkg
-
-Generates ./bin/mono-2.0/release/Qpid.NET-mono-2.0-yyyyMMdd.zip
-
+Info +==== + +AMQP 0.10 Native .NET client supporting WCF and xcel + +This client is self contained, all dependancies are in this +directory. + + +Setup +===== + +Install: + Microsoft Visual Studio 2005 (VS2005) + NAnt 0.85 - only required for builds outside VS2005 (.net 1.1, .net 2.0, mono 2.0) + Ant 1.6.5 + Cygwin (or alternatively build via cmd but alter instructions below accordingly) + +Set up PATH to include Nant.exe: + + $ PATH=/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727:$PATH + +Set up PATH to include ant: + + $ PATH=$ANT_HOME/bin:$PATH + + +Building +======== + +Generate code from <project home>/dotnet/client-010/gentool: + + $ cd <project home>/dotnet/client-010/gentool + $ ant + +You can build from Visual Studio 2005 normally. Alternatively, you +can build debug releases for any supported framework from the +command line using Nant: + +To build .NET 2.0 executables (to bin/net-2.0): + + $ cd <project home>/dotnet/client-010/ + $ nant + + +To build for Mono on Linux (to bin/mono-2.0): + + $ cd <project home>/dotnet/client-010/ + $ nant -t:mono-2.0 + +Releasing +========= + +For .NET 2.0 + + $ cd <project home>/dotnet/client-010/ + $ nant release-pkg + +Generates ./bin/net-2.0/release/Qpid.NET-net-2.0-yyyyMMdd.zip + +For Mono + + $ cd <project home>/dotnet/client-010/ + $ nant -t:mono-2.0 release-pkg + +Generates ./bin/mono-2.0/release/Qpid.NET-mono-2.0-yyyyMMdd.zip + diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config b/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config index 69e5bc36d6..66bf63532e 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config @@ -1,12 +1,12 @@ -<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
- <appSettings>
- <add key="Host" value="localhost" />
- <add key="Port" value="5672" />
- <add key="VirtualHost" value="test" />
- <add key="UserName" value="guest" />
- <add key="Password" value="guest" />
- <!-- <add key="ProcessorAssembly" value="C:\Project\qpid\dotnet\client-010\addins\ExcelAddInMessageProcessor\bin\Debug\ExcelAddInMessageProcessor.dll"/>
- <add key="ProcessorClass" value="ExcelAddInMessageProcessor.Processor"/> -->
- </appSettings>
+<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <appSettings> + <add key="Host" value="localhost" /> + <add key="Port" value="5672" /> + <add key="VirtualHost" value="test" /> + <add key="UserName" value="guest" /> + <add key="Password" value="guest" /> + <!-- <add key="ProcessorAssembly" value="C:\Project\qpid\dotnet\client-010\addins\ExcelAddInMessageProcessor\bin\Debug\ExcelAddInMessageProcessor.dll"/> + <add key="ProcessorClass" value="ExcelAddInMessageProcessor.Processor"/> --> + </appSettings> </configuration>
\ No newline at end of file diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs index d77f3761a8..02091d771f 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs @@ -1,290 +1,290 @@ -/*
-*
-* 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.Configuration;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Text;
-using Microsoft.Office.Interop.Excel;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-
-namespace ExcelAddIn
-{
- public delegate string ProcessMessage(IMessage m);
-
- /// <summary>
- /// This interface must be implemented so to use a user defined message processor
- /// </summary>
- public interface MessageProcessor
- {
- string ProcessMessage(IMessage m);
- }
-
- [ComVisible(true), ProgId("Qpid")]
- public class ExcelAddIn : IRtdServer
- {
- private IRTDUpdateEvent _onMessage;
- private readonly Dictionary<int, IMessage> _topicMessages = new Dictionary<int, IMessage>();
- private readonly Dictionary<string, QpidListener> _queueListener = new Dictionary<string, QpidListener>();
- private readonly Dictionary<int, string> _topicQueueName = new Dictionary<int, string>();
- private Client _client;
- private ClientSession _session;
- private ProcessMessage _messageProcessor;
-
- #region properties
-
- public IRTDUpdateEvent OnMessage
- {
- get { return _onMessage; }
- }
-
- public Dictionary<int, IMessage> TopicMessages
- {
- get { return _topicMessages; }
- }
-
- public ClientSession Session
- {
- get { return _session; }
- }
-
- #endregion
-
-
- #region IRtdServer Members
-
- /// <summary>
- /// Called when Excel requests the first RTD topic for the server.
- /// Connect to the broker, returns a on success and 0 otherwise
- /// </summary>
- /// <param name="CallbackObject"></param>
- /// <returns></returns>
- public int ServerStart(IRTDUpdateEvent CallbackObject)
- {
- _onMessage = CallbackObject;
- string host = "localhost";
- string port = "5673";
- string virtualhost = "test";
- string username = "guest";
- string password = "guest";
- _messageProcessor = getMessage;
-
- if( ConfigurationManager.AppSettings["Host"] != null )
- {
- host = ConfigurationManager.AppSettings["Host"];
- }
- if (ConfigurationManager.AppSettings["Port"] != null)
- {
- port = ConfigurationManager.AppSettings["Port"];
- }
- if (ConfigurationManager.AppSettings["VirtualHost"] != null)
- {
- virtualhost = ConfigurationManager.AppSettings["VirtualHost"];
- }
- if (ConfigurationManager.AppSettings["UserName"] != null)
- {
- username = ConfigurationManager.AppSettings["UserName"];
- }
- if (ConfigurationManager.AppSettings["Password"] != null)
- {
- password = ConfigurationManager.AppSettings["Password"];
- }
- if (ConfigurationManager.AppSettings["ProcessorAssembly"] != null)
- {
- try
- {
- Assembly a = Assembly.LoadFrom(ConfigurationManager.AppSettings["ProcessorAssembly"]);
- Object o = a.CreateInstance(ConfigurationManager.AppSettings["ProcessorClass"]);
- MessageProcessor p = (MessageProcessor) o;
- _messageProcessor = p.ProcessMessage;
- }
- catch (Exception e)
- {
- System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace);
- return 0;
- }
- }
-
- System.Windows.Forms.MessageBox.Show("Connection parameters: \n host: " + host + "\n port: "
- + port + "\n user: " + username);
- try
- {
- _client = new Client();
- _client.connect(host, Convert.ToInt16(port), virtualhost, username, password);
- // create a session
- _session = _client.createSession(0);
- }
- catch (Exception e)
- {
- System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace);
- return 0;
- }
-
- // always successful
- return 1;
- }
-
- /// <summary>
- /// Called whenever Excel requests a new RTD topic from the RealTimeData server.
- /// </summary>
- /// <param name="TopicID"></param>
- /// <param name="Strings"></param>
- /// <param name="GetNewValues"></param>
- /// <returns></returns>
- public object ConnectData(int TopicID, ref Array Strings, ref bool GetNewValues)
- {
- try
- {
- string queuename = "defaultExcelAddInQueue";
- string destinationName = "ExcelAddIn-" + queuename;
- if( Strings.Length > 0 )
- {
- queuename = (string) Strings.GetValue(0);
- }
- // Error message if the queue does not exist
- QueueQueryResult result = (QueueQueryResult)_session.queueQuery(queuename).Result;
- if( result.getQueue() == null )
- {
- System.Windows.Forms.MessageBox.Show("Error: \n queue " + queuename + " does not exist");
- return "error";
- }
-
- QpidListener listener;
- _topicMessages.Add(TopicID, null);
- _topicQueueName.Add(TopicID, queuename);
- if (_queueListener.ContainsKey(queuename))
- {
- listener = _queueListener[queuename];
- listener.addTopic(TopicID);
- }
- else
- {
- listener = new QpidListener(this);
- listener.addTopic(TopicID);
- _queueListener.Add(queuename, listener);
- _session.attachMessageListener(listener, destinationName);
- _session.messageSubscribe(queuename, destinationName, MessageAcceptMode.EXPLICIT,
- MessageAcquireMode.PRE_ACQUIRED, null, 0, null);
- // issue credits
- _session.messageSetFlowMode(destinationName, MessageFlowMode.WINDOW);
- _session.messageFlow(destinationName, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES);
- _session.messageFlow(destinationName, MessageCreditUnit.MESSAGE, 1000);
- _session.sync();
- }
- }
- catch (Exception e)
- {
- System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace);
- return "error";
- }
- return "waiting";
- }
-
- /// <summary>
- /// Called whenever Excel no longer requires a specific topic.
- /// </summary>
- /// <param name="TopicID"></param>
- public void DisconnectData(int TopicID)
- {
- _topicMessages.Remove(TopicID);
- string queueName = _topicQueueName[TopicID];
- if (_topicQueueName.Remove(TopicID) && !_topicQueueName.ContainsValue(queueName))
- {
- _session.messageStop("ExcelAddIn-" + queueName);
- _session.MessageListeners.Remove("ExcelAddIn-" + queueName);
- }
- }
-
- public int Heartbeat()
- {
- return 1;
- }
-
- public Array RefreshData(ref int TopicCount)
- {
- Array result = new object[2, _topicMessages.Count];
- foreach (KeyValuePair<int, IMessage> pair in _topicMessages)
- {
- result.SetValue(pair.Key, 0, pair.Key);
- string value = _messageProcessor(pair.Value);
- result.SetValue(value, 1, pair.Key);
- }
- TopicCount = _topicMessages.Count;
- return result;
- }
-
- public void ServerTerminate()
- {
-
- }
-
- #endregion
- //END IRTDServer METHODS
-
- private string getMessage(IMessage m)
- {
- string res;
- BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
- byte[] body = new byte[m.Body.Length - m.Body.Position];
- reader.Read(body, 0, body.Length);
- ASCIIEncoding enc = new ASCIIEncoding();
- res = enc.GetString(body);
- return res;
- }
-
- }
-
- class QpidListener : IMessageListener
- {
- private readonly ExcelAddIn _excel;
- private readonly List<int> _topics = new List<int>();
-
- public QpidListener(ExcelAddIn excel)
- {
- _excel = excel;
- }
-
- public void addTopic(int topic)
- {
- _topics.Add(topic);
- }
-
- public void messageTransfer(IMessage m)
- {
- foreach (int i in _topics)
- {
- if (_excel.TopicMessages.ContainsKey(i))
- {
- _excel.TopicMessages[i] = m;
- }
- }
- // ack this message
- RangeSet rs = new RangeSet();
- rs.add(m.Id);
- _excel.Session.messageAccept(rs);
- _excel.OnMessage.UpdateNotify();
- }
- }
+/* +* +* 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.Configuration; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using Microsoft.Office.Interop.Excel; +using org.apache.qpid.client; +using org.apache.qpid.transport; + +namespace ExcelAddIn +{ + public delegate string ProcessMessage(IMessage m); + + /// <summary> + /// This interface must be implemented so to use a user defined message processor + /// </summary> + public interface MessageProcessor + { + string ProcessMessage(IMessage m); + } + + [ComVisible(true), ProgId("Qpid")] + public class ExcelAddIn : IRtdServer + { + private IRTDUpdateEvent _onMessage; + private readonly Dictionary<int, IMessage> _topicMessages = new Dictionary<int, IMessage>(); + private readonly Dictionary<string, QpidListener> _queueListener = new Dictionary<string, QpidListener>(); + private readonly Dictionary<int, string> _topicQueueName = new Dictionary<int, string>(); + private Client _client; + private ClientSession _session; + private ProcessMessage _messageProcessor; + + #region properties + + public IRTDUpdateEvent OnMessage + { + get { return _onMessage; } + } + + public Dictionary<int, IMessage> TopicMessages + { + get { return _topicMessages; } + } + + public ClientSession Session + { + get { return _session; } + } + + #endregion + + + #region IRtdServer Members + + /// <summary> + /// Called when Excel requests the first RTD topic for the server. + /// Connect to the broker, returns a on success and 0 otherwise + /// </summary> + /// <param name="CallbackObject"></param> + /// <returns></returns> + public int ServerStart(IRTDUpdateEvent CallbackObject) + { + _onMessage = CallbackObject; + string host = "localhost"; + string port = "5673"; + string virtualhost = "test"; + string username = "guest"; + string password = "guest"; + _messageProcessor = getMessage; + + if( ConfigurationManager.AppSettings["Host"] != null ) + { + host = ConfigurationManager.AppSettings["Host"]; + } + if (ConfigurationManager.AppSettings["Port"] != null) + { + port = ConfigurationManager.AppSettings["Port"]; + } + if (ConfigurationManager.AppSettings["VirtualHost"] != null) + { + virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + } + if (ConfigurationManager.AppSettings["UserName"] != null) + { + username = ConfigurationManager.AppSettings["UserName"]; + } + if (ConfigurationManager.AppSettings["Password"] != null) + { + password = ConfigurationManager.AppSettings["Password"]; + } + if (ConfigurationManager.AppSettings["ProcessorAssembly"] != null) + { + try + { + Assembly a = Assembly.LoadFrom(ConfigurationManager.AppSettings["ProcessorAssembly"]); + Object o = a.CreateInstance(ConfigurationManager.AppSettings["ProcessorClass"]); + MessageProcessor p = (MessageProcessor) o; + _messageProcessor = p.ProcessMessage; + } + catch (Exception e) + { + System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace); + return 0; + } + } + + System.Windows.Forms.MessageBox.Show("Connection parameters: \n host: " + host + "\n port: " + + port + "\n user: " + username); + try + { + _client = new Client(); + _client.connect(host, Convert.ToInt16(port), virtualhost, username, password); + // create a session + _session = _client.createSession(0); + } + catch (Exception e) + { + System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace); + return 0; + } + + // always successful + return 1; + } + + /// <summary> + /// Called whenever Excel requests a new RTD topic from the RealTimeData server. + /// </summary> + /// <param name="TopicID"></param> + /// <param name="Strings"></param> + /// <param name="GetNewValues"></param> + /// <returns></returns> + public object ConnectData(int TopicID, ref Array Strings, ref bool GetNewValues) + { + try + { + string queuename = "defaultExcelAddInQueue"; + string destinationName = "ExcelAddIn-" + queuename; + if( Strings.Length > 0 ) + { + queuename = (string) Strings.GetValue(0); + } + // Error message if the queue does not exist + QueueQueryResult result = (QueueQueryResult)_session.queueQuery(queuename).Result; + if( result.getQueue() == null ) + { + System.Windows.Forms.MessageBox.Show("Error: \n queue " + queuename + " does not exist"); + return "error"; + } + + QpidListener listener; + _topicMessages.Add(TopicID, null); + _topicQueueName.Add(TopicID, queuename); + if (_queueListener.ContainsKey(queuename)) + { + listener = _queueListener[queuename]; + listener.addTopic(TopicID); + } + else + { + listener = new QpidListener(this); + listener.addTopic(TopicID); + _queueListener.Add(queuename, listener); + _session.attachMessageListener(listener, destinationName); + _session.messageSubscribe(queuename, destinationName, MessageAcceptMode.EXPLICIT, + MessageAcquireMode.PRE_ACQUIRED, null, 0, null); + // issue credits + _session.messageSetFlowMode(destinationName, MessageFlowMode.WINDOW); + _session.messageFlow(destinationName, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + _session.messageFlow(destinationName, MessageCreditUnit.MESSAGE, 1000); + _session.sync(); + } + } + catch (Exception e) + { + System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace); + return "error"; + } + return "waiting"; + } + + /// <summary> + /// Called whenever Excel no longer requires a specific topic. + /// </summary> + /// <param name="TopicID"></param> + public void DisconnectData(int TopicID) + { + _topicMessages.Remove(TopicID); + string queueName = _topicQueueName[TopicID]; + if (_topicQueueName.Remove(TopicID) && !_topicQueueName.ContainsValue(queueName)) + { + _session.messageStop("ExcelAddIn-" + queueName); + _session.MessageListeners.Remove("ExcelAddIn-" + queueName); + } + } + + public int Heartbeat() + { + return 1; + } + + public Array RefreshData(ref int TopicCount) + { + Array result = new object[2, _topicMessages.Count]; + foreach (KeyValuePair<int, IMessage> pair in _topicMessages) + { + result.SetValue(pair.Key, 0, pair.Key); + string value = _messageProcessor(pair.Value); + result.SetValue(value, 1, pair.Key); + } + TopicCount = _topicMessages.Count; + return result; + } + + public void ServerTerminate() + { + + } + + #endregion + //END IRTDServer METHODS + + private string getMessage(IMessage m) + { + string res; + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + ASCIIEncoding enc = new ASCIIEncoding(); + res = enc.GetString(body); + return res; + } + + } + + class QpidListener : IMessageListener + { + private readonly ExcelAddIn _excel; + private readonly List<int> _topics = new List<int>(); + + public QpidListener(ExcelAddIn excel) + { + _excel = excel; + } + + public void addTopic(int topic) + { + _topics.Add(topic); + } + + public void messageTransfer(IMessage m) + { + foreach (int i in _topics) + { + if (_excel.TopicMessages.ContainsKey(i)) + { + _excel.TopicMessages[i] = m; + } + } + // ack this message + RangeSet rs = new RangeSet(); + rs.add(m.Id); + _excel.Session.messageAccept(rs); + _excel.OnMessage.UpdateNotify(); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj index 7929933ef7..1a4c094416 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj @@ -1,61 +1,61 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{C2AE83A3-D5D1-469D-8611-A4738B9997CF}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>ExcelAddInMessageProcessor</RootNamespace>
- <AssemblyName>ExcelAddInMessageProcessor</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="**\*.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- <ProjectReference Include="..\ExcelAddIn\ExcelAddIn.csproj">
- <Project>{85EFD719-39F6-4471-90FF-9E621430344B}</Project>
- <Name>ExcelAddIn</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\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 DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{C2AE83A3-D5D1-469D-8611-A4738B9997CF}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ExcelAddInMessageProcessor</RootNamespace> + <AssemblyName>ExcelAddInMessageProcessor</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="**\*.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + <ProjectReference Include="..\ExcelAddIn\ExcelAddIn.csproj"> + <Project>{85EFD719-39F6-4471-90FF-9E621430344B}</Project> + <Name>ExcelAddIn</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs index 0b2d27519f..e414da131f 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs @@ -1,44 +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.
-*
-*/
-
-using System.IO;
-using System.Text;
-using org.apache.qpid.client;
-
-namespace ExcelAddInMessageProcessor
-{
- class Processor : ExcelAddIn.MessageProcessor
- {
- public string ProcessMessage(IMessage m)
- {
- BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
- byte[] body = new byte[m.Body.Length - m.Body.Position];
- reader.Read(body, 0, body.Length);
- ASCIIEncoding enc = new ASCIIEncoding();
- string res = enc.GetString(body);
- if (m.ApplicationHeaders.ContainsKey("price"))
- {
- res = res + ": price: " + m.ApplicationHeaders["price"];
- }
- return res;
- }
- }
+/* +* +* 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.IO; +using System.Text; +using org.apache.qpid.client; + +namespace ExcelAddInMessageProcessor +{ + class Processor : ExcelAddIn.MessageProcessor + { + public string ProcessMessage(IMessage m) + { + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + ASCIIEncoding enc = new ASCIIEncoding(); + string res = enc.GetString(body); + if (m.ApplicationHeaders.ContainsKey("price")) + { + res = res + ": price: " + m.ApplicationHeaders["price"]; + } + return res; + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj index 0969c61bd4..f860551868 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj @@ -1,57 +1,57 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{80F00C3B-EB38-4B3B-9F77-68977A30B155}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>ExcelAddInProducer</RootNamespace>
- <AssemblyName>Qpid Excel AddIn Producer</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="**\*.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\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 DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{80F00C3B-EB38-4B3B-9F77-68977A30B155}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ExcelAddInProducer</RootNamespace> + <AssemblyName>Qpid Excel AddIn Producer</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="**\*.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/addins/ExcelAddInProducer/Program.cs b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs index 9c9edcb249..0c97d6809b 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs @@ -1,55 +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 System.Text;
-using System.Threading;
-using org.apache.qpid.client;
-
-namespace ExcelAddInProducer
-{
- class Program
- {
- static void Main(string[] args)
- {
- Client client = new Client();
- Console.WriteLine("Client created");
- client.connect("192.168.1.14", 5672, "test", "guest", "guest");
- Console.WriteLine("Connection established");
-
- ClientSession ssn = client.createSession(50000);
- Console.WriteLine("Session created");
- ssn.queueDeclare("queue1", null, null);
- ssn.exchangeBind("queue1", "amq.direct", "queue1", null);
- IMessage message = new Message();
- message.ApplicationHeaders.Add("price", 0);
- for (int i = 0; i < 100; i++)
- {
- message.clearData();
- message.appendData( Encoding.UTF8.GetBytes("test: " + i));
- message.ApplicationHeaders["price"] = i;
- ssn.messageTransfer("amq.direct", "queue1", message);
- Thread.Sleep(1000);
- }
-
- client.close();
- }
- }
-}
+/* +* +* 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.Text; +using System.Threading; +using org.apache.qpid.client; + +namespace ExcelAddInProducer +{ + class Program + { + static void Main(string[] args) + { + Client client = new Client(); + Console.WriteLine("Client created"); + client.connect("192.168.1.14", 5672, "test", "guest", "guest"); + Console.WriteLine("Connection established"); + + ClientSession ssn = client.createSession(50000); + Console.WriteLine("Session created"); + ssn.queueDeclare("queue1", null, null); + ssn.exchangeBind("queue1", "amq.direct", "queue1", null); + IMessage message = new Message(); + message.ApplicationHeaders.Add("price", 0); + for (int i = 0; i < 100; i++) + { + message.clearData(); + message.appendData( Encoding.UTF8.GetBytes("test: " + i)); + message.ApplicationHeaders["price"] = i; + ssn.messageTransfer("amq.direct", "queue1", message); + Thread.Sleep(1000); + } + + client.close(); + } + } +} diff --git a/qpid/dotnet/client-010/addins/README.txt b/qpid/dotnet/client-010/addins/README.txt index 486a708910..5f8df77189 100644 --- a/qpid/dotnet/client-010/addins/README.txt +++ b/qpid/dotnet/client-010/addins/README.txt @@ -1,29 +1,29 @@ -This project contains three sub-projects:
-- The RTD excell Addin
-- A sample client sending messages to queue1
-- A ample message processor
-
-RDT AddIn
-Excel provides a function called RTD (real-time data) that lets you specify a COM server via its ProgId here "Qpid" so that you can push qpid messages into Excel.
-For using the Qpid RTD follows those steps:
-
-1) Copy the configuration Excel.exe.config into C:\Program Files\Microsoft Office\Office12
-2) Edit Excel.exe.xml and set the targeted Qpid broker host, port number
-3) Select the cell or cell range to contain the information
-4) enter the following formula =rtd("Qpid",,"myQueue") Where MyQueue is the queue from which you wish to receive messages from
-
-Note: The Qpid RTD is a COM-AddIn that must be registered with Excel. This is done automatically when compiling the Addin with visual studio.
-
-The default behavior of the RDT AddIn is to display the message payload. This could be altered by specifying your own message processor.
-A Message processor is a class that implements the API ExcelAddIn.MessageProcessor. For example, the provided processor in client-010\addins\ExcelAddInMessageProcessor displays the message body and the the header price when specified.
-
-To use you own message processor follows those steps:
-1) Write your own message processor that extends ExcelAddIn.MessageProcessor
-2) Edit Excel.exe.config and uncomment the entries:
- <add key="ProcessorAssembly" value="<path>\qpid\dotnet\client-010\addins\ExcelAddInMessageProcessor\bin\Debug\ExcelAddInMessageProcessor.dll"/>
- <add key="ProcessorClass" value="ExcelAddInMessageProcessor.Processor"/>
-- ProcessorAssembly is the path on the Assembly that contains your processor class
-- ProcessorClass is your processor class name
-3) run excel and define a rtd function
-
+This project contains three sub-projects: +- The RTD excell Addin +- A sample client sending messages to queue1 +- A ample message processor + +RDT AddIn +Excel provides a function called RTD (real-time data) that lets you specify a COM server via its ProgId here "Qpid" so that you can push qpid messages into Excel. +For using the Qpid RTD follows those steps: + +1) Copy the configuration Excel.exe.config into C:\Program Files\Microsoft Office\Office12 +2) Edit Excel.exe.xml and set the targeted Qpid broker host, port number +3) Select the cell or cell range to contain the information +4) enter the following formula =rtd("Qpid",,"myQueue") Where MyQueue is the queue from which you wish to receive messages from + +Note: The Qpid RTD is a COM-AddIn that must be registered with Excel. This is done automatically when compiling the Addin with visual studio. + +The default behavior of the RDT AddIn is to display the message payload. This could be altered by specifying your own message processor. +A Message processor is a class that implements the API ExcelAddIn.MessageProcessor. For example, the provided processor in client-010\addins\ExcelAddInMessageProcessor displays the message body and the the header price when specified. + +To use you own message processor follows those steps: +1) Write your own message processor that extends ExcelAddIn.MessageProcessor +2) Edit Excel.exe.config and uncomment the entries: + <add key="ProcessorAssembly" value="<path>\qpid\dotnet\client-010\addins\ExcelAddInMessageProcessor\bin\Debug\ExcelAddInMessageProcessor.dll"/> + <add key="ProcessorClass" value="ExcelAddInMessageProcessor.Processor"/> +- ProcessorAssembly is the path on the Assembly that contains your processor class +- ProcessorClass is your processor class name +3) run excel and define a rtd function + Note: the provided ExcelAddInProducer can be used for testing the provided message processor. As messages are sent to queue1 the following rtd fucntion should be used =rtd("Qpiud",,"queue1")
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj index e449781722..5d1a30c6aa 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -1,55 +1,55 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{B911FFD7-754F-4735-A188-218D5065BE79}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>client</RootNamespace>
- <AssemblyName>Qpid Client</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\log4net\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="**\*.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\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 DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{B911FFD7-754F-4735-A188-218D5065BE79}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>client</RootNamespace> + <AssemblyName>Qpid Client</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\lib\log4net\log4net.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="**\*.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/client/client.sln b/qpid/dotnet/client-010/client/client.sln index c94509e72a..e201be9d6f 100644 --- a/qpid/dotnet/client-010/client/client.sln +++ b/qpid/dotnet/client-010/client/client.sln @@ -1,104 +1,104 @@ -
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client.csproj", "{B911FFD7-754F-4735-A188-218D5065BE79}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "..\demo\Demo.csproj", "{E4C46FBC-7560-406D-BFEF-CA010E584DF4}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddIn", "..\addins\ExcelAddIn\ExcelAddIn.csproj", "{85EFD719-39F6-4471-90FF-9E621430344B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddInProducer", "..\addins\ExcelAddInProducer\ExcelAddInProducer.csproj", "{80F00C3B-EB38-4B3B-9F77-68977A30B155}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-direct-producer", "..\examples\direct\example-direct-producer\example-direct-producer.csproj", "{96FCB250-8142-40EE-9BDD-CA839EE21021}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-direct-Listener", "..\examples\direct\example-direct-Listener\example-direct-Listener.csproj", "{AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-pub-sub-Listener", "..\examples\pub-sub\example-pub-sub-Listener\example-pub-sub-Listener.csproj", "{2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-pub-sub-Publisher", "..\examples\pub-sub\example-pub-sub-Publisher\example-pub-sub-Publisher.csproj", "{F8857634-A134-44E7-A953-F2B22688C599}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "..\test\Test.csproj", "{95CB4C90-7C53-44A9-B11C-96235F158ACA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-request-response-Client", "..\examples\request-response\example-request-response-Client\example-request-response-Client.csproj", "{1BC63815-4029-4039-9207-35E7E06ECC99}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-request-response-Server", "..\examples\request-response\example-request-response-Server\example-request-response-Server.csproj", "{922FBA9C-E483-4AEF-ABE8-AC87421E829B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-fanout-Producer", "..\examples\fanout\example-fanout-Producer\example-fanout-Producer.csproj", "{4513BF94-D54A-42FE-8506-FE2CD57B2C51}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-fanout-Listener", "..\examples\fanout\example-fanout-Listener\example-fanout-Listener.csproj", "{18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "perftest", "..\perftest\perftest.csproj", "{7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddInMessageProcessor", "..\addins\ExcelAddInMessageProcessor\ExcelAddInMessageProcessor.csproj", "{C2AE83A3-D5D1-469D-8611-A4738B9997CF}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {B911FFD7-754F-4735-A188-218D5065BE79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B911FFD7-754F-4735-A188-218D5065BE79}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B911FFD7-754F-4735-A188-218D5065BE79}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B911FFD7-754F-4735-A188-218D5065BE79}.Release|Any CPU.Build.0 = Release|Any CPU
- {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Release|Any CPU.Build.0 = Release|Any CPU
- {85EFD719-39F6-4471-90FF-9E621430344B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {85EFD719-39F6-4471-90FF-9E621430344B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {85EFD719-39F6-4471-90FF-9E621430344B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {85EFD719-39F6-4471-90FF-9E621430344B}.Release|Any CPU.Build.0 = Release|Any CPU
- {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Release|Any CPU.Build.0 = Release|Any CPU
- {96FCB250-8142-40EE-9BDD-CA839EE21021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {96FCB250-8142-40EE-9BDD-CA839EE21021}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {96FCB250-8142-40EE-9BDD-CA839EE21021}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {96FCB250-8142-40EE-9BDD-CA839EE21021}.Release|Any CPU.Build.0 = Release|Any CPU
- {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Release|Any CPU.Build.0 = Release|Any CPU
- {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Release|Any CPU.Build.0 = Release|Any CPU
- {F8857634-A134-44E7-A953-F2B22688C599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F8857634-A134-44E7-A953-F2B22688C599}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F8857634-A134-44E7-A953-F2B22688C599}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F8857634-A134-44E7-A953-F2B22688C599}.Release|Any CPU.Build.0 = Release|Any CPU
- {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Release|Any CPU.Build.0 = Release|Any CPU
- {1BC63815-4029-4039-9207-35E7E06ECC99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1BC63815-4029-4039-9207-35E7E06ECC99}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1BC63815-4029-4039-9207-35E7E06ECC99}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1BC63815-4029-4039-9207-35E7E06ECC99}.Release|Any CPU.Build.0 = Release|Any CPU
- {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Release|Any CPU.Build.0 = Release|Any CPU
- {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Release|Any CPU.Build.0 = Release|Any CPU
- {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Release|Any CPU.Build.0 = Release|Any CPU
- {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Release|Any CPU.Build.0 = Release|Any CPU
- {C2AE83A3-D5D1-469D-8611-A4738B9997CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C2AE83A3-D5D1-469D-8611-A4738B9997CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C2AE83A3-D5D1-469D-8611-A4738B9997CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C2AE83A3-D5D1-469D-8611-A4738B9997CF}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client.csproj", "{B911FFD7-754F-4735-A188-218D5065BE79}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "..\demo\Demo.csproj", "{E4C46FBC-7560-406D-BFEF-CA010E584DF4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddIn", "..\addins\ExcelAddIn\ExcelAddIn.csproj", "{85EFD719-39F6-4471-90FF-9E621430344B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddInProducer", "..\addins\ExcelAddInProducer\ExcelAddInProducer.csproj", "{80F00C3B-EB38-4B3B-9F77-68977A30B155}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-direct-producer", "..\examples\direct\example-direct-producer\example-direct-producer.csproj", "{96FCB250-8142-40EE-9BDD-CA839EE21021}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-direct-Listener", "..\examples\direct\example-direct-Listener\example-direct-Listener.csproj", "{AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-pub-sub-Listener", "..\examples\pub-sub\example-pub-sub-Listener\example-pub-sub-Listener.csproj", "{2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-pub-sub-Publisher", "..\examples\pub-sub\example-pub-sub-Publisher\example-pub-sub-Publisher.csproj", "{F8857634-A134-44E7-A953-F2B22688C599}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "..\test\Test.csproj", "{95CB4C90-7C53-44A9-B11C-96235F158ACA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-request-response-Client", "..\examples\request-response\example-request-response-Client\example-request-response-Client.csproj", "{1BC63815-4029-4039-9207-35E7E06ECC99}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-request-response-Server", "..\examples\request-response\example-request-response-Server\example-request-response-Server.csproj", "{922FBA9C-E483-4AEF-ABE8-AC87421E829B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-fanout-Producer", "..\examples\fanout\example-fanout-Producer\example-fanout-Producer.csproj", "{4513BF94-D54A-42FE-8506-FE2CD57B2C51}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-fanout-Listener", "..\examples\fanout\example-fanout-Listener\example-fanout-Listener.csproj", "{18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "perftest", "..\perftest\perftest.csproj", "{7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddInMessageProcessor", "..\addins\ExcelAddInMessageProcessor\ExcelAddInMessageProcessor.csproj", "{C2AE83A3-D5D1-469D-8611-A4738B9997CF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B911FFD7-754F-4735-A188-218D5065BE79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B911FFD7-754F-4735-A188-218D5065BE79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B911FFD7-754F-4735-A188-218D5065BE79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B911FFD7-754F-4735-A188-218D5065BE79}.Release|Any CPU.Build.0 = Release|Any CPU + {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4C46FBC-7560-406D-BFEF-CA010E584DF4}.Release|Any CPU.Build.0 = Release|Any CPU + {85EFD719-39F6-4471-90FF-9E621430344B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85EFD719-39F6-4471-90FF-9E621430344B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85EFD719-39F6-4471-90FF-9E621430344B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85EFD719-39F6-4471-90FF-9E621430344B}.Release|Any CPU.Build.0 = Release|Any CPU + {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80F00C3B-EB38-4B3B-9F77-68977A30B155}.Release|Any CPU.Build.0 = Release|Any CPU + {96FCB250-8142-40EE-9BDD-CA839EE21021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96FCB250-8142-40EE-9BDD-CA839EE21021}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96FCB250-8142-40EE-9BDD-CA839EE21021}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96FCB250-8142-40EE-9BDD-CA839EE21021}.Release|Any CPU.Build.0 = Release|Any CPU + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}.Release|Any CPU.Build.0 = Release|Any CPU + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}.Release|Any CPU.Build.0 = Release|Any CPU + {F8857634-A134-44E7-A953-F2B22688C599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8857634-A134-44E7-A953-F2B22688C599}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8857634-A134-44E7-A953-F2B22688C599}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8857634-A134-44E7-A953-F2B22688C599}.Release|Any CPU.Build.0 = Release|Any CPU + {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95CB4C90-7C53-44A9-B11C-96235F158ACA}.Release|Any CPU.Build.0 = Release|Any CPU + {1BC63815-4029-4039-9207-35E7E06ECC99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1BC63815-4029-4039-9207-35E7E06ECC99}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1BC63815-4029-4039-9207-35E7E06ECC99}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1BC63815-4029-4039-9207-35E7E06ECC99}.Release|Any CPU.Build.0 = Release|Any CPU + {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {922FBA9C-E483-4AEF-ABE8-AC87421E829B}.Release|Any CPU.Build.0 = Release|Any CPU + {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4513BF94-D54A-42FE-8506-FE2CD57B2C51}.Release|Any CPU.Build.0 = Release|Any CPU + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}.Release|Any CPU.Build.0 = Release|Any CPU + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}.Release|Any CPU.Build.0 = Release|Any CPU + {C2AE83A3-D5D1-469D-8611-A4738B9997CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C2AE83A3-D5D1-469D-8611-A4738B9997CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C2AE83A3-D5D1-469D-8611-A4738B9997CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C2AE83A3-D5D1-469D-8611-A4738B9997CF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/qpid/dotnet/client-010/client/client.suo b/qpid/dotnet/client-010/client/client.suo Binary files differindex cfdbf4be93..0640275f99 100644 --- a/qpid/dotnet/client-010/client/client.suo +++ b/qpid/dotnet/client-010/client/client.suo diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index 4871a1c3d9..85332b4059 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -1,145 +1,145 @@ -/*
-* 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.Text;
-using System.Threading;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.network.io;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.client
-{
- public class Client : ClientInterface
- {
- private Connection _conn;
- private static readonly Logger _log = Logger.get(typeof (Client));
- private const long timeout = 60000;
- private bool _closed;
- private readonly Object _closeOK;
- private ClosedListener _closedListner;
-
- public bool Closed
- {
- get { return _closed; }
- set { _closed = value; }
- }
-
- public Object CloseOk
- {
- get { return _closeOK; }
- }
-
- public Client()
- {
- _closed = false;
- _closeOK = new object();
- }
-
- #region Interface ClientInterface
-
- /// <summary>
- /// Establishes a connection with a broker using the provided user auths
- ///
- /// </summary>
- /// <param name="host">Host name on which a broker is deployed</param>
- /// <param name="port">Broker port </param>
- /// <param name="virtualHost">virtual host name</param>
- /// <param name="username">User Name</param>
- /// <param name="password">Password</param>
- public void connect(String host, int port, String virtualHost, String username, String password)
- {
- _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host,
- port, virtualHost, username));
- ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password);
- ManualResetEvent negotiationComplete = new ManualResetEvent(false);
- connectionDelegate.setCondition(negotiationComplete);
- connectionDelegate.VirtualHost = virtualHost;
- _conn = IoTransport.connect(host, port, connectionDelegate);
-
- _conn.send(new ProtocolHeader(1, 0, 10));
- negotiationComplete.WaitOne();
- }
-
- /// <summary>
- /// Establishes a connection with a broker using SSL
- ///
- /// </summary>
- /// <param name="host">Host name on which a broker is deployed</param>
- /// <param name="port">Broker port </param>
- /// <param name="virtualHost">virtual host name</param>
- /// <param name="username">User Name</param>
- /// <param name="password">Password</param>
- /// <param name="serverName">Name of the SSL server</param>
- /// <param name="certPath">Path to the X509 certificate to be used for client authentication</param>
- /// <param name="rejectUntrusted">If true connection will not be established if the broker is not trusted</param>
- public void connectSSL(String host, int port, String virtualHost, String username, String password, string serverName, string certPath, bool rejectUntrusted)
- {
- _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host,
- port, virtualHost, username));
- _log.debug(String.Format("SSL paramters: serverName: {0}; certPath: {1}; rejectUntrusted: {2}", serverName, certPath, rejectUntrusted));
- ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password);
- ManualResetEvent negotiationComplete = new ManualResetEvent(false);
- connectionDelegate.setCondition(negotiationComplete);
- connectionDelegate.VirtualHost = virtualHost;
- _conn = IoSSLTransport.connect(host, port, serverName, certPath, rejectUntrusted, connectionDelegate);
-
- _conn.send(new ProtocolHeader(1, 0, 10));
- negotiationComplete.WaitOne();
- }
-
- public void close()
- {
- Channel ch = _conn.getChannel(0);
- ch.connectionClose(ConnectionCloseCode.NORMAL, "client is closing");
- lock (CloseOk)
- {
- DateTime start = DateTime.Now;
- long elapsed = 0;
- while (!Closed && elapsed < timeout)
- {
- Monitor.Wait(CloseOk, (int) (timeout - elapsed));
- elapsed = DateTime.Now.Subtract(start).Milliseconds;
- }
- if (!Closed)
- {
- throw new Exception("Timed out when closing connection");
- }
- _conn.close();
- }
- }
-
- public ClientSession createSession(long expiryInSeconds)
- {
- Channel ch = _conn.getChannel();
- ClientSession ssn = new ClientSession(Encoding.UTF8.GetBytes(UUID.randomUUID().ToString()));
- ssn.attach(ch);
- ssn.sessionAttach(ssn.getName());
- ssn.sessionRequestTimeout(expiryInSeconds);
- return ssn;
- }
-
- public ClosedListener ClosedListener
- {
- set { _closedListner = value; }
- get { return _closedListner; }
- }
-
- #endregion
- }
-}
+/* +* 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.Text; +using System.Threading; +using org.apache.qpid.transport; +using org.apache.qpid.transport.network.io; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.client +{ + public class Client : ClientInterface + { + private Connection _conn; + private static readonly Logger _log = Logger.get(typeof (Client)); + private const long timeout = 60000; + private bool _closed; + private readonly Object _closeOK; + private ClosedListener _closedListner; + + public bool Closed + { + get { return _closed; } + set { _closed = value; } + } + + public Object CloseOk + { + get { return _closeOK; } + } + + public Client() + { + _closed = false; + _closeOK = new object(); + } + + #region Interface ClientInterface + + /// <summary> + /// Establishes a connection with a broker using the provided user auths + /// + /// </summary> + /// <param name="host">Host name on which a broker is deployed</param> + /// <param name="port">Broker port </param> + /// <param name="virtualHost">virtual host name</param> + /// <param name="username">User Name</param> + /// <param name="password">Password</param> + public void connect(String host, int port, String virtualHost, String username, String password) + { + _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host, + port, virtualHost, username)); + ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); + ManualResetEvent negotiationComplete = new ManualResetEvent(false); + connectionDelegate.setCondition(negotiationComplete); + connectionDelegate.VirtualHost = virtualHost; + _conn = IoTransport.connect(host, port, connectionDelegate); + + _conn.send(new ProtocolHeader(1, 0, 10)); + negotiationComplete.WaitOne(); + } + + /// <summary> + /// Establishes a connection with a broker using SSL + /// + /// </summary> + /// <param name="host">Host name on which a broker is deployed</param> + /// <param name="port">Broker port </param> + /// <param name="virtualHost">virtual host name</param> + /// <param name="username">User Name</param> + /// <param name="password">Password</param> + /// <param name="serverName">Name of the SSL server</param> + /// <param name="certPath">Path to the X509 certificate to be used for client authentication</param> + /// <param name="rejectUntrusted">If true connection will not be established if the broker is not trusted</param> + public void connectSSL(String host, int port, String virtualHost, String username, String password, string serverName, string certPath, bool rejectUntrusted) + { + _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host, + port, virtualHost, username)); + _log.debug(String.Format("SSL paramters: serverName: {0}; certPath: {1}; rejectUntrusted: {2}", serverName, certPath, rejectUntrusted)); + ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); + ManualResetEvent negotiationComplete = new ManualResetEvent(false); + connectionDelegate.setCondition(negotiationComplete); + connectionDelegate.VirtualHost = virtualHost; + _conn = IoSSLTransport.connect(host, port, serverName, certPath, rejectUntrusted, connectionDelegate); + + _conn.send(new ProtocolHeader(1, 0, 10)); + negotiationComplete.WaitOne(); + } + + public void close() + { + Channel ch = _conn.getChannel(0); + ch.connectionClose(ConnectionCloseCode.NORMAL, "client is closing"); + lock (CloseOk) + { + DateTime start = DateTime.Now; + long elapsed = 0; + while (!Closed && elapsed < timeout) + { + Monitor.Wait(CloseOk, (int) (timeout - elapsed)); + elapsed = DateTime.Now.Subtract(start).Milliseconds; + } + if (!Closed) + { + throw new Exception("Timed out when closing connection"); + } + _conn.close(); + } + } + + public ClientSession createSession(long expiryInSeconds) + { + Channel ch = _conn.getChannel(); + ClientSession ssn = new ClientSession(Encoding.UTF8.GetBytes(UUID.randomUUID().ToString())); + ssn.attach(ch); + ssn.sessionAttach(ssn.getName()); + ssn.sessionRequestTimeout(expiryInSeconds); + return ssn; + } + + public ClosedListener ClosedListener + { + set { _closedListner = value; } + get { return _closedListner; } + } + + #endregion + } +} diff --git a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs index 5ed4187b36..fc1829e6bd 100644 --- a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs @@ -1,97 +1,97 @@ -/*
-* 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.IO;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.client
-{
- internal class ClientConnectionDelegate : ClientDelegate
- {
- private static readonly Logger log = Logger.get(typeof (ClientConnectionDelegate));
- private readonly Client _client;
- private string _username;
- private string _password;
-
- public ClientConnectionDelegate(Client client, string username, string pasword)
- {
- _client = client;
- _username = username;
- _password = pasword;
- }
-
- public override SessionDelegate getSessionDelegate()
- {
- return new ClientSessionDelegate();
- }
-
- public override void exception(Exception t)
- {
- throw t;
- }
-
- public override void connectionStart(Channel context, ConnectionStart mystruct)
- {
- const string mechanism = "PLAIN";
- MemoryStream stResponse = new MemoryStream();
- byte[] part = Encoding.UTF8.GetBytes(_username);
- stResponse.WriteByte(0);
- stResponse.Write(part, 0, part.Length);
- stResponse.WriteByte(0);
- part = Encoding.UTF8.GetBytes(_password);
- stResponse.Write(part, 0, part.Length);
- Dictionary<String, Object> props = new Dictionary<String, Object>();
- context.connectionStartOk(props, mechanism, stResponse.ToArray(), "utf8");
- }
-
- public override void closed()
- {
- log.debug("Delegate closed");
- lock (_client.CloseOk)
- {
- try
- {
- _client.Closed = true;
- Monitor.PulseAll(_client.CloseOk);
- }
- catch (Exception e)
- {
- throw new SystemException("Error when closing client", e);
- }
- }
- }
-
- public override void connectionClose(Channel context, ConnectionClose connectionClose)
- {
- base.connectionClose(context, connectionClose);
- ErrorCode errorCode = ErrorCode.getErrorCode((int) connectionClose.getReplyCode());
- if (_client.ClosedListener == null && errorCode.Code != (int) QpidErrorCode.NO_ERROR)
- {
- throw new Exception ("Server closed the connection: Reason " +
- connectionClose.getReplyText());
- }
- _client.ClosedListener.onClosed(errorCode, connectionClose.getReplyText(), null);
- }
- }
-}
+/* +* 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.IO; +using System.Text; +using System.Threading; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.client +{ + internal class ClientConnectionDelegate : ClientDelegate + { + private static readonly Logger log = Logger.get(typeof (ClientConnectionDelegate)); + private readonly Client _client; + private string _username; + private string _password; + + public ClientConnectionDelegate(Client client, string username, string pasword) + { + _client = client; + _username = username; + _password = pasword; + } + + public override SessionDelegate getSessionDelegate() + { + return new ClientSessionDelegate(); + } + + public override void exception(Exception t) + { + throw t; + } + + public override void connectionStart(Channel context, ConnectionStart mystruct) + { + const string mechanism = "PLAIN"; + MemoryStream stResponse = new MemoryStream(); + byte[] part = Encoding.UTF8.GetBytes(_username); + stResponse.WriteByte(0); + stResponse.Write(part, 0, part.Length); + stResponse.WriteByte(0); + part = Encoding.UTF8.GetBytes(_password); + stResponse.Write(part, 0, part.Length); + Dictionary<String, Object> props = new Dictionary<String, Object>(); + context.connectionStartOk(props, mechanism, stResponse.ToArray(), "utf8"); + } + + public override void closed() + { + log.debug("Delegate closed"); + lock (_client.CloseOk) + { + try + { + _client.Closed = true; + Monitor.PulseAll(_client.CloseOk); + } + catch (Exception e) + { + throw new SystemException("Error when closing client", e); + } + } + } + + public override void connectionClose(Channel context, ConnectionClose connectionClose) + { + base.connectionClose(context, connectionClose); + ErrorCode errorCode = ErrorCode.getErrorCode((int) connectionClose.getReplyCode()); + if (_client.ClosedListener == null && errorCode.Code != (int) QpidErrorCode.NO_ERROR) + { + throw new Exception ("Server closed the connection: Reason " + + connectionClose.getReplyText()); + } + _client.ClosedListener.onClosed(errorCode, connectionClose.getReplyText(), null); + } + } +} diff --git a/qpid/dotnet/client-010/client/client/ClientInterface.cs b/qpid/dotnet/client-010/client/client/ClientInterface.cs index 85be5886c6..fcf7ae9f31 100644 --- a/qpid/dotnet/client-010/client/client/ClientInterface.cs +++ b/qpid/dotnet/client-010/client/client/ClientInterface.cs @@ -1,59 +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.
-*/
-
-using System;
-
-namespace org.apache.qpid.client
-{
- public interface ClientInterface
- {
- /// <summary>
- /// Establish a connection with the broker using the given parameters
- ///
- /// </summary>
- /// <param name="host">host name</param>
- /// <param name="port">port number</param>
- /// <param name="virtualHost">virtualHost the virtual host name</param>
- /// <param name="username"> username user name</param>
- /// <param name="passwor">password password</param>
- void connect(String host, int port, String virtualHost, String username, String passwor);
-
- /// <summary>
- /// Close this client
- /// </summary>
- void close();
-
- /// <summary>
- /// Create a session for this connection.
- /// The returned session is suspended
- /// (i.e. this session is not attached to an underlying channel)
- /// </summary>
- /// <param name="expiryInSeconds">Expiry time expressed in seconds, if the value is less than
- /// or equal to 0 then the session does not expire.</param>
- /// <returns>A newly created (suspended) session.</returns>
- ClientSession createSession(long expiryInSeconds);
-
- /// <summary>
- /// If the communication layer detects a serious problem with a connection, it
- // informs the client's ClosedListener
- /// </summary>
- ///
- ClosedListener ClosedListener { set; }
- }
-}
+/* +* 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; + +namespace org.apache.qpid.client +{ + public interface ClientInterface + { + /// <summary> + /// Establish a connection with the broker using the given parameters + /// + /// </summary> + /// <param name="host">host name</param> + /// <param name="port">port number</param> + /// <param name="virtualHost">virtualHost the virtual host name</param> + /// <param name="username"> username user name</param> + /// <param name="passwor">password password</param> + void connect(String host, int port, String virtualHost, String username, String passwor); + + /// <summary> + /// Close this client + /// </summary> + void close(); + + /// <summary> + /// Create a session for this connection. + /// The returned session is suspended + /// (i.e. this session is not attached to an underlying channel) + /// </summary> + /// <param name="expiryInSeconds">Expiry time expressed in seconds, if the value is less than + /// or equal to 0 then the session does not expire.</param> + /// <returns>A newly created (suspended) session.</returns> + ClientSession createSession(long expiryInSeconds); + + /// <summary> + /// If the communication layer detects a serious problem with a connection, it + // informs the client's ClosedListener + /// </summary> + /// + ClosedListener ClosedListener { set; } + } +} diff --git a/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs index 1b40e2ba45..f81b14e9aa 100644 --- a/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs @@ -1,55 +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 org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.client
-{
- public class ClientSessionDelegate : SessionDelegate
- {
- private static readonly Logger _log = Logger.get(typeof (ClientSessionDelegate));
-
- // --------------------------------------------
- // Message methods
- // --------------------------------------------
- public override void messageTransfer(Session session, MessageTransfer xfr)
- {
- if (((ClientSession) session).MessageListeners.ContainsKey(xfr.getDestination()))
- {
- IMessageListener listener = ((ClientSession)session).MessageListeners[xfr.getDestination()];
- listener.messageTransfer( new Message(xfr));
- }
- else
- {
- _log.warn("No listener set for: {0}", xfr);
- }
- }
-
- public override void messageReject(Session session, MessageReject mstruct)
- {
- foreach (Range range in mstruct.getTransfers())
- {
- for (long l = range.Lower; l <= range.Upper; l++)
- {
- _log.warn("message rejected: " + session.getCommand((int) l));
- }
- }
- }
- }
+/* +* 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 org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.client +{ + public class ClientSessionDelegate : SessionDelegate + { + private static readonly Logger _log = Logger.get(typeof (ClientSessionDelegate)); + + // -------------------------------------------- + // Message methods + // -------------------------------------------- + public override void messageTransfer(Session session, MessageTransfer xfr) + { + if (((ClientSession) session).MessageListeners.ContainsKey(xfr.getDestination())) + { + IMessageListener listener = ((ClientSession)session).MessageListeners[xfr.getDestination()]; + listener.messageTransfer( new Message(xfr)); + } + else + { + _log.warn("No listener set for: {0}", xfr); + } + } + + public override void messageReject(Session session, MessageReject mstruct) + { + foreach (Range range in mstruct.getTransfers()) + { + for (long l = range.Lower; l <= range.Upper; l++) + { + _log.warn("message rejected: " + session.getCommand((int) l)); + } + } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs b/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs index 8089c3bd90..133b00abdd 100644 --- a/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs +++ b/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs @@ -1,29 +1,29 @@ -/*
-* 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;
-
-namespace org.apache.qpid.client
-{
- public interface ClosedListener
- {
-
- void onClosed(ErrorCode errorCode, String reason, Exception t);
- }
-}
+/* +* 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; + +namespace org.apache.qpid.client +{ + public interface ClosedListener + { + + void onClosed(ErrorCode errorCode, String reason, Exception t); + } +} diff --git a/qpid/dotnet/client-010/client/client/ErrorCode.cs b/qpid/dotnet/client-010/client/client/ErrorCode.cs index 226f078dac..03ea0df911 100644 --- a/qpid/dotnet/client-010/client/client/ErrorCode.cs +++ b/qpid/dotnet/client-010/client/client/ErrorCode.cs @@ -1,140 +1,140 @@ -/*
-* 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;
-
-namespace org.apache.qpid.client
-{
- public enum QpidErrorCode
- {
- NO_ERROR = 200,
- CONTENT_TOO_LARGE = 311,
- NO_ROUTE = 312,
- NO_CONSUMERS = 313,
- CONNECTION_FORCED = 320,
- INVALID_PATH = 402,
- ACCESS_REFUSED = 403,
- NOT_FOUND = 404,
- RESOURCE_LOCKED = 405,
- PRE_CONDITION_FAILED = 406,
- FRAME_ERROR = 501,
- SYNTAX_ERROR = 502,
- COMMAND_INVALID = 503,
- SESSION_ERROR = 504,
- NOT_ALLOWED = 530,
- NOT_IMPLEMENTED = 540,
- INTERNAL_ERROR = 541,
- INVALID_ARGUMENT = 542,
- UNDEFINED = 1
- }
-
- public struct ErrorCode
- {
- private int _code;
- private String _desc;
- private readonly bool _hardError;
-
- public ErrorCode(int code, String desc, bool hardError)
- {
- _code = code;
- _desc = desc;
- _hardError = hardError;
- }
-
- public int Code
- {
- get { return _code; }
- set { _code = value; }
- }
-
- public String Description
- {
- get { return _desc; }
- set { _desc = value; }
- }
-
- public bool ISHardError
- {
- get { return _hardError; }
- }
-
- public static ErrorCode getErrorCode(int code)
- {
- switch (code)
- {
- case 200:
- return
- new ErrorCode(200, "reply-success", true);
- case 311:
- return
- new ErrorCode(311, "content-too-large", false);
- case 312:
- return
- new ErrorCode(312, "no-route", false);
- case 313:
- return
- new ErrorCode(313, "content-consumers", false);
- case 320:
- return
- new ErrorCode(320, "connection-forced", true);
- case 402:
- return
- new ErrorCode(402, "invalid-path", true);
- case 403:
- return
- new ErrorCode(403, "access-refused", false);
- case 404:
- return
- new ErrorCode(404, "not-found", false);
- case 405:
- return
- new ErrorCode(405, "resource-locked", false);
- case 406:
- return
- new ErrorCode(406, "precondition-failed", false);
- case 501:
- return
- new ErrorCode(501, "frame_error", true);
- case 502:
- return
- new ErrorCode(502, "syntax_error", true);
- case 503:
- return
- new ErrorCode(503, "command_invalid", true);
- case 504:
- return
- new ErrorCode(504, "sesion_error", true);
- case 530:
- return
- new ErrorCode(530, "not_allowed", true);
- case 540:
- return
- new ErrorCode(540, "not_implemented", true);
- case 541:
- return
- new ErrorCode(541, "internal_error", true);
- case 542:
- return
- new ErrorCode(542, "invalid_argument", true);
- default:
- return new ErrorCode(1, "undefined", true);
- }
- }
- }
+/* +* 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; + +namespace org.apache.qpid.client +{ + public enum QpidErrorCode + { + NO_ERROR = 200, + CONTENT_TOO_LARGE = 311, + NO_ROUTE = 312, + NO_CONSUMERS = 313, + CONNECTION_FORCED = 320, + INVALID_PATH = 402, + ACCESS_REFUSED = 403, + NOT_FOUND = 404, + RESOURCE_LOCKED = 405, + PRE_CONDITION_FAILED = 406, + FRAME_ERROR = 501, + SYNTAX_ERROR = 502, + COMMAND_INVALID = 503, + SESSION_ERROR = 504, + NOT_ALLOWED = 530, + NOT_IMPLEMENTED = 540, + INTERNAL_ERROR = 541, + INVALID_ARGUMENT = 542, + UNDEFINED = 1 + } + + public struct ErrorCode + { + private int _code; + private String _desc; + private readonly bool _hardError; + + public ErrorCode(int code, String desc, bool hardError) + { + _code = code; + _desc = desc; + _hardError = hardError; + } + + public int Code + { + get { return _code; } + set { _code = value; } + } + + public String Description + { + get { return _desc; } + set { _desc = value; } + } + + public bool ISHardError + { + get { return _hardError; } + } + + public static ErrorCode getErrorCode(int code) + { + switch (code) + { + case 200: + return + new ErrorCode(200, "reply-success", true); + case 311: + return + new ErrorCode(311, "content-too-large", false); + case 312: + return + new ErrorCode(312, "no-route", false); + case 313: + return + new ErrorCode(313, "content-consumers", false); + case 320: + return + new ErrorCode(320, "connection-forced", true); + case 402: + return + new ErrorCode(402, "invalid-path", true); + case 403: + return + new ErrorCode(403, "access-refused", false); + case 404: + return + new ErrorCode(404, "not-found", false); + case 405: + return + new ErrorCode(405, "resource-locked", false); + case 406: + return + new ErrorCode(406, "precondition-failed", false); + case 501: + return + new ErrorCode(501, "frame_error", true); + case 502: + return + new ErrorCode(502, "syntax_error", true); + case 503: + return + new ErrorCode(503, "command_invalid", true); + case 504: + return + new ErrorCode(504, "sesion_error", true); + case 530: + return + new ErrorCode(530, "not_allowed", true); + case 540: + return + new ErrorCode(540, "not_implemented", true); + case 541: + return + new ErrorCode(541, "internal_error", true); + case 542: + return + new ErrorCode(542, "invalid_argument", true); + default: + return new ErrorCode(1, "undefined", true); + } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/client/IMessage.cs b/qpid/dotnet/client-010/client/client/IMessage.cs index 10b92de7ff..f1037b70a8 100644 --- a/qpid/dotnet/client-010/client/client/IMessage.cs +++ b/qpid/dotnet/client-010/client/client/IMessage.cs @@ -1,48 +1,48 @@ -/*
-*
-* 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.IO;
-using org.apache.qpid.transport;
-
-namespace org.apache.qpid.client
-{
- public interface IMessage
- {
- int Id { get; }
-
- Header Header { get; set; }
-
- MessageProperties MessageProperties { get; set; }
-
- DeliveryProperties DeliveryProperties { get; set; }
-
- Dictionary<String, Object> ApplicationHeaders { get; set; }
-
- void appendData(byte[] bytes);
-
- MemoryStream Body { get; }
-
- string Destination { get; }
-
- void clearData();
- }
-}
+/* +* +* 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.IO; +using org.apache.qpid.transport; + +namespace org.apache.qpid.client +{ + public interface IMessage + { + int Id { get; } + + Header Header { get; set; } + + MessageProperties MessageProperties { get; set; } + + DeliveryProperties DeliveryProperties { get; set; } + + Dictionary<String, Object> ApplicationHeaders { get; set; } + + void appendData(byte[] bytes); + + MemoryStream Body { get; } + + string Destination { get; } + + void clearData(); + } +} diff --git a/qpid/dotnet/client-010/client/client/Message.cs b/qpid/dotnet/client-010/client/client/Message.cs index 567ca5cae7..0cb6030c82 100644 --- a/qpid/dotnet/client-010/client/client/Message.cs +++ b/qpid/dotnet/client-010/client/client/Message.cs @@ -1,131 +1,131 @@ -/*
-*
-* 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.Collections.Generic;
-using System.IO;
-using org.apache.qpid.transport;
-
-namespace org.apache.qpid.client
-{
- public class Message : IMessage
- {
- private readonly MessageTransfer _message;
-
- public Message(MessageTransfer m)
- {
- _message = m;
- }
-
- public Message()
- {
- _message = new MessageTransfer();
- _message.Header = new Header( new MessageProperties(), new DeliveryProperties());
- ((MessageProperties) _message.Header.Structs[0]).setApplicationHeaders(new Dictionary<string, object>());
- }
-
- public MessageProperties MessageProperties
- {
- get
- {
- if (_message.Header != null && Header.Structs.Length > 1)
- return (MessageProperties) Header.Structs[0];
- return null;
- }
- set
- {
- if (_message.Header != null)
- {
- Header.Structs[0] = value;
- }
- }
- }
-
- public DeliveryProperties DeliveryProperties
- {
- get
- {
- if (Header != null)
- {
- if( Header.Structs.Length > 1 )
- return (DeliveryProperties)Header.Structs[1];
- return (DeliveryProperties)Header.Structs[0];
- }
-
- return null;
- }
- set
- {
- if (Header != null)
- {
- Header.Structs[1] = value;
- }
- }
- }
-
- public Dictionary<string, object> ApplicationHeaders
- {
- get
- {
- if (Header != null)
- return ((MessageProperties) Header.Structs[0]).getApplicationHeaders();
- return null;
- }
- set
- {
- if (Header != null)
- {
- ((MessageProperties) Header.Structs[0]).setApplicationHeaders(value);
- }
- }
- }
-
- public void appendData(byte[] bytes)
- {
- Body.Write(bytes, 0, bytes.Length);
- }
-
- public void clearData()
- {
- Body.Seek(0, SeekOrigin.Begin);
- }
-
- public Header Header
- {
- get{ return _message.Header;}
- set{ _message.Header = value;}
- }
-
- public MemoryStream Body
- {
- get { return _message.Body; }
- set { _message.Body = value; }
- }
-
- public int Id
- {
- get { return _message.Id; }
- }
-
- public string Destination
- {
- get{ return _message.getDestination();}
- }
- }
-}
+/* +* +* 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.Collections.Generic; +using System.IO; +using org.apache.qpid.transport; + +namespace org.apache.qpid.client +{ + public class Message : IMessage + { + private readonly MessageTransfer _message; + + public Message(MessageTransfer m) + { + _message = m; + } + + public Message() + { + _message = new MessageTransfer(); + _message.Header = new Header( new MessageProperties(), new DeliveryProperties()); + ((MessageProperties) _message.Header.Structs[0]).setApplicationHeaders(new Dictionary<string, object>()); + } + + public MessageProperties MessageProperties + { + get + { + if (_message.Header != null && Header.Structs.Length > 1) + return (MessageProperties) Header.Structs[0]; + return null; + } + set + { + if (_message.Header != null) + { + Header.Structs[0] = value; + } + } + } + + public DeliveryProperties DeliveryProperties + { + get + { + if (Header != null) + { + if( Header.Structs.Length > 1 ) + return (DeliveryProperties)Header.Structs[1]; + return (DeliveryProperties)Header.Structs[0]; + } + + return null; + } + set + { + if (Header != null) + { + Header.Structs[1] = value; + } + } + } + + public Dictionary<string, object> ApplicationHeaders + { + get + { + if (Header != null) + return ((MessageProperties) Header.Structs[0]).getApplicationHeaders(); + return null; + } + set + { + if (Header != null) + { + ((MessageProperties) Header.Structs[0]).setApplicationHeaders(value); + } + } + } + + public void appendData(byte[] bytes) + { + Body.Write(bytes, 0, bytes.Length); + } + + public void clearData() + { + Body.Seek(0, SeekOrigin.Begin); + } + + public Header Header + { + get{ return _message.Header;} + set{ _message.Header = value;} + } + + public MemoryStream Body + { + get { return _message.Body; } + set { _message.Body = value; } + } + + public int Id + { + get { return _message.Id; } + } + + public string Destination + { + get{ return _message.getDestination();} + } + } +} diff --git a/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs b/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs index 978248e04c..f365077d71 100644 --- a/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs +++ b/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs @@ -1,31 +1,31 @@ -/*
-* 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.client
-{
- public interface IMessageListener
- {
- /// <summary>
- /// Inform the listener of the message transfer
- /// </summary>
- /// <param name="xfr">The message transfer object</param>
- void messageTransfer(IMessage xfr);
- }
-}
+/* +* 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.client +{ + public interface IMessageListener + { + /// <summary> + /// Inform the listener of the message transfer + /// </summary> + /// <param name="xfr">The message transfer object</param> + void messageTransfer(IMessage xfr); + } +} diff --git a/qpid/dotnet/client-010/client/transport/Binary.cs b/qpid/dotnet/client-010/client/transport/Binary.cs index ab829dfb69..1ed6498a8b 100644 --- a/qpid/dotnet/client-010/client/transport/Binary.cs +++ b/qpid/dotnet/client-010/client/transport/Binary.cs @@ -1,129 +1,129 @@ -/*
-*
-* 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.transport
-{
-
-
- /// <summary>
- /// Binary
- /// </summary>
-
- public sealed class Binary
- {
-
- private readonly byte[] bytes;
- private readonly int offset_Renamed_Field;
- private readonly int size_Renamed_Field;
- private int hash = 0;
-
- public Binary(byte[] bytes, int offset, int size)
- {
- if (offset + size > bytes.Length)
- {
- throw new System.IndexOutOfRangeException();
- }
-
- this.bytes = bytes;
- offset_Renamed_Field = offset;
- size_Renamed_Field = size;
- }
-
- public Binary(byte[] bytes):this(bytes, 0, bytes.Length)
- {
- }
-
- public byte[] array()
- {
- return bytes;
- }
-
- public int offset()
- {
- return offset_Renamed_Field;
- }
-
- public int size()
- {
- return size_Renamed_Field;
- }
-
- public Binary slice(int low, int high)
- {
- int sz;
-
- if (high < 0)
- {
- sz = size_Renamed_Field + high;
- }
- else
- {
- sz = high - low;
- }
-
- if (sz < 0)
- {
- sz = 0;
- }
-
- return new Binary(bytes, offset_Renamed_Field + low, sz);
- }
-
- public override int GetHashCode()
- {
- if (hash == 0)
- {
- int hc = 0;
- for (int i = 0; i < size_Renamed_Field; i++)
- {
- hc = 31 * hc + (0xFF & bytes[offset_Renamed_Field + i]);
- }
- hash = hc;
- }
-
- return hash;
- }
-
- public override bool Equals(System.Object o)
- {
- if (!(o is Binary))
- {
- return false;
- }
-
- Binary buf = (Binary) o;
- if (size_Renamed_Field != buf.size_Renamed_Field)
- {
- return false;
- }
-
- for (int i = 0; i < size_Renamed_Field; i++)
- {
- if (bytes[offset_Renamed_Field + i] != buf.bytes[buf.offset_Renamed_Field + i])
- {
- return false;
- }
- }
-
- return true;
- }
- }
+/* +* +* 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.transport +{ + + + /// <summary> + /// Binary + /// </summary> + + public sealed class Binary + { + + private readonly byte[] bytes; + private readonly int offset_Renamed_Field; + private readonly int size_Renamed_Field; + private int hash = 0; + + public Binary(byte[] bytes, int offset, int size) + { + if (offset + size > bytes.Length) + { + throw new System.IndexOutOfRangeException(); + } + + this.bytes = bytes; + offset_Renamed_Field = offset; + size_Renamed_Field = size; + } + + public Binary(byte[] bytes):this(bytes, 0, bytes.Length) + { + } + + public byte[] array() + { + return bytes; + } + + public int offset() + { + return offset_Renamed_Field; + } + + public int size() + { + return size_Renamed_Field; + } + + public Binary slice(int low, int high) + { + int sz; + + if (high < 0) + { + sz = size_Renamed_Field + high; + } + else + { + sz = high - low; + } + + if (sz < 0) + { + sz = 0; + } + + return new Binary(bytes, offset_Renamed_Field + low, sz); + } + + public override int GetHashCode() + { + if (hash == 0) + { + int hc = 0; + for (int i = 0; i < size_Renamed_Field; i++) + { + hc = 31 * hc + (0xFF & bytes[offset_Renamed_Field + i]); + } + hash = hc; + } + + return hash; + } + + public override bool Equals(System.Object o) + { + if (!(o is Binary)) + { + return false; + } + + Binary buf = (Binary) o; + if (size_Renamed_Field != buf.size_Renamed_Field) + { + return false; + } + + for (int i = 0; i < size_Renamed_Field; i++) + { + if (bytes[offset_Renamed_Field + i] != buf.bytes[buf.offset_Renamed_Field + i]) + { + return false; + } + } + + return true; + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Binding.cs b/qpid/dotnet/client-010/client/transport/Binding.cs index e07e85990d..a0899c1066 100644 --- a/qpid/dotnet/client-010/client/transport/Binding.cs +++ b/qpid/dotnet/client-010/client/transport/Binding.cs @@ -1,34 +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.
-*
-*/
-using System;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Binding
- /// </summary>
- internal interface Binding<E, T>
- {
- E endpoint(Sender<T> sender);
-
- Receiver<R> receiver<R>(E endpoint) where R : EventArgs;
- }
+/* +* +* 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; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// Binding + /// </summary> + internal interface Binding<E, T> + { + E endpoint(Sender<T> sender); + + Receiver<R> receiver<R>(E endpoint) where R : EventArgs; + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Channel.cs b/qpid/dotnet/client-010/client/transport/Channel.cs index 6915c123e7..1ea8ecf5ec 100644 --- a/qpid/dotnet/client-010/client/transport/Channel.cs +++ b/qpid/dotnet/client-010/client/transport/Channel.cs @@ -1,174 +1,174 @@ -/*
-*
-* 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.transport.network;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Channel
- /// </summary>
- public class Channel : Invoker, ProtocolDelegate<Object>
- {
- private static readonly Logger log = Logger.get(typeof (Channel));
-
- private readonly Connection _connection;
- private readonly int _channel;
- private readonly MethodDelegate<Channel> _methoddelegate;
- private readonly SessionDelegate _sessionDelegate;
- // session may be null
- private Session _session;
-
- public Channel(Connection connection, int channel, SessionDelegate sessionDelegate)
- {
- _connection = connection;
- _channel = channel;
- _methoddelegate = new ChannelDelegate();
- _sessionDelegate = sessionDelegate;
- }
-
- public Connection Connection
- {
- get { return _connection; }
- }
-
- // Invoked when a network event is received
- public void On_ReceivedEvent(object sender, ReceivedPayload<ProtocolEvent> payload)
- {
- if (payload.Payload.Channel == _channel)
- {
- payload.Payload.ProcessProtocolEvent(null, this);
- }
- }
-
- #region ProtocolDelegate<T>
-
- public void Init(Object v, ProtocolHeader hdr)
- {
- _connection.ConnectionDelegate.init(this, hdr);
- }
-
- public void Control(Object v, Method method)
- {
- switch (method.EncodedTrack)
- {
- case Frame.L1:
- method.dispatch(this, _connection.ConnectionDelegate);
- break;
- case Frame.L2:
- method.dispatch(this, _methoddelegate);
- break;
- case Frame.L3:
- method.ProcessProtocolEvent(_session, _sessionDelegate);
- break;
- default:
- throw new Exception("unknown track: " + method.EncodedTrack);
- }
- }
-
- public void Command(Object v, Method method)
- {
- method.ProcessProtocolEvent(_session, _sessionDelegate);
- }
-
- public void Error(Object v, ProtocolError error)
- {
- throw new Exception(error.Message);
- }
-
- #endregion
-
- public void exception(Exception t)
- {
- _session.exception(t);
- }
-
- public void closedFromConnection()
- {
- log.debug("channel closed: ", this);
- if (_session != null)
- {
- _session.closed();
- }
- }
-
- public void closed()
- {
- log.debug("channel closed: ", this);
- if (_session != null)
- {
- _session.closed();
- }
- _connection.removeChannel(_channel);
- }
-
- public int EncodedChannel
- {
- get { return _channel; }
- }
-
- public Session Session
- {
- get { return _session; }
- set { _session = value; }
- }
-
- public void closeCode(ConnectionClose close)
- {
- if (_session != null)
- {
- _session.closeCode(close);
- }
- }
-
- private void emit(ProtocolEvent pevent)
- {
- pevent.Channel = _channel;
- _connection.send(pevent);
- }
-
- public void method(Method m)
- {
- emit(m);
-
- if (!m.Batch)
- {
- _connection.flush();
- }
- }
-
- protected override void invoke(Method m)
- {
- method(m);
- }
-
- public override Future invoke(Method m, Future future)
- {
- throw new Exception("UnsupportedOperation");
- }
-
- public String toString()
- {
- return String.Format("{0}:{1}", _connection, _channel);
- }
- }
+/* +* +* 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.transport.network; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// Channel + /// </summary> + public class Channel : Invoker, ProtocolDelegate<Object> + { + private static readonly Logger log = Logger.get(typeof (Channel)); + + private readonly Connection _connection; + private readonly int _channel; + private readonly MethodDelegate<Channel> _methoddelegate; + private readonly SessionDelegate _sessionDelegate; + // session may be null + private Session _session; + + public Channel(Connection connection, int channel, SessionDelegate sessionDelegate) + { + _connection = connection; + _channel = channel; + _methoddelegate = new ChannelDelegate(); + _sessionDelegate = sessionDelegate; + } + + public Connection Connection + { + get { return _connection; } + } + + // Invoked when a network event is received + public void On_ReceivedEvent(object sender, ReceivedPayload<ProtocolEvent> payload) + { + if (payload.Payload.Channel == _channel) + { + payload.Payload.ProcessProtocolEvent(null, this); + } + } + + #region ProtocolDelegate<T> + + public void Init(Object v, ProtocolHeader hdr) + { + _connection.ConnectionDelegate.init(this, hdr); + } + + public void Control(Object v, Method method) + { + switch (method.EncodedTrack) + { + case Frame.L1: + method.dispatch(this, _connection.ConnectionDelegate); + break; + case Frame.L2: + method.dispatch(this, _methoddelegate); + break; + case Frame.L3: + method.ProcessProtocolEvent(_session, _sessionDelegate); + break; + default: + throw new Exception("unknown track: " + method.EncodedTrack); + } + } + + public void Command(Object v, Method method) + { + method.ProcessProtocolEvent(_session, _sessionDelegate); + } + + public void Error(Object v, ProtocolError error) + { + throw new Exception(error.Message); + } + + #endregion + + public void exception(Exception t) + { + _session.exception(t); + } + + public void closedFromConnection() + { + log.debug("channel closed: ", this); + if (_session != null) + { + _session.closed(); + } + } + + public void closed() + { + log.debug("channel closed: ", this); + if (_session != null) + { + _session.closed(); + } + _connection.removeChannel(_channel); + } + + public int EncodedChannel + { + get { return _channel; } + } + + public Session Session + { + get { return _session; } + set { _session = value; } + } + + public void closeCode(ConnectionClose close) + { + if (_session != null) + { + _session.closeCode(close); + } + } + + private void emit(ProtocolEvent pevent) + { + pevent.Channel = _channel; + _connection.send(pevent); + } + + public void method(Method m) + { + emit(m); + + if (!m.Batch) + { + _connection.flush(); + } + } + + protected override void invoke(Method m) + { + method(m); + } + + public override Future invoke(Method m, Future future) + { + throw new Exception("UnsupportedOperation"); + } + + public String toString() + { + return String.Format("{0}:{1}", _connection, _channel); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs b/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs index 34126ddbf4..1515ba22ed 100644 --- a/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs @@ -1,41 +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.
-*
-*/
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// ChannelDelegate
- ///
- /// </summary>
- internal class ChannelDelegate : MethodDelegate<Channel>
- {
- public override void sessionDetached(Channel channel, SessionDetached closed)
- {
- channel.closed();
- }
-
- public override void sessionDetach(Channel channel, SessionDetach dtc)
- {
- channel.Session.closed();
- channel.sessionDetached(dtc.getName(), SessionDetachCode.NORMAL);
- channel.closed();
- }
- }
+/* +* +* 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.transport +{ + /// <summary> + /// ChannelDelegate + /// + /// </summary> + internal class ChannelDelegate : MethodDelegate<Channel> + { + public override void sessionDetached(Channel channel, SessionDetached closed) + { + channel.closed(); + } + + public override void sessionDetach(Channel channel, SessionDetach dtc) + { + channel.Session.closed(); + channel.sessionDetached(dtc.getName(), SessionDetachCode.NORMAL); + channel.closed(); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/ClientDelegate.cs b/qpid/dotnet/client-010/client/transport/ClientDelegate.cs index fa0062ef19..865cc6df20 100644 --- a/qpid/dotnet/client-010/client/transport/ClientDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ClientDelegate.cs @@ -1,35 +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.
-*
-*/
-using org.apache.qpid.transport;
-
-namespace org.apache.qpid.transport
-{
- abstract class ClientDelegate : ConnectionDelegate
- {
- public override void init(Channel ch, ProtocolHeader hdr)
- {
- if (hdr.Major != 0 && hdr.Minor != 10)
- {
- throw new ProtocolVersionException((sbyte) hdr.Major, (sbyte) hdr.Minor);
- }
- }
- }
-}
+/* +* +* 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 org.apache.qpid.transport; + +namespace org.apache.qpid.transport +{ + abstract class ClientDelegate : ConnectionDelegate + { + public override void init(Channel ch, ProtocolHeader hdr) + { + if (hdr.Major != 0 && hdr.Minor != 10) + { + throw new ProtocolVersionException((sbyte) hdr.Major, (sbyte) hdr.Minor); + } + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/Connection.cs b/qpid/dotnet/client-010/client/transport/Connection.cs index 863f90e093..0c49fee653 100644 --- a/qpid/dotnet/client-010/client/transport/Connection.cs +++ b/qpid/dotnet/client-010/client/transport/Connection.cs @@ -1,172 +1,172 @@ -/*
-*
-* 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 Logger = org.apache.qpid.transport.util.Logger;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Connection
- /// </summary>
- public class Connection
- {
- private static readonly Logger log = Logger.get(typeof (Connection));
-
- private readonly Sender<ProtocolEvent> _sender;
- private readonly ConnectionDelegate _connDdelegate;
- private int _channelMax = 1;
- private int _connectionId;
- private readonly Receiver<ReceivedPayload<ProtocolEvent>> _receiver;
-
- private readonly Dictionary<int, Channel> _channels = new Dictionary<int, Channel>();
-
- public Connection(Receiver<ReceivedPayload<ProtocolEvent>> receiver, Sender<ProtocolEvent> sender, ConnectionDelegate connDdelegate)
- {
- _receiver = receiver;
- _sender = sender;
- _connDdelegate = connDdelegate;
- }
-
- public int ConnectionId
- {
- get { return _connectionId; }
- set { _connectionId = value; }
- }
-
- public ConnectionDelegate ConnectionDelegate
- {
- get { return _connDdelegate; }
- }
-
- public int ChannelMax
- {
- get { return _channelMax; }
- set { _channelMax = value; }
- }
-
- public void send(ProtocolEvent pevent)
- {
- log.debug("SEND: [{0}] {1}", this, pevent);
- _sender.send(pevent);
- }
-
- public void flush()
- {
- log.debug("FLUSH: [{0}]", this);
- _sender.flush();
- }
-
-
- public Channel getChannel()
- {
- lock (_channels)
- {
- for (int i = 0; i < ChannelMax; i++)
- {
- if (!_channels.ContainsKey(i))
- {
- return getChannel(i);
- }
- }
- throw new Exception("no more _channels available");
- }
- }
-
- public Channel getChannel(int number)
- {
- lock (_channels)
- {
- Channel channel = null;
- if (_channels.Count > 0)
- {
- if( _channels.ContainsKey(number))
- channel = _channels[number];
- }
- if (channel == null)
- {
- channel = new Channel(this, number, _connDdelegate.getSessionDelegate());
- _receiver.Received += channel.On_ReceivedEvent;
- _channels.Add(number, channel);
- }
- return channel;
- }
- }
-
- public void removeChannel(int number)
- {
- lock (_channels)
- {
- _receiver.Received -= _channels[number].On_ReceivedEvent;
- _channels.Remove(number);
- }
- }
-
- public void On_ReceivedEvent(object sender, ReceivedPayload<ProtocolEvent> payload)
- {
- log.debug("RECV: [{0}] {1}", this, payload.Payload);
- if (_channels.ContainsKey(payload.Payload.Channel)) return;
- Channel channel = getChannel(payload.Payload.Channel);
- channel.On_ReceivedEvent(sender, payload);
- }
-
- public void On_ReceivedException(Object sender, ExceptionArgs arg)
- {
- _connDdelegate.exception(arg.Exception);
- }
-
- public void On_ReceivedClosed(Object sender, EventArgs arg)
- {
- log.debug("Connection closed: {0}", this);
- lock (_channels)
- {
- foreach (Channel ch in _channels.Values)
- {
- ch.closedFromConnection();
- }
- }
- _channels.Clear();
- _connDdelegate.closed();
- }
-
-
- public void closeCode(ConnectionClose close)
- {
- lock (_channels)
- {
- foreach (Channel ch in _channels.Values)
- {
- ch.closeCode(close);
- }
- }
- }
-
- public void close()
- {
- _sender.close();
- }
-
- public String toString()
- {
- return String.Format("conn:{0}", this);
- }
- }
-}
+/* +* +* 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 Logger = org.apache.qpid.transport.util.Logger; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// Connection + /// </summary> + public class Connection + { + private static readonly Logger log = Logger.get(typeof (Connection)); + + private readonly Sender<ProtocolEvent> _sender; + private readonly ConnectionDelegate _connDdelegate; + private int _channelMax = 1; + private int _connectionId; + private readonly Receiver<ReceivedPayload<ProtocolEvent>> _receiver; + + private readonly Dictionary<int, Channel> _channels = new Dictionary<int, Channel>(); + + public Connection(Receiver<ReceivedPayload<ProtocolEvent>> receiver, Sender<ProtocolEvent> sender, ConnectionDelegate connDdelegate) + { + _receiver = receiver; + _sender = sender; + _connDdelegate = connDdelegate; + } + + public int ConnectionId + { + get { return _connectionId; } + set { _connectionId = value; } + } + + public ConnectionDelegate ConnectionDelegate + { + get { return _connDdelegate; } + } + + public int ChannelMax + { + get { return _channelMax; } + set { _channelMax = value; } + } + + public void send(ProtocolEvent pevent) + { + log.debug("SEND: [{0}] {1}", this, pevent); + _sender.send(pevent); + } + + public void flush() + { + log.debug("FLUSH: [{0}]", this); + _sender.flush(); + } + + + public Channel getChannel() + { + lock (_channels) + { + for (int i = 0; i < ChannelMax; i++) + { + if (!_channels.ContainsKey(i)) + { + return getChannel(i); + } + } + throw new Exception("no more _channels available"); + } + } + + public Channel getChannel(int number) + { + lock (_channels) + { + Channel channel = null; + if (_channels.Count > 0) + { + if( _channels.ContainsKey(number)) + channel = _channels[number]; + } + if (channel == null) + { + channel = new Channel(this, number, _connDdelegate.getSessionDelegate()); + _receiver.Received += channel.On_ReceivedEvent; + _channels.Add(number, channel); + } + return channel; + } + } + + public void removeChannel(int number) + { + lock (_channels) + { + _receiver.Received -= _channels[number].On_ReceivedEvent; + _channels.Remove(number); + } + } + + public void On_ReceivedEvent(object sender, ReceivedPayload<ProtocolEvent> payload) + { + log.debug("RECV: [{0}] {1}", this, payload.Payload); + if (_channels.ContainsKey(payload.Payload.Channel)) return; + Channel channel = getChannel(payload.Payload.Channel); + channel.On_ReceivedEvent(sender, payload); + } + + public void On_ReceivedException(Object sender, ExceptionArgs arg) + { + _connDdelegate.exception(arg.Exception); + } + + public void On_ReceivedClosed(Object sender, EventArgs arg) + { + log.debug("Connection closed: {0}", this); + lock (_channels) + { + foreach (Channel ch in _channels.Values) + { + ch.closedFromConnection(); + } + } + _channels.Clear(); + _connDdelegate.closed(); + } + + + public void closeCode(ConnectionClose close) + { + lock (_channels) + { + foreach (Channel ch in _channels.Values) + { + ch.closeCode(close); + } + } + } + + public void close() + { + _sender.close(); + } + + public String toString() + { + return String.Format("conn:{0}", this); + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs index 1f76840b98..d23195a131 100644 --- a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs @@ -1,108 +1,108 @@ -/*
-*
-* 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.Threading;
-using Logger = org.apache.qpid.transport.util.Logger;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// ConnectionDelegate
- ///
- /// Currently only implemented client specific methods
- /// </summary>
- public abstract class ConnectionDelegate : MethodDelegate<Channel>
- {
- private static readonly Logger log = Logger.get(typeof(ConnectionDelegate));
- private String _virtualHost;
-
- private ManualResetEvent _negotiationComplete;
-
- public abstract SessionDelegate getSessionDelegate();
-
- public abstract void exception(Exception t);
-
- public abstract void closed();
-
- public void setCondition(ManualResetEvent negotiationComplete)
- {
- _negotiationComplete = negotiationComplete;
- }
-
- public virtual void init(Channel ch, ProtocolHeader hdr)
- {
- ch.Connection.send(new ProtocolHeader((byte)1, hdr.Major, hdr.Minor));
- List<Object> plain = new List<Object>();
- plain.Add("PLAIN");
- List<Object> utf8 = new List<Object>();
- utf8.Add("utf8");
- ch.connectionStart(null, plain, utf8);
- }
-
- public String VirtualHost
- {
- get { return _virtualHost; }
- set { _virtualHost = value; }
- }
-
- // ----------------------------------------------
- // Client side
- //-----------------------------------------------
- public override void connectionStart(Channel context, ConnectionStart mstruct)
- {
- Dictionary<String, Object> props = new Dictionary<String, Object>();
- context.connectionStartOk(props, null, null, "utf8");
- }
-
- public override void connectionSecure(Channel context, ConnectionSecure mstruct)
- { // todo SASL
- context.connectionSecureOk(new byte[0]);
- }
-
- public override void connectionTune(Channel context, ConnectionTune mstruct)
- {
- context.Connection.ChannelMax = mstruct.getChannelMax();
- context.connectionTuneOk(mstruct.getChannelMax(), mstruct.getMaxFrameSize(), mstruct.getHeartbeatMax());
- context.connectionOpen(_virtualHost, null, Option.INSIST);
- }
-
- public override void connectionOpenOk(Channel context, ConnectionOpenOk mstruct)
- {
- List<Object> knownHosts = mstruct.getKnownHosts();
- if (_negotiationComplete != null)
- {
- _negotiationComplete.Set();
- }
- }
-
- public override void connectionRedirect(Channel context, ConnectionRedirect mstruct)
- {
- // not going to bother at the moment
- }
-
- public override void connectionClose(Channel ch, ConnectionClose close)
- {
- ch.Connection.closeCode(close);
- ch.connectionCloseOk();
- }
- }
+/* +* +* 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.Threading; +using Logger = org.apache.qpid.transport.util.Logger; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// ConnectionDelegate + /// + /// Currently only implemented client specific methods + /// </summary> + public abstract class ConnectionDelegate : MethodDelegate<Channel> + { + private static readonly Logger log = Logger.get(typeof(ConnectionDelegate)); + private String _virtualHost; + + private ManualResetEvent _negotiationComplete; + + public abstract SessionDelegate getSessionDelegate(); + + public abstract void exception(Exception t); + + public abstract void closed(); + + public void setCondition(ManualResetEvent negotiationComplete) + { + _negotiationComplete = negotiationComplete; + } + + public virtual void init(Channel ch, ProtocolHeader hdr) + { + ch.Connection.send(new ProtocolHeader((byte)1, hdr.Major, hdr.Minor)); + List<Object> plain = new List<Object>(); + plain.Add("PLAIN"); + List<Object> utf8 = new List<Object>(); + utf8.Add("utf8"); + ch.connectionStart(null, plain, utf8); + } + + public String VirtualHost + { + get { return _virtualHost; } + set { _virtualHost = value; } + } + + // ---------------------------------------------- + // Client side + //----------------------------------------------- + public override void connectionStart(Channel context, ConnectionStart mstruct) + { + Dictionary<String, Object> props = new Dictionary<String, Object>(); + context.connectionStartOk(props, null, null, "utf8"); + } + + public override void connectionSecure(Channel context, ConnectionSecure mstruct) + { // todo SASL + context.connectionSecureOk(new byte[0]); + } + + public override void connectionTune(Channel context, ConnectionTune mstruct) + { + context.Connection.ChannelMax = mstruct.getChannelMax(); + context.connectionTuneOk(mstruct.getChannelMax(), mstruct.getMaxFrameSize(), mstruct.getHeartbeatMax()); + context.connectionOpen(_virtualHost, null, Option.INSIST); + } + + public override void connectionOpenOk(Channel context, ConnectionOpenOk mstruct) + { + List<Object> knownHosts = mstruct.getKnownHosts(); + if (_negotiationComplete != null) + { + _negotiationComplete.Set(); + } + } + + public override void connectionRedirect(Channel context, ConnectionRedirect mstruct) + { + // not going to bother at the moment + } + + public override void connectionClose(Channel ch, ConnectionClose close) + { + ch.Connection.closeCode(close); + ch.connectionCloseOk(); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Field.cs b/qpid/dotnet/client-010/client/transport/Field.cs index e8c3cb3497..c6d8cb3022 100644 --- a/qpid/dotnet/client-010/client/transport/Field.cs +++ b/qpid/dotnet/client-010/client/transport/Field.cs @@ -1,75 +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 Decoder = org.apache.qpid.transport.codec.Decoder;
-using Encoder = org.apache.qpid.transport.codec.Encoder;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Field
- /// </summary>
- public abstract class Field<C, T>
- {
- private C container;
- private T type;
- private String name;
- private int index;
-
- protected Field(C container, T type, String name, int index)
- {
- this.container = container;
- this.type = type;
- this.name = name;
- this.index = index;
- }
-
- public C Container
- {
- get { return container; }
- }
-
- public T Type
- {
- get { return type; }
- }
-
- public String Name
- {
- get { return name; }
- }
-
- public int Index
- {
- get { return index; }
- }
-
- public abstract bool has(Object mystruct);
-
- public abstract void has(Object mystruct, bool value);
-
- public abstract T get(Object mystruct);
-
- public abstract void read(Decoder dec, Object mystruct);
-
- public abstract void write(Encoder enc, Object mystruct);
- }
+/* +* +* 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 Decoder = org.apache.qpid.transport.codec.Decoder; +using Encoder = org.apache.qpid.transport.codec.Encoder; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// Field + /// </summary> + public abstract class Field<C, T> + { + private C container; + private T type; + private String name; + private int index; + + protected Field(C container, T type, String name, int index) + { + this.container = container; + this.type = type; + this.name = name; + this.index = index; + } + + public C Container + { + get { return container; } + } + + public T Type + { + get { return type; } + } + + public String Name + { + get { return name; } + } + + public int Index + { + get { return index; } + } + + public abstract bool has(Object mystruct); + + public abstract void has(Object mystruct, bool value); + + public abstract T get(Object mystruct); + + public abstract void read(Decoder dec, Object mystruct); + + public abstract void write(Encoder enc, Object mystruct); + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Future.cs b/qpid/dotnet/client-010/client/transport/Future.cs index ddb07f1dda..c0eadfb7ae 100644 --- a/qpid/dotnet/client-010/client/transport/Future.cs +++ b/qpid/dotnet/client-010/client/transport/Future.cs @@ -1,38 +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.
-*
-*/
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Future
- /// </summary>
- public interface Future
- {
- Struct Result
- {
- get; set;
- }
-
- Session Session
- { set;
- }
- }
+/* +* +* 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.transport +{ + /// <summary> + /// Future + /// </summary> + public interface Future + { + Struct Result + { + get; set; + } + + Session Session + { set; + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Header.cs b/qpid/dotnet/client-010/client/transport/Header.cs index 74b8a7fe2e..d2db299586 100644 --- a/qpid/dotnet/client-010/client/transport/Header.cs +++ b/qpid/dotnet/client-010/client/transport/Header.cs @@ -1,83 +1,83 @@ -/*
-*
-* 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.Text;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Header
- /// </summary>
- public class Header
- {
- private readonly Struct[] _mystructs;
-
- public Header(List<Struct> structs)
- : this(structs.ToArray())
- {
- }
-
- public Header(params Struct[] structs)
- {
- _mystructs = structs;
- }
-
- public Struct[] Structs
- {
- get { return _mystructs; }
- }
-
-
- public Struct get(Struct klass)
- {
- foreach (Struct st in _mystructs)
- {
- if (Equals(st.GetType(), klass.GetType()))
- {
- return st;
- }
- }
- return null;
- }
-
- public String toString()
- {
- StringBuilder str = new StringBuilder();
- str.Append(" Header(");
- bool first = true;
- foreach (Struct s in _mystructs)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- str.Append(", ");
- }
- str.Append(s);
- }
- str.Append(")");
- return str.ToString();
- }
- }
+/* +* +* 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.Text; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// Header + /// </summary> + public class Header + { + private readonly Struct[] _mystructs; + + public Header(List<Struct> structs) + : this(structs.ToArray()) + { + } + + public Header(params Struct[] structs) + { + _mystructs = structs; + } + + public Struct[] Structs + { + get { return _mystructs; } + } + + + public Struct get(Struct klass) + { + foreach (Struct st in _mystructs) + { + if (Equals(st.GetType(), klass.GetType())) + { + return st; + } + } + return null; + } + + public String toString() + { + StringBuilder str = new StringBuilder(); + str.Append(" Header("); + bool first = true; + foreach (Struct s in _mystructs) + { + if (first) + { + first = false; + } + else + { + str.Append(", "); + } + str.Append(s); + } + str.Append(")"); + return str.ToString(); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Method.cs b/qpid/dotnet/client-010/client/transport/Method.cs index c15343ba73..a21a3bcb72 100644 --- a/qpid/dotnet/client-010/client/transport/Method.cs +++ b/qpid/dotnet/client-010/client/transport/Method.cs @@ -1,150 +1,150 @@ -/*
-*
-* 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.IO;
-using System.Text;
-using Frame = org.apache.qpid.transport.network.Frame;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Method
- /// </summary>
- public abstract class Method : Struct, ProtocolEvent
- {
- public new static Method create(int type)
- {
- return (Method) StructFactory.createInstruction(type);
- }
-
- // XXX: command subclass?
- private int id;
- private int channel;
- private bool idSet;
- private bool sync;
- private bool batch;
-
- public int Id
- {
- get { return id; }
- set
- {
- id = value;
- idSet = true;
- }
- }
-
-
- public bool Sync
- {
- get { return sync; }
- set { sync = value; }
- }
-
- public bool Batch
- {
- get { return batch; }
- set { batch = value; }
- }
-
- public abstract bool hasPayload();
-
- public virtual Header Header
- {
- get { return null; }
- set { throw new Exception(); }
- }
-
- public virtual MemoryStream Body
- {
- get { return null; }
- set { throw new Exception(); }
- }
-
-
- public abstract void dispatch<C>(C context, MethodDelegate<C> mdelegate );
-
- #region ProtocolEvent
-
- public int Channel
- {
- get { return channel; }
- set { channel = value; }
- }
-
- public abstract byte EncodedTrack { get; set; }
-
- public void ProcessProtocolEvent<C>(C context, ProtocolDelegate<C> protocoldelegate)
- {
- if (EncodedTrack == Frame.L4)
- {
- protocoldelegate.Command(context, this);
- }
- else
- {
- protocoldelegate.Control(context, this);
- }
- }
-
- #endregion
-
- public new String toString()
- {
- StringBuilder str = new StringBuilder();
-
- str.Append("ch=");
- str.Append(channel);
-
- if (EncodedTrack == Frame.L4 && idSet)
- {
- str.Append(" id=");
- str.Append(id);
- }
-
- if (sync || batch)
- {
- str.Append(" ");
- str.Append("[");
- if (Sync)
- {
- str.Append("S");
- }
- if (Batch)
- {
- str.Append("B");
- }
- str.Append("]");
- }
- str.Append(" ");
- str.Append(base.toString());
- if (Header != null)
- {
- str.Append(Header.toString());
- }
- if (Body != null)
- {
- str.Append("\n body=");
- str.Append(Body.ToString());
- }
- return str.ToString();
- }
- }
+/* +* +* 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.IO; +using System.Text; +using Frame = org.apache.qpid.transport.network.Frame; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// Method + /// </summary> + public abstract class Method : Struct, ProtocolEvent + { + public new static Method create(int type) + { + return (Method) StructFactory.createInstruction(type); + } + + // XXX: command subclass? + private int id; + private int channel; + private bool idSet; + private bool sync; + private bool batch; + + public int Id + { + get { return id; } + set + { + id = value; + idSet = true; + } + } + + + public bool Sync + { + get { return sync; } + set { sync = value; } + } + + public bool Batch + { + get { return batch; } + set { batch = value; } + } + + public abstract bool hasPayload(); + + public virtual Header Header + { + get { return null; } + set { throw new Exception(); } + } + + public virtual MemoryStream Body + { + get { return null; } + set { throw new Exception(); } + } + + + public abstract void dispatch<C>(C context, MethodDelegate<C> mdelegate ); + + #region ProtocolEvent + + public int Channel + { + get { return channel; } + set { channel = value; } + } + + public abstract byte EncodedTrack { get; set; } + + public void ProcessProtocolEvent<C>(C context, ProtocolDelegate<C> protocoldelegate) + { + if (EncodedTrack == Frame.L4) + { + protocoldelegate.Command(context, this); + } + else + { + protocoldelegate.Control(context, this); + } + } + + #endregion + + public new String toString() + { + StringBuilder str = new StringBuilder(); + + str.Append("ch="); + str.Append(channel); + + if (EncodedTrack == Frame.L4 && idSet) + { + str.Append(" id="); + str.Append(id); + } + + if (sync || batch) + { + str.Append(" "); + str.Append("["); + if (Sync) + { + str.Append("S"); + } + if (Batch) + { + str.Append("B"); + } + str.Append("]"); + } + str.Append(" "); + str.Append(base.toString()); + if (Header != null) + { + str.Append(Header.toString()); + } + if (Body != null) + { + str.Append("\n body="); + str.Append(Body.ToString()); + } + return str.ToString(); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/ProtocolDelegate.cs b/qpid/dotnet/client-010/client/transport/ProtocolDelegate.cs index d269b01b79..32dbd116ff 100644 --- a/qpid/dotnet/client-010/client/transport/ProtocolDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ProtocolDelegate.cs @@ -1,37 +1,37 @@ -/*
-*
-* 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.transport
-{
- /// <summary>
- /// ProtocolDelegate
- /// </summary>
- public interface ProtocolDelegate<T>
- {
- void Init(T context, ProtocolHeader header);
-
- void Control(T context, Method control);
-
- void Command(T context, Method command);
-
- void Error(T context, ProtocolError error);
- }
+/* +* +* 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.transport +{ + /// <summary> + /// ProtocolDelegate + /// </summary> + public interface ProtocolDelegate<T> + { + void Init(T context, ProtocolHeader header); + + void Control(T context, Method control); + + void Command(T context, Method command); + + void Error(T context, ProtocolError error); + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/ProtocolError.cs b/qpid/dotnet/client-010/client/transport/ProtocolError.cs index 933a18c78a..6e95563cc2 100644 --- a/qpid/dotnet/client-010/client/transport/ProtocolError.cs +++ b/qpid/dotnet/client-010/client/transport/ProtocolError.cs @@ -1,86 +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.
-*
-*/
-using System;
-using NetworkDelegate = org.apache.qpid.transport.network.NetworkDelegate;
-using NetworkEvent = org.apache.qpid.transport.network.NetworkEvent;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// ProtocolError
- /// </summary>
- public sealed class ProtocolError : NetworkEvent, ProtocolEvent
- {
- private int channel;
- private byte track;
- private String format;
- private Object[] args;
-
- public ProtocolError(byte track, String format, params Object[] args)
- {
- this.track = track;
- this.format = format;
- this.args = args;
- }
-
- #region NetworkEvent Methods
-
- public void ProcessNetworkEvent(NetworkDelegate ndelegate)
- {
- ndelegate.Error(this);
- }
-
- #endregion
-
- #region ProtocolEvent Methods
-
- public int Channel
- {
- get { return channel; }
- set { channel = value; }
- }
-
- public byte EncodedTrack
- {
- get { return track; }
- set { throw new NotImplementedException(); }
- }
-
- public void ProcessProtocolEvent<C>(C context, ProtocolDelegate<C> protocoldelegate)
- {
- protocoldelegate.Error(context, this);
- }
-
- #endregion
-
- public String Message
- {
- get { return String.Format(format, args); }
- }
-
-
- public String toString()
- {
- return String.Format("protocol error: {0}", Message);
- }
-
- }
+/* +* +* 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 NetworkDelegate = org.apache.qpid.transport.network.NetworkDelegate; +using NetworkEvent = org.apache.qpid.transport.network.NetworkEvent; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// ProtocolError + /// </summary> + public sealed class ProtocolError : NetworkEvent, ProtocolEvent + { + private int channel; + private byte track; + private String format; + private Object[] args; + + public ProtocolError(byte track, String format, params Object[] args) + { + this.track = track; + this.format = format; + this.args = args; + } + + #region NetworkEvent Methods + + public void ProcessNetworkEvent(NetworkDelegate ndelegate) + { + ndelegate.Error(this); + } + + #endregion + + #region ProtocolEvent Methods + + public int Channel + { + get { return channel; } + set { channel = value; } + } + + public byte EncodedTrack + { + get { return track; } + set { throw new NotImplementedException(); } + } + + public void ProcessProtocolEvent<C>(C context, ProtocolDelegate<C> protocoldelegate) + { + protocoldelegate.Error(context, this); + } + + #endregion + + public String Message + { + get { return String.Format(format, args); } + } + + + public String toString() + { + return String.Format("protocol error: {0}", Message); + } + + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/ProtocolEvent.cs b/qpid/dotnet/client-010/client/transport/ProtocolEvent.cs index 0f6529dfd3..990d5ecc3a 100644 --- a/qpid/dotnet/client-010/client/transport/ProtocolEvent.cs +++ b/qpid/dotnet/client-010/client/transport/ProtocolEvent.cs @@ -1,42 +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.
-*
-*/
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// ProtocolEvent
- /// </summary>
- public interface ProtocolEvent
- {
- int Channel
- {
- get;
- set;
- }
-
- byte EncodedTrack
- {
- set;
- get;
- }
-
- void ProcessProtocolEvent<C>(C context, ProtocolDelegate<C> protocoldelegate);
- }
+/* +* +* 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.transport +{ + /// <summary> + /// ProtocolEvent + /// </summary> + public interface ProtocolEvent + { + int Channel + { + get; + set; + } + + byte EncodedTrack + { + set; + get; + } + + void ProcessProtocolEvent<C>(C context, ProtocolDelegate<C> protocoldelegate); + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/ProtocolHeader.cs b/qpid/dotnet/client-010/client/transport/ProtocolHeader.cs index 39a3f5670c..d20f296ac0 100644 --- a/qpid/dotnet/client-010/client/transport/ProtocolHeader.cs +++ b/qpid/dotnet/client-010/client/transport/ProtocolHeader.cs @@ -1,125 +1,125 @@ -/*
-*
-* 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.IO;
-using System.Text;
-using NetworkDelegate = org.apache.qpid.transport.network.NetworkDelegate;
-using NetworkEvent = org.apache.qpid.transport.network.NetworkEvent;
-using Frame = org.apache.qpid.transport.network.Frame;
-
-namespace org.apache.qpid.transport
-{
- /// <summary> ProtocolHeader
- ///
- /// </summary>
- public sealed class ProtocolHeader : NetworkEvent, ProtocolEvent
- {
- private readonly char[] AMQP = new char[] {'A', 'M', 'Q', 'P'};
- private const byte CLASS = 1;
-
- private readonly byte instance;
- private readonly byte major;
- private readonly byte minor;
- private int channel;
-
- public ProtocolHeader(byte instance, byte major, byte minor)
- {
- this.instance = instance;
- this.major = major;
- this.minor = minor;
- }
-
- public ProtocolHeader(int instance, int major, int minor) : this((byte)instance, (byte)major, (byte)minor)
- {
- }
-
- #region NetworkEvent Methods
-
- public void ProcessNetworkEvent(NetworkDelegate ndelegate)
- {
- ndelegate.Init(this);
- }
-
- #endregion
-
- #region ProtocolEvent Methods
-
- public int Channel
- {
- get
- {
- return channel;
- }
- set
- {
- channel = value;
- }
- }
-
- public byte EncodedTrack
- {
- get
- {
- return Frame.L1;
- }
- set { throw new NotImplementedException(); }
- }
-
- public void ProcessProtocolEvent<C>(C context, ProtocolDelegate<C> protocoldelegate)
- {
- protocoldelegate.Init(context, this);
- }
-
- #endregion
-
- public byte Instance
- {
- get { return instance; }
- }
-
- public byte Major
- {
- get { return major; }
- }
-
- public byte Minor
- {
- get { return minor; }
- }
-
- public MemoryStream ToMemoryStream()
- {
- MemoryStream buf = new MemoryStream(8);
- BinaryWriter writer = new BinaryWriter(buf);
- writer.Write(AMQP);
- writer.Write(CLASS);
- writer.Write(instance);
- writer.Write((sbyte) major);
- writer.Write((sbyte) minor);
- return buf;
- }
-
- public String toString()
- {
- return String.Format("AMQP.{0:d} {1:d}-{2:d}", instance, major, minor);
- }
- }
+/* +* +* 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.IO; +using System.Text; +using NetworkDelegate = org.apache.qpid.transport.network.NetworkDelegate; +using NetworkEvent = org.apache.qpid.transport.network.NetworkEvent; +using Frame = org.apache.qpid.transport.network.Frame; + +namespace org.apache.qpid.transport +{ + /// <summary> ProtocolHeader + /// + /// </summary> + public sealed class ProtocolHeader : NetworkEvent, ProtocolEvent + { + private readonly char[] AMQP = new char[] {'A', 'M', 'Q', 'P'}; + private const byte CLASS = 1; + + private readonly byte instance; + private readonly byte major; + private readonly byte minor; + private int channel; + + public ProtocolHeader(byte instance, byte major, byte minor) + { + this.instance = instance; + this.major = major; + this.minor = minor; + } + + public ProtocolHeader(int instance, int major, int minor) : this((byte)instance, (byte)major, (byte)minor) + { + } + + #region NetworkEvent Methods + + public void ProcessNetworkEvent(NetworkDelegate ndelegate) + { + ndelegate.Init(this); + } + + #endregion + + #region ProtocolEvent Methods + + public int Channel + { + get + { + return channel; + } + set + { + channel = value; + } + } + + public byte EncodedTrack + { + get + { + return Frame.L1; + } + set { throw new NotImplementedException(); } + } + + public void ProcessProtocolEvent<C>(C context, ProtocolDelegate<C> protocoldelegate) + { + protocoldelegate.Init(context, this); + } + + #endregion + + public byte Instance + { + get { return instance; } + } + + public byte Major + { + get { return major; } + } + + public byte Minor + { + get { return minor; } + } + + public MemoryStream ToMemoryStream() + { + MemoryStream buf = new MemoryStream(8); + BinaryWriter writer = new BinaryWriter(buf); + writer.Write(AMQP); + writer.Write(CLASS); + writer.Write(instance); + writer.Write((sbyte) major); + writer.Write((sbyte) minor); + return buf; + } + + public String toString() + { + return String.Format("AMQP.{0:d} {1:d}-{2:d}", instance, major, minor); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Range.cs b/qpid/dotnet/client-010/client/transport/Range.cs index a5bc4f0488..64b5e58c52 100644 --- a/qpid/dotnet/client-010/client/transport/Range.cs +++ b/qpid/dotnet/client-010/client/transport/Range.cs @@ -1,117 +1,117 @@ -/*
-*
-* 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.transport.util;
-
-namespace org.apache.qpid.transport
-{
-
- /// <summary>
- /// Range
- /// </summary>
-
-
- public sealed class Range
- {
- private int _lower;
- private int _upper;
-
- public Range(int lower, int upper)
- {
- _lower = lower;
- _upper = upper;
- }
-
- public int Lower
- {
- get { return _lower; }
- set { _lower = value; }
- }
- public int Upper
- {
- get { return _upper; }
- set { _upper = value; }
- }
-
- public bool includes(int value)
- {
- return Serial.le(_lower, value) && Serial.le(value, _upper);
- }
-
- public bool includes(Range range)
- {
- return includes(range._lower) && includes(range._upper);
- }
-
- public bool intersects(Range range)
- {
- return (includes(range._lower) || includes(range._upper) ||
- range.includes(_lower) || range.includes(_upper));
- }
-
- public bool touches(Range range)
- {
- return (intersects(range) ||
- includes(range._upper + 1) || includes(range._lower - 1) ||
- range.includes(_upper + 1) || range.includes(_lower - 1));
- }
-
- public Range span(Range range)
- {
- return new Range(Serial.min(_lower, range._lower), Serial.max(_upper, range._upper));
- }
-
- public List<Range> subtract(Range range)
- {
- List<Range> result = new List<Range>();
-
- if (includes(range._lower) && Serial.le(_lower, range._lower - 1))
- {
- result.Add(new Range(_lower, range._lower - 1));
- }
-
- if (includes(range._upper) && Serial.le(range._upper + 1, _upper))
- {
- result.Add(new Range(range._upper + 1, _upper));
- }
-
- if (result.Count == 0 && !range.includes(this))
- {
- result.Add(this);
- }
-
- return result;
- }
-
- public Range intersect(Range range)
- {
- int l = Serial.max(_lower, range._lower);
- int r = Serial.min(_upper, range._upper);
- return Serial.gt(l, r) ? null : new Range(l, r);
- }
-
- public String toString()
- {
- return "[" + _lower + ", " + _upper + "]";
- }
- }
+/* +* +* 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.transport.util; + +namespace org.apache.qpid.transport +{ + + /// <summary> + /// Range + /// </summary> + + + public sealed class Range + { + private int _lower; + private int _upper; + + public Range(int lower, int upper) + { + _lower = lower; + _upper = upper; + } + + public int Lower + { + get { return _lower; } + set { _lower = value; } + } + public int Upper + { + get { return _upper; } + set { _upper = value; } + } + + public bool includes(int value) + { + return Serial.le(_lower, value) && Serial.le(value, _upper); + } + + public bool includes(Range range) + { + return includes(range._lower) && includes(range._upper); + } + + public bool intersects(Range range) + { + return (includes(range._lower) || includes(range._upper) || + range.includes(_lower) || range.includes(_upper)); + } + + public bool touches(Range range) + { + return (intersects(range) || + includes(range._upper + 1) || includes(range._lower - 1) || + range.includes(_upper + 1) || range.includes(_lower - 1)); + } + + public Range span(Range range) + { + return new Range(Serial.min(_lower, range._lower), Serial.max(_upper, range._upper)); + } + + public List<Range> subtract(Range range) + { + List<Range> result = new List<Range>(); + + if (includes(range._lower) && Serial.le(_lower, range._lower - 1)) + { + result.Add(new Range(_lower, range._lower - 1)); + } + + if (includes(range._upper) && Serial.le(range._upper + 1, _upper)) + { + result.Add(new Range(range._upper + 1, _upper)); + } + + if (result.Count == 0 && !range.includes(this)) + { + result.Add(this); + } + + return result; + } + + public Range intersect(Range range) + { + int l = Serial.max(_lower, range._lower); + int r = Serial.min(_upper, range._upper); + return Serial.gt(l, r) ? null : new Range(l, r); + } + + public String toString() + { + return "[" + _lower + ", " + _upper + "]"; + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/RangeSet.cs b/qpid/dotnet/client-010/client/transport/RangeSet.cs index 0c502541ec..16792d98de 100644 --- a/qpid/dotnet/client-010/client/transport/RangeSet.cs +++ b/qpid/dotnet/client-010/client/transport/RangeSet.cs @@ -1,150 +1,150 @@ -/*
-*
-* 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.Text;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// RangeSet
- /// </summary>
- public sealed class RangeSet : IEnumerable<Range>
- {
- private readonly List<Range> _ranges = new List<Range>();
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- public IEnumerator<Range> GetEnumerator()
- {
- return _ranges.GetEnumerator();
- }
-
-
- public int size()
- {
- return _ranges.Count;
- }
-
-
- public Range getFirst()
- {
- return _ranges[0];
- }
-
- public bool includes(Range range)
- {
- foreach (Range r in this)
- {
- if (r.includes(range))
- {
- return true;
- }
- }
-
- return false;
- }
-
- public bool includes(int n)
- {
- foreach (Range r in this)
- {
- if (r.includes(n))
- {
- return true;
- }
- }
-
- return false;
- }
-
- public void add(Range range)
- {
- for (int i = 0; i < _ranges.Count; i++)
- {
- Range r = _ranges[i];
- if (range.touches(r))
- {
- _ranges.Remove(r);
- range = range.span(r);
- }
- else if (Serial.lt(range.Upper, r.Lower))
- {
- _ranges.Insert(i - 1 , range);
- return;
- }
- }
- _ranges.Add(range);
- }
-
- public void add(int lower, int upper)
- {
- add(new Range(lower, upper));
- }
-
- public void add(int value)
- {
- add(value, value);
- }
-
- public void clear()
- {
- _ranges.Clear();
- }
-
- public RangeSet copy()
- {
- RangeSet copy = new RangeSet();
- foreach (Range r in _ranges)
- {
- copy._ranges.Add(r);
- }
- return copy;
- }
-
- public String toString()
- {
- StringBuilder str = new StringBuilder();
- str.Append("{");
- bool first = true;
- foreach (Range range in _ranges)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- str.Append(", ");
- }
- str.Append(range);
- }
- str.Append("}");
- return str.ToString();
- }
- }
+/* +* +* 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.Text; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// RangeSet + /// </summary> + public sealed class RangeSet : IEnumerable<Range> + { + private readonly List<Range> _ranges = new List<Range>(); + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public IEnumerator<Range> GetEnumerator() + { + return _ranges.GetEnumerator(); + } + + + public int size() + { + return _ranges.Count; + } + + + public Range getFirst() + { + return _ranges[0]; + } + + public bool includes(Range range) + { + foreach (Range r in this) + { + if (r.includes(range)) + { + return true; + } + } + + return false; + } + + public bool includes(int n) + { + foreach (Range r in this) + { + if (r.includes(n)) + { + return true; + } + } + + return false; + } + + public void add(Range range) + { + for (int i = 0; i < _ranges.Count; i++) + { + Range r = _ranges[i]; + if (range.touches(r)) + { + _ranges.Remove(r); + range = range.span(r); + } + else if (Serial.lt(range.Upper, r.Lower)) + { + _ranges.Insert(i - 1 , range); + return; + } + } + _ranges.Add(range); + } + + public void add(int lower, int upper) + { + add(new Range(lower, upper)); + } + + public void add(int value) + { + add(value, value); + } + + public void clear() + { + _ranges.Clear(); + } + + public RangeSet copy() + { + RangeSet copy = new RangeSet(); + foreach (Range r in _ranges) + { + copy._ranges.Add(r); + } + return copy; + } + + public String toString() + { + StringBuilder str = new StringBuilder(); + str.Append("{"); + bool first = true; + foreach (Range range in _ranges) + { + if (first) + { + first = false; + } + else + { + str.Append(", "); + } + str.Append(range); + } + str.Append("}"); + return str.ToString(); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/ReceivedPayload.cs b/qpid/dotnet/client-010/client/transport/ReceivedPayload.cs index 792ca4f977..e072ba7493 100644 --- a/qpid/dotnet/client-010/client/transport/ReceivedPayload.cs +++ b/qpid/dotnet/client-010/client/transport/ReceivedPayload.cs @@ -1,43 +1,43 @@ -/*
-*
-* 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;
-
-namespace org.apache.qpid.transport
-{
- public class ReceivedPayload<T> : EventArgs
- {
- public ReceivedPayload()
- {
- }
-
- public ReceivedPayload(T payload)
- {
- m_payload = payload;
- }
- private T m_payload;
-
- public T Payload
- {
- get { return m_payload; }
- set { m_payload = value; }
- }
- }
-}
+/* +* +* 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; + +namespace org.apache.qpid.transport +{ + public class ReceivedPayload<T> : EventArgs + { + public ReceivedPayload() + { + } + + public ReceivedPayload(T payload) + { + m_payload = payload; + } + private T m_payload; + + public T Payload + { + get { return m_payload; } + set { m_payload = value; } + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/Receiver.cs b/qpid/dotnet/client-010/client/transport/Receiver.cs index 7b61d7f684..f8d91c3f10 100644 --- a/qpid/dotnet/client-010/client/transport/Receiver.cs +++ b/qpid/dotnet/client-010/client/transport/Receiver.cs @@ -1,38 +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.
-*
-*/
-
-using System;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// a receiver will raise an event when:
- /// - data is received
- /// - an exception is thrown
- /// - it is closed
- /// </summary>
- public interface Receiver <T> where T : EventArgs
- {
- event EventHandler<T> Received;
- event EventHandler<ExceptionArgs> Exception;
- event EventHandler Closed;
- }
+/* +* +* 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; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// a receiver will raise an event when: + /// - data is received + /// - an exception is thrown + /// - it is closed + /// </summary> + public interface Receiver <T> where T : EventArgs + { + event EventHandler<T> Received; + event EventHandler<ExceptionArgs> Exception; + event EventHandler Closed; + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Sender.cs b/qpid/dotnet/client-010/client/transport/Sender.cs index 564dd83789..f8b5bdef06 100644 --- a/qpid/dotnet/client-010/client/transport/Sender.cs +++ b/qpid/dotnet/client-010/client/transport/Sender.cs @@ -1,32 +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.
-*
-*/
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Sender
- /// </summary>
- public interface Sender<T>
- {
- void send(T msg);
- void flush();
- void close();
- }
+/* +* +* 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.transport +{ + /// <summary> + /// Sender + /// </summary> + public interface Sender<T> + { + void send(T msg); + void flush(); + void close(); + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Session.cs b/qpid/dotnet/client-010/client/transport/Session.cs index 5de379ab45..7feb397036 100644 --- a/qpid/dotnet/client-010/client/transport/Session.cs +++ b/qpid/dotnet/client-010/client/transport/Session.cs @@ -1,522 +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.
-*
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.transport.util;
-using Frame = org.apache.qpid.transport.network.Frame;
-using Logger = org.apache.qpid.transport.util.Logger;
-
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Session
- ///
- /// </summary>
- public class Session : Invoker
- {
- private static readonly Logger log = Logger.get(typeof (Session));
- private static readonly bool ENABLE_REPLAY;
-
- static Session()
- {
- const string enableReplay = "enable_command_replay";
- try
- {
- String var = Environment.GetEnvironmentVariable(enableReplay);
- if (var != null)
- {
- ENABLE_REPLAY = bool.Parse(var);
- }
- }
- catch (Exception)
- {
- ENABLE_REPLAY = false;
- }
- }
-
- private readonly byte[] _name;
- private const long _timeout = 600000;
- private bool _autoSync = false;
-
- // channel may be null
- private Channel _channel;
-
- // incoming command count
- private int _commandsIn = 0;
- // completed incoming commands
- private readonly Object _processedLock = new Object();
- private RangeSet _processed = new RangeSet();
- private int _maxProcessed = - 1;
- private int _syncPoint = -1;
-
- // outgoing command count
- private int _commandsOut = 0;
- private readonly Dictionary<int, Method> _commands = new Dictionary<int, Method>();
- private int _maxComplete = - 1;
- private bool _needSync = false;
- private bool _closed;
- private readonly Dictionary<int, Future> _results = new Dictionary<int, Future>();
- private readonly List<ExecutionException> _exceptions = new List<ExecutionException>();
-
-
- public bool Closed
- {
- get
- {
- lock (this)
- {
- return _closed;
- }
- }
- set
- {
- lock (this)
- {
- _closed = value;
- }
- }
- }
-
- public string Name
- {
- get
- {
- ASCIIEncoding enc = new ASCIIEncoding();
- return enc.GetString(_name);
- }
- }
-
- public Session(byte[] name)
- {
- _name = name;
- }
-
- public byte[] getName()
- {
- return _name;
- }
-
- public void setAutoSync(bool value)
- {
- lock (_commands)
- {
- _autoSync = value;
- }
- }
-
- public Dictionary<int, Method> getOutstandingCommands()
- {
- return _commands;
- }
-
- public int getCommandsOut()
- {
- return _commandsOut;
- }
-
- public int CommandsIn
- {
- get { return _commandsIn; }
- set { _commandsIn = value; }
- }
-
- public int nextCommandId()
- {
- return _commandsIn++;
- }
-
- public void identify(Method cmd)
- {
- int id = nextCommandId();
- cmd.Id = id;
-
- if (log.isDebugEnabled())
- {
- log.debug("ID: [{0}] %{1}", _channel, id);
- }
-
- //if ((id % 65536) == 0)
- if ((id & 0xff) == 0)
- {
- flushProcessed(Option.TIMELY_REPLY);
- }
- }
-
- public void processed(Method command)
- {
- processed(command.Id);
- }
-
- public void processed(int command)
- {
- processed(new Range(command, command));
- }
-
- public void processed(int lower, int upper)
- {
- processed(new Range(lower, upper));
- }
-
- public void processed(Range range)
- {
- log.debug("{0} processed({1})", this, range);
-
- bool flush;
- lock (_processedLock)
- {
- _processed.add(range);
- Range first = _processed.getFirst();
- int lower = first.Lower;
- int upper = first.Upper;
- int old = _maxProcessed;
- if (Serial.le(lower, _maxProcessed + 1))
- {
- _maxProcessed = Serial.max(_maxProcessed, upper);
- }
- flush = Serial.lt(old, _syncPoint) && Serial.ge(_maxProcessed, _syncPoint);
- _syncPoint = _maxProcessed;
- }
- if (flush)
- {
- flushProcessed();
- }
- }
-
- public void flushProcessed(params Option[] options)
- {
- RangeSet copy;
- lock (_processedLock)
- {
- copy = _processed.copy();
- }
- sessionCompleted(copy, options);
- }
-
- public void knownComplete(RangeSet kc)
- {
- lock (_processedLock)
- {
- RangeSet newProcessed = new RangeSet();
- foreach (Range pr in _processed)
- {
- foreach (Range kr in kc)
- {
- foreach (Range r in pr.subtract(kr))
- {
- newProcessed.add(r);
- }
- }
- }
- _processed = newProcessed;
- }
- }
-
- public void syncPoint()
- {
- int id = CommandsIn - 1;
- log.debug("{0} synced to {1}", this, id);
- bool flush;
- lock (_processedLock)
- {
- _syncPoint = id;
- flush = Serial.ge(_maxProcessed, _syncPoint);
- }
- if (flush)
- {
- flushProcessed();
- }
- }
-
- public void attach(Channel channel)
- {
- _channel = channel;
- _channel.Session = this;
- }
-
- public Method getCommand(int id)
- {
- lock (_commands)
- {
- return _commands[id];
- }
- }
-
- public bool complete(int lower, int upper)
- {
- //avoid autoboxing
- if (log.isDebugEnabled())
- {
- log.debug("{0} complete({1}, {2})", this, lower, upper);
- }
- lock (_commands)
- {
- int old = _maxComplete;
- for (int id = Serial.max(_maxComplete, lower); Serial.le(id, upper); id++)
- {
- _commands.Remove(id);
- }
- if (Serial.le(lower, _maxComplete + 1))
- {
- _maxComplete = Serial.max(_maxComplete, upper);
- }
- log.debug("{0} commands remaining: {1}", this, _commands);
- Monitor.PulseAll(_commands);
- return Serial.gt(_maxComplete, old);
- }
- }
-
- protected override void invoke(Method m)
- {
- if (Closed)
- {
- List<ExecutionException> exc = getExceptions();
- if (exc.Count > 0)
- {
- throw new SessionException(exc);
- }
- else if (_close != null)
- {
- throw new ConnectionException(_close);
- }
- else
- {
- throw new SessionClosedException();
- }
- }
-
- if (m.EncodedTrack == Frame.L4)
- {
- lock (_commands)
- {
- int next = _commandsOut++;
- m.Id = next;
- if (next == 0)
- {
- sessionCommandPoint(0, 0);
- }
- if (ENABLE_REPLAY)
- {
- _commands.Add(next, m);
- }
- if (_autoSync)
- {
- m.Sync = true;
- }
- _needSync = ! m.Sync;
- _channel.method(m);
- if (_autoSync)
- {
- sync();
- }
-
- // flush every 64K commands to avoid ambiguity on
- // wraparound
- if ((next%65536) == 0)
- {
- sessionFlush(Option.COMPLETED);
- }
- }
- }
- else
- {
- _channel.method(m);
- }
- }
-
- public void sync()
- {
- sync(_timeout);
- }
-
- public void sync(long timeout)
- {
- log.debug("{0} sync()", this);
- lock (_commands)
- {
- int point = _commandsOut - 1;
-
- if (_needSync && Serial.lt(_maxComplete, point))
- {
- executionSync(Option.SYNC);
- }
-
- DateTime start = DateTime.Now;
- long elapsed = 0;
-
- while (! Closed && elapsed < timeout && Serial.lt(_maxComplete, point))
- {
- log.debug("{0} waiting for[{1}]: {2}, {3}", this, point,
- _maxComplete, _commands);
- Monitor.Wait(_commands, (int) (timeout - elapsed));
- elapsed = DateTime.Now.Subtract(start).Milliseconds;
- }
-
- if (Serial.lt(_maxComplete, point))
- {
- if (Closed)
- {
- throw new SessionException(getExceptions());
- }
- else
- {
- throw new Exception
- (String.Format
- ("timed out waiting for sync: complete = {0}, point = {1}", _maxComplete, point));
- }
- }
- }
- }
-
-
- public void result(int command, Struct result)
- {
- Future future;
- lock (_results)
- {
- if (_results.ContainsKey(command))
- {
- future = _results[command];
- _results.Remove(command);
- }
- else
- {
- throw new Exception(String.Format("Cannot ger result {0} for {1}", command, result));
- }
- }
- future.Result = result;
- }
-
- public void addException(ExecutionException exc)
- {
- lock (_exceptions)
- {
- _exceptions.Add(exc);
- }
- }
-
- private ConnectionClose _close = null;
-
- public void closeCode(ConnectionClose close)
- {
- _close = close;
- }
-
- public List<ExecutionException> getExceptions()
- {
- lock (_exceptions)
- {
- return new List<ExecutionException>(_exceptions);
- }
- }
-
- public override Future invoke(Method m, Future future)
- {
- lock (_commands)
- {
- future.Session = this;
- int command = _commandsOut;
- lock (_results)
- {
- _results.Add(command, future);
- }
- invoke(m);
- }
- return future;
- }
-
-
- public void messageTransfer(String destination,
- MessageAcceptMode acceptMode,
- MessageAcquireMode acquireMode,
- Header header,
- byte[] body,
- params Option[] options)
- {
- MemoryStream mbody = new MemoryStream();
- mbody.Write(body,0, body.Length);
- messageTransfer(destination, acceptMode, acquireMode, header,
- mbody, options);
- }
-
- public void messageTransfer(String destination,
- MessageAcceptMode acceptMode,
- MessageAcquireMode acquireMode,
- Header header,
- String body,
- params Option[] options)
- {
- messageTransfer(destination, acceptMode, acquireMode, header,
- new MemoryStream(Convert.ToByte(body)), options);
- }
-
- public void close()
- {
- sessionRequestTimeout(0);
- sessionDetach(_name);
- lock (_commands)
- {
- DateTime start = DateTime.Now;
- long elapsed = 0;
-
- while (! Closed && elapsed < _timeout)
- {
- Monitor.Wait(_commands, (int) (_timeout - elapsed));
- elapsed = DateTime.Now.Subtract(start).Milliseconds;
- }
- }
- }
-
- public void exception(Exception t)
- {
- log.error(t, "Caught exception");
- }
-
- public void closed()
- {
- Closed = true;
- lock (_commands)
- {
- Monitor.PulseAll(_commands);
- }
- lock (_results)
- {
- foreach (Future result in _results.Values)
- {
- lock (result)
- {
- Monitor.PulseAll(result);
- }
- }
- }
- _channel.Session = null;
- _channel = null;
- }
-
- public String toString()
- {
- return String.Format("session:{0}", _name);
- }
- }
+/* +* +* 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.IO; +using System.Text; +using System.Threading; +using org.apache.qpid.transport.util; +using Frame = org.apache.qpid.transport.network.Frame; +using Logger = org.apache.qpid.transport.util.Logger; + + +namespace org.apache.qpid.transport +{ + /// <summary> + /// Session + /// + /// </summary> + public class Session : Invoker + { + private static readonly Logger log = Logger.get(typeof (Session)); + private static readonly bool ENABLE_REPLAY; + + static Session() + { + const string enableReplay = "enable_command_replay"; + try + { + String var = Environment.GetEnvironmentVariable(enableReplay); + if (var != null) + { + ENABLE_REPLAY = bool.Parse(var); + } + } + catch (Exception) + { + ENABLE_REPLAY = false; + } + } + + private readonly byte[] _name; + private const long _timeout = 600000; + private bool _autoSync = false; + + // channel may be null + private Channel _channel; + + // incoming command count + private int _commandsIn = 0; + // completed incoming commands + private readonly Object _processedLock = new Object(); + private RangeSet _processed = new RangeSet(); + private int _maxProcessed = - 1; + private int _syncPoint = -1; + + // outgoing command count + private int _commandsOut = 0; + private readonly Dictionary<int, Method> _commands = new Dictionary<int, Method>(); + private int _maxComplete = - 1; + private bool _needSync = false; + private bool _closed; + private readonly Dictionary<int, Future> _results = new Dictionary<int, Future>(); + private readonly List<ExecutionException> _exceptions = new List<ExecutionException>(); + + + public bool Closed + { + get + { + lock (this) + { + return _closed; + } + } + set + { + lock (this) + { + _closed = value; + } + } + } + + public string Name + { + get + { + ASCIIEncoding enc = new ASCIIEncoding(); + return enc.GetString(_name); + } + } + + public Session(byte[] name) + { + _name = name; + } + + public byte[] getName() + { + return _name; + } + + public void setAutoSync(bool value) + { + lock (_commands) + { + _autoSync = value; + } + } + + public Dictionary<int, Method> getOutstandingCommands() + { + return _commands; + } + + public int getCommandsOut() + { + return _commandsOut; + } + + public int CommandsIn + { + get { return _commandsIn; } + set { _commandsIn = value; } + } + + public int nextCommandId() + { + return _commandsIn++; + } + + public void identify(Method cmd) + { + int id = nextCommandId(); + cmd.Id = id; + + if (log.isDebugEnabled()) + { + log.debug("ID: [{0}] %{1}", _channel, id); + } + + //if ((id % 65536) == 0) + if ((id & 0xff) == 0) + { + flushProcessed(Option.TIMELY_REPLY); + } + } + + public void processed(Method command) + { + processed(command.Id); + } + + public void processed(int command) + { + processed(new Range(command, command)); + } + + public void processed(int lower, int upper) + { + processed(new Range(lower, upper)); + } + + public void processed(Range range) + { + log.debug("{0} processed({1})", this, range); + + bool flush; + lock (_processedLock) + { + _processed.add(range); + Range first = _processed.getFirst(); + int lower = first.Lower; + int upper = first.Upper; + int old = _maxProcessed; + if (Serial.le(lower, _maxProcessed + 1)) + { + _maxProcessed = Serial.max(_maxProcessed, upper); + } + flush = Serial.lt(old, _syncPoint) && Serial.ge(_maxProcessed, _syncPoint); + _syncPoint = _maxProcessed; + } + if (flush) + { + flushProcessed(); + } + } + + public void flushProcessed(params Option[] options) + { + RangeSet copy; + lock (_processedLock) + { + copy = _processed.copy(); + } + sessionCompleted(copy, options); + } + + public void knownComplete(RangeSet kc) + { + lock (_processedLock) + { + RangeSet newProcessed = new RangeSet(); + foreach (Range pr in _processed) + { + foreach (Range kr in kc) + { + foreach (Range r in pr.subtract(kr)) + { + newProcessed.add(r); + } + } + } + _processed = newProcessed; + } + } + + public void syncPoint() + { + int id = CommandsIn - 1; + log.debug("{0} synced to {1}", this, id); + bool flush; + lock (_processedLock) + { + _syncPoint = id; + flush = Serial.ge(_maxProcessed, _syncPoint); + } + if (flush) + { + flushProcessed(); + } + } + + public void attach(Channel channel) + { + _channel = channel; + _channel.Session = this; + } + + public Method getCommand(int id) + { + lock (_commands) + { + return _commands[id]; + } + } + + public bool complete(int lower, int upper) + { + //avoid autoboxing + if (log.isDebugEnabled()) + { + log.debug("{0} complete({1}, {2})", this, lower, upper); + } + lock (_commands) + { + int old = _maxComplete; + for (int id = Serial.max(_maxComplete, lower); Serial.le(id, upper); id++) + { + _commands.Remove(id); + } + if (Serial.le(lower, _maxComplete + 1)) + { + _maxComplete = Serial.max(_maxComplete, upper); + } + log.debug("{0} commands remaining: {1}", this, _commands); + Monitor.PulseAll(_commands); + return Serial.gt(_maxComplete, old); + } + } + + protected override void invoke(Method m) + { + if (Closed) + { + List<ExecutionException> exc = getExceptions(); + if (exc.Count > 0) + { + throw new SessionException(exc); + } + else if (_close != null) + { + throw new ConnectionException(_close); + } + else + { + throw new SessionClosedException(); + } + } + + if (m.EncodedTrack == Frame.L4) + { + lock (_commands) + { + int next = _commandsOut++; + m.Id = next; + if (next == 0) + { + sessionCommandPoint(0, 0); + } + if (ENABLE_REPLAY) + { + _commands.Add(next, m); + } + if (_autoSync) + { + m.Sync = true; + } + _needSync = ! m.Sync; + _channel.method(m); + if (_autoSync) + { + sync(); + } + + // flush every 64K commands to avoid ambiguity on + // wraparound + if ((next%65536) == 0) + { + sessionFlush(Option.COMPLETED); + } + } + } + else + { + _channel.method(m); + } + } + + public void sync() + { + sync(_timeout); + } + + public void sync(long timeout) + { + log.debug("{0} sync()", this); + lock (_commands) + { + int point = _commandsOut - 1; + + if (_needSync && Serial.lt(_maxComplete, point)) + { + executionSync(Option.SYNC); + } + + DateTime start = DateTime.Now; + long elapsed = 0; + + while (! Closed && elapsed < timeout && Serial.lt(_maxComplete, point)) + { + log.debug("{0} waiting for[{1}]: {2}, {3}", this, point, + _maxComplete, _commands); + Monitor.Wait(_commands, (int) (timeout - elapsed)); + elapsed = DateTime.Now.Subtract(start).Milliseconds; + } + + if (Serial.lt(_maxComplete, point)) + { + if (Closed) + { + throw new SessionException(getExceptions()); + } + else + { + throw new Exception + (String.Format + ("timed out waiting for sync: complete = {0}, point = {1}", _maxComplete, point)); + } + } + } + } + + + public void result(int command, Struct result) + { + Future future; + lock (_results) + { + if (_results.ContainsKey(command)) + { + future = _results[command]; + _results.Remove(command); + } + else + { + throw new Exception(String.Format("Cannot ger result {0} for {1}", command, result)); + } + } + future.Result = result; + } + + public void addException(ExecutionException exc) + { + lock (_exceptions) + { + _exceptions.Add(exc); + } + } + + private ConnectionClose _close = null; + + public void closeCode(ConnectionClose close) + { + _close = close; + } + + public List<ExecutionException> getExceptions() + { + lock (_exceptions) + { + return new List<ExecutionException>(_exceptions); + } + } + + public override Future invoke(Method m, Future future) + { + lock (_commands) + { + future.Session = this; + int command = _commandsOut; + lock (_results) + { + _results.Add(command, future); + } + invoke(m); + } + return future; + } + + + public void messageTransfer(String destination, + MessageAcceptMode acceptMode, + MessageAcquireMode acquireMode, + Header header, + byte[] body, + params Option[] options) + { + MemoryStream mbody = new MemoryStream(); + mbody.Write(body,0, body.Length); + messageTransfer(destination, acceptMode, acquireMode, header, + mbody, options); + } + + public void messageTransfer(String destination, + MessageAcceptMode acceptMode, + MessageAcquireMode acquireMode, + Header header, + String body, + params Option[] options) + { + messageTransfer(destination, acceptMode, acquireMode, header, + new MemoryStream(Convert.ToByte(body)), options); + } + + public void close() + { + sessionRequestTimeout(0); + sessionDetach(_name); + lock (_commands) + { + DateTime start = DateTime.Now; + long elapsed = 0; + + while (! Closed && elapsed < _timeout) + { + Monitor.Wait(_commands, (int) (_timeout - elapsed)); + elapsed = DateTime.Now.Subtract(start).Milliseconds; + } + } + } + + public void exception(Exception t) + { + log.error(t, "Caught exception"); + } + + public void closed() + { + Closed = true; + lock (_commands) + { + Monitor.PulseAll(_commands); + } + lock (_results) + { + foreach (Future result in _results.Values) + { + lock (result) + { + Monitor.PulseAll(result); + } + } + } + _channel.Session = null; + _channel = null; + } + + public String toString() + { + return String.Format("session:{0}", _name); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/SessionDelegate.cs b/qpid/dotnet/client-010/client/transport/SessionDelegate.cs index e4b58b20ff..52699b072a 100644 --- a/qpid/dotnet/client-010/client/transport/SessionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/SessionDelegate.cs @@ -1,126 +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.
-*
-*/
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// SessionDelegate
- ///
- /// </summary>
- public abstract class SessionDelegate : MethodDelegate<Session>, ProtocolDelegate<Session>
- {
- public void Init(Session ssn, ProtocolHeader hdr)
- {
- }
-
- public void Control(Session ssn, Method method)
- {
- method.dispatch(ssn, this);
- }
-
- public void Command(Session ssn, Method method)
- {
- ssn.identify(method);
- method.dispatch(ssn, this);
- if (!method.hasPayload())
- {
- ssn.processed(method);
- }
- }
-
- public void Error(Session ssn, ProtocolError error)
- {
- }
-
- public override void executionResult(Session ssn, ExecutionResult result)
- {
- ssn.result(result.getCommandId(), result.getValue());
- }
-
- public override void executionException(Session ssn, ExecutionException exc)
- {
- ssn.addException(exc);
- }
-
- public override void sessionCompleted(Session ssn, SessionCompleted cmp)
- {
- RangeSet ranges = cmp.getCommands();
- RangeSet known = null;
- if (cmp.getTimelyReply())
- {
- known = new RangeSet();
- }
-
- if (ranges != null)
- {
- foreach (Range range in ranges)
- {
- bool advanced = ssn.complete(range.Lower, range.Upper);
- if (advanced && known != null)
- {
- known.add(range);
- }
- }
- }
-
- if (known != null)
- {
- ssn.sessionKnownCompleted(known);
- }
- }
-
- public override void sessionKnownCompleted(Session ssn, SessionKnownCompleted kcmp)
- {
- RangeSet kc = kcmp.getCommands();
- if (kc != null)
- {
- ssn.knownComplete(kc);
- }
- }
-
- public override void sessionFlush(Session ssn, SessionFlush flush)
- {
- if (flush.getCompleted())
- {
- ssn.flushProcessed();
- }
- if (flush.getConfirmed())
- {
- ssn.flushProcessed();
- }
- if (flush.getExpected())
- {
- // to be done
- //throw new Exception("not implemented");
- }
- }
-
- public override void sessionCommandPoint(Session ssn, SessionCommandPoint scp)
- {
- ssn.CommandsIn = scp.getCommandId();
- }
-
- public override void executionSync(Session ssn, ExecutionSync sync)
- {
- ssn.syncPoint();
- }
- }
+/* +* +* 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.transport +{ + /// <summary> + /// SessionDelegate + /// + /// </summary> + public abstract class SessionDelegate : MethodDelegate<Session>, ProtocolDelegate<Session> + { + public void Init(Session ssn, ProtocolHeader hdr) + { + } + + public void Control(Session ssn, Method method) + { + method.dispatch(ssn, this); + } + + public void Command(Session ssn, Method method) + { + ssn.identify(method); + method.dispatch(ssn, this); + if (!method.hasPayload()) + { + ssn.processed(method); + } + } + + public void Error(Session ssn, ProtocolError error) + { + } + + public override void executionResult(Session ssn, ExecutionResult result) + { + ssn.result(result.getCommandId(), result.getValue()); + } + + public override void executionException(Session ssn, ExecutionException exc) + { + ssn.addException(exc); + } + + public override void sessionCompleted(Session ssn, SessionCompleted cmp) + { + RangeSet ranges = cmp.getCommands(); + RangeSet known = null; + if (cmp.getTimelyReply()) + { + known = new RangeSet(); + } + + if (ranges != null) + { + foreach (Range range in ranges) + { + bool advanced = ssn.complete(range.Lower, range.Upper); + if (advanced && known != null) + { + known.add(range); + } + } + } + + if (known != null) + { + ssn.sessionKnownCompleted(known); + } + } + + public override void sessionKnownCompleted(Session ssn, SessionKnownCompleted kcmp) + { + RangeSet kc = kcmp.getCommands(); + if (kc != null) + { + ssn.knownComplete(kc); + } + } + + public override void sessionFlush(Session ssn, SessionFlush flush) + { + if (flush.getCompleted()) + { + ssn.flushProcessed(); + } + if (flush.getConfirmed()) + { + ssn.flushProcessed(); + } + if (flush.getExpected()) + { + // to be done + //throw new Exception("not implemented"); + } + } + + public override void sessionCommandPoint(Session ssn, SessionCommandPoint scp) + { + ssn.CommandsIn = scp.getCommandId(); + } + + public override void executionSync(Session ssn, ExecutionSync sync) + { + ssn.syncPoint(); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Struct.cs b/qpid/dotnet/client-010/client/transport/Struct.cs index fead22268b..6b62c82974 100644 --- a/qpid/dotnet/client-010/client/transport/Struct.cs +++ b/qpid/dotnet/client-010/client/transport/Struct.cs @@ -1,122 +1,122 @@ -/*
-*
-* 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.Text;
-using Decoder = org.apache.qpid.transport.codec.Decoder;
-using Encodable = org.apache.qpid.transport.codec.Encodable;
-using Encoder = org.apache.qpid.transport.codec.Encoder;
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// Struct
- /// </summary>
-
- public abstract class Struct : Encodable
- {
- public static Struct create(int type)
- {
- return StructFactory.create(type);
- }
-
- bool dirty = true;
-
- public bool Dirty
- {
- get { return dirty; }
- set { dirty = value; }
- }
-
- public abstract int getStructType();
-
- public abstract int getSizeWidth();
-
- public abstract int getPackWidth();
-
- public int getEncodedType()
- {
- int type = getStructType();
- if (type < 0)
- {
- throw new Exception();
- }
- return type;
- }
-
- private bool isBit<C, T>(Field<C, T> f)
- {
- return Equals(f.Type, typeof(Boolean));
- }
-
- private bool packed()
- {
- return getPackWidth() > 0;
- }
-
- private bool encoded<C, T>(Field<C, T> f)
- {
- return !packed() || !isBit(f) && f.has(this);
- }
-
- private int getFlagWidth()
- {
- return (Fields.Count + 7) / 8;
- }
-
- private int getFlagCount()
- {
- return 8 * getPackWidth();
- }
-
- public abstract void read(Decoder dec);
-
- public abstract void write(Encoder enc);
-
- public abstract Dictionary<String, Object> Fields
- {
- get;
- }
-
- public String toString()
- {
- StringBuilder str = new StringBuilder();
- str.Append(GetType());
- str.Append("(");
- bool first = true;
- foreach (KeyValuePair<String, Object> me in Fields)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- str.Append(", ");
- }
- str.Append(me.Key);
- str.Append("=");
- str.Append(me.Value);
- }
- str.Append(")");
- return str.ToString();
- }
- }
+/* +* +* 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.Text; +using Decoder = org.apache.qpid.transport.codec.Decoder; +using Encodable = org.apache.qpid.transport.codec.Encodable; +using Encoder = org.apache.qpid.transport.codec.Encoder; +namespace org.apache.qpid.transport +{ + /// <summary> + /// Struct + /// </summary> + + public abstract class Struct : Encodable + { + public static Struct create(int type) + { + return StructFactory.create(type); + } + + bool dirty = true; + + public bool Dirty + { + get { return dirty; } + set { dirty = value; } + } + + public abstract int getStructType(); + + public abstract int getSizeWidth(); + + public abstract int getPackWidth(); + + public int getEncodedType() + { + int type = getStructType(); + if (type < 0) + { + throw new Exception(); + } + return type; + } + + private bool isBit<C, T>(Field<C, T> f) + { + return Equals(f.Type, typeof(Boolean)); + } + + private bool packed() + { + return getPackWidth() > 0; + } + + private bool encoded<C, T>(Field<C, T> f) + { + return !packed() || !isBit(f) && f.has(this); + } + + private int getFlagWidth() + { + return (Fields.Count + 7) / 8; + } + + private int getFlagCount() + { + return 8 * getPackWidth(); + } + + public abstract void read(Decoder dec); + + public abstract void write(Encoder enc); + + public abstract Dictionary<String, Object> Fields + { + get; + } + + public String toString() + { + StringBuilder str = new StringBuilder(); + str.Append(GetType()); + str.Append("("); + bool first = true; + foreach (KeyValuePair<String, Object> me in Fields) + { + if (first) + { + first = false; + } + else + { + str.Append(", "); + } + str.Append(me.Key); + str.Append("="); + str.Append(me.Value); + } + str.Append(")"); + return str.ToString(); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs index 411813fe99..0111c7a87e 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs @@ -1,399 +1,399 @@ -/*
-*
-* 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.Diagnostics;
-using System.Text;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.codec
-{
- /// <summary>
- /// AbstractDecoder
- /// </summary>
- public abstract class AbstractDecoder : Decoder
- {
- private readonly Dictionary<Binary, String> str8cache = new Dictionary<Binary, String>();
-
- protected abstract byte doGet();
-
- protected abstract void doGet(byte[] bytes);
- public abstract bool hasRemaining();
-
- protected byte get()
- {
- return doGet();
- }
-
- protected void get(byte[] bytes)
- {
- doGet(bytes);
- }
-
- protected Binary get(int size)
- {
- byte[] bytes = new byte[size];
- get(bytes);
- return new Binary(bytes);
- }
-
- protected short uget()
- {
- return (short) (0xFF & get());
- }
-
- public virtual short readUint8()
- {
- return uget();
- }
-
- public abstract int readUint16();
-
-
- public abstract long readUint32();
-
-
- public int readSequenceNo()
- {
- return (int) readUint32();
- }
-
- public virtual long readUint64()
- {
- long l = 0;
- for (int i = 0; i < 8; i++)
- {
- l |= ((long) (0xFF & get())) << (56 - i*8);
- }
- return l;
- }
-
- public abstract short readInt8();
- public abstract int readInt16();
- public abstract long readInt32() ;
- public abstract long readInt64();
- public abstract float readFloat() ;
- public abstract double readDouble() ;
-
- public long readDatetime()
- {
- return readUint64();
- }
-
- private static String decode(byte[] bytes, int offset, int length, Encoding encoding)
- {
- return encoding.GetString(bytes, offset, length);
- }
-
- private static String decode(byte[] bytes, Encoding encoding)
- {
- return decode(bytes, 0, bytes.Length, encoding);
- }
-
- public String readStr8()
- {
- short size = readUint8();
- Binary bin = get(size);
- String str;
- if (! str8cache.TryGetValue(bin, out str))
- {
- str = decode(bin.array(), bin.offset(), bin.size(), Encoding.UTF8);
- str8cache.Add(bin, str);
- }
- return str;
- }
-
- public String readStr16()
- {
- int size = readUint16();
- byte[] bytes = new byte[size];
- get(bytes);
- return decode(bytes, Encoding.UTF8);
- }
-
- public byte[] readVbin8()
- {
- int size = readUint8();
- byte[] bytes = new byte[size];
- get(bytes);
- return bytes;
- }
-
- public byte[] readVbin16()
- {
- int size = readUint16();
- byte[] bytes = new byte[size];
- get(bytes);
- return bytes;
- }
-
- public byte[] readVbin32()
- {
- int size = (int) readUint32();
- byte[] bytes = new byte[size];
- get(bytes);
- return bytes;
- }
-
- public RangeSet readSequenceSet()
- {
- int count = readUint16()/8;
- if (count == 0)
- {
- return null;
- }
- RangeSet ranges = new RangeSet();
- for (int i = 0; i < count; i++)
- {
- ranges.add(readSequenceNo(), readSequenceNo());
- }
- return ranges;
- }
-
- public RangeSet readByteRanges()
- {
- throw new Exception("not implemented");
- }
-
- public UUID readUuid()
- {
- long msb = readUint64();
- long lsb = readUint64();
- return new UUID(msb, lsb);
- }
-
- public String readContent()
- {
- throw new Exception("Deprecated");
- }
-
- public Struct readStruct(int type)
- {
- Struct st = Struct.create(type);
- int width = st.getSizeWidth();
- if (width > 0)
- {
- long size = readSize(width);
- if (size == 0)
- {
- return null;
- }
- }
- if (type > 0)
- {
- int code = readUint16();
- Debug.Assert(code == type);
- }
- st.read(this);
- return st;
- }
-
- public Struct readStruct32()
- {
- long size = readUint32();
- if (size == 0)
- {
- return null;
- }
- int type = readUint16();
- Struct result = Struct.create(type);
- result.read(this);
- return result;
- }
-
- public Dictionary<String, Object> readMap()
- {
- long size = readUint32();
-
- if (size == 0)
- {
- return null;
- }
-
- long count = readUint32();
-
- Dictionary<String, Object> result = new Dictionary<String, Object>();
- for (int i = 0; i < count; i++)
- {
- String key = readStr8();
- byte code = get();
- QpidType t = getType(code);
- Object value = read(t);
- result.Add(key, value);
- }
-
- return result;
- }
-
- public List<Object> readList()
- {
- long size = readUint32();
-
- if (size == 0)
- {
- return null;
- }
-
- long count = readUint32();
-
- List<Object> result = new List<Object>();
- for (int i = 0; i < count; i++)
- {
- byte code = get();
- QpidType t = getType(code);
- Object value = read(t);
- result.Add(value);
- }
- return result;
- }
-
- public List<Object> readArray()
- {
- long size = readUint32();
-
- if (size == 0)
- {
- return null;
- }
-
- byte code = get();
- QpidType t = getType(code);
- long count = readUint32();
-
- List<Object> result = new List<Object>();
- for (int i = 0; i < count; i++)
- {
- Object value = read(t);
- result.Add(value);
- }
- return result;
- }
-
- private QpidType getType(byte code)
- {
- return QpidType.get(code);
- }
-
- private long readSize(QpidType t)
- {
- return t.Fixed ? t.Width : readSize(t.Width);
- }
-
- private long readSize(int width)
- {
- switch (width)
- {
- case 1:
- return readUint8();
- case 2:
- return readUint16();
- case 4:
- return readUint32();
- default:
- throw new Exception("illegal width: " + width);
- }
- }
-
- private byte[] readBytes(QpidType t)
- {
- long size = readSize(t);
- byte[] result = new byte[(int) size];
- get(result);
- return result;
- }
-
- private Object read(QpidType t)
- {
- switch (t.Code)
- {
- case Code.BIN8:
- case Code.UINT8:
- return readUint8();
- case Code.INT8:
- return get();
- case Code.CHAR:
- return (char) get();
- case Code.BOOLEAN:
- return get() > 0;
-
- case Code.BIN16:
- case Code.UINT16:
- return readUint16();
- case Code.INT16:
- return (short) readUint16();
-
- case Code.BIN32:
- case Code.UINT32:
- return readUint32();
-
- case Code.CHAR_UTF32:
- case Code.INT32:
- return (int) readUint32();
-
- case Code.FLOAT:
- return (float)BitConverter.Int64BitsToDouble(readUint32() << 32);
-
- case Code.BIN64:
- case Code.UINT64:
- case Code.INT64:
- case Code.DATETIME:
- return readUint64();
-
- case Code.DOUBLE:
- return BitConverter.Int64BitsToDouble(readUint64());
- case Code.UUID:
- return readUuid();
- case Code.STR8:
- return readStr8();
- case Code.STR16:
- return readStr16();
- case Code.STR8_LATIN:
- case Code.STR8_UTF16:
- case Code.STR16_LATIN:
- case Code.STR16_UTF16:
- // XXX: need to do character conversion
- return Encoding.UTF8.GetString(readBytes(t));
-
- case Code.MAP:
- return readMap();
- case Code.LIST:
- return readList();
- case Code.ARRAY:
- return readArray();
- case Code.STRUCT32:
- return readStruct32();
-
- case Code.BIN40:
- case Code.DEC32:
- case Code.BIN72:
- case Code.DEC64:
- // XXX: what types are we supposed to use here?
- return readBytes(t);
-
- case Code.VOID:
- return null;
-
- default:
- return readBytes(t);
- }
- }
- }
-}
+/* +* +* 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.Diagnostics; +using System.Text; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.codec +{ + /// <summary> + /// AbstractDecoder + /// </summary> + public abstract class AbstractDecoder : Decoder + { + private readonly Dictionary<Binary, String> str8cache = new Dictionary<Binary, String>(); + + protected abstract byte doGet(); + + protected abstract void doGet(byte[] bytes); + public abstract bool hasRemaining(); + + protected byte get() + { + return doGet(); + } + + protected void get(byte[] bytes) + { + doGet(bytes); + } + + protected Binary get(int size) + { + byte[] bytes = new byte[size]; + get(bytes); + return new Binary(bytes); + } + + protected short uget() + { + return (short) (0xFF & get()); + } + + public virtual short readUint8() + { + return uget(); + } + + public abstract int readUint16(); + + + public abstract long readUint32(); + + + public int readSequenceNo() + { + return (int) readUint32(); + } + + public virtual long readUint64() + { + long l = 0; + for (int i = 0; i < 8; i++) + { + l |= ((long) (0xFF & get())) << (56 - i*8); + } + return l; + } + + public abstract short readInt8(); + public abstract int readInt16(); + public abstract long readInt32() ; + public abstract long readInt64(); + public abstract float readFloat() ; + public abstract double readDouble() ; + + public long readDatetime() + { + return readUint64(); + } + + private static String decode(byte[] bytes, int offset, int length, Encoding encoding) + { + return encoding.GetString(bytes, offset, length); + } + + private static String decode(byte[] bytes, Encoding encoding) + { + return decode(bytes, 0, bytes.Length, encoding); + } + + public String readStr8() + { + short size = readUint8(); + Binary bin = get(size); + String str; + if (! str8cache.TryGetValue(bin, out str)) + { + str = decode(bin.array(), bin.offset(), bin.size(), Encoding.UTF8); + str8cache.Add(bin, str); + } + return str; + } + + public String readStr16() + { + int size = readUint16(); + byte[] bytes = new byte[size]; + get(bytes); + return decode(bytes, Encoding.UTF8); + } + + public byte[] readVbin8() + { + int size = readUint8(); + byte[] bytes = new byte[size]; + get(bytes); + return bytes; + } + + public byte[] readVbin16() + { + int size = readUint16(); + byte[] bytes = new byte[size]; + get(bytes); + return bytes; + } + + public byte[] readVbin32() + { + int size = (int) readUint32(); + byte[] bytes = new byte[size]; + get(bytes); + return bytes; + } + + public RangeSet readSequenceSet() + { + int count = readUint16()/8; + if (count == 0) + { + return null; + } + RangeSet ranges = new RangeSet(); + for (int i = 0; i < count; i++) + { + ranges.add(readSequenceNo(), readSequenceNo()); + } + return ranges; + } + + public RangeSet readByteRanges() + { + throw new Exception("not implemented"); + } + + public UUID readUuid() + { + long msb = readUint64(); + long lsb = readUint64(); + return new UUID(msb, lsb); + } + + public String readContent() + { + throw new Exception("Deprecated"); + } + + public Struct readStruct(int type) + { + Struct st = Struct.create(type); + int width = st.getSizeWidth(); + if (width > 0) + { + long size = readSize(width); + if (size == 0) + { + return null; + } + } + if (type > 0) + { + int code = readUint16(); + Debug.Assert(code == type); + } + st.read(this); + return st; + } + + public Struct readStruct32() + { + long size = readUint32(); + if (size == 0) + { + return null; + } + int type = readUint16(); + Struct result = Struct.create(type); + result.read(this); + return result; + } + + public Dictionary<String, Object> readMap() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + long count = readUint32(); + + Dictionary<String, Object> result = new Dictionary<String, Object>(); + for (int i = 0; i < count; i++) + { + String key = readStr8(); + byte code = get(); + QpidType t = getType(code); + Object value = read(t); + result.Add(key, value); + } + + return result; + } + + public List<Object> readList() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + long count = readUint32(); + + List<Object> result = new List<Object>(); + for (int i = 0; i < count; i++) + { + byte code = get(); + QpidType t = getType(code); + Object value = read(t); + result.Add(value); + } + return result; + } + + public List<Object> readArray() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + byte code = get(); + QpidType t = getType(code); + long count = readUint32(); + + List<Object> result = new List<Object>(); + for (int i = 0; i < count; i++) + { + Object value = read(t); + result.Add(value); + } + return result; + } + + private QpidType getType(byte code) + { + return QpidType.get(code); + } + + private long readSize(QpidType t) + { + return t.Fixed ? t.Width : readSize(t.Width); + } + + private long readSize(int width) + { + switch (width) + { + case 1: + return readUint8(); + case 2: + return readUint16(); + case 4: + return readUint32(); + default: + throw new Exception("illegal width: " + width); + } + } + + private byte[] readBytes(QpidType t) + { + long size = readSize(t); + byte[] result = new byte[(int) size]; + get(result); + return result; + } + + private Object read(QpidType t) + { + switch (t.Code) + { + case Code.BIN8: + case Code.UINT8: + return readUint8(); + case Code.INT8: + return get(); + case Code.CHAR: + return (char) get(); + case Code.BOOLEAN: + return get() > 0; + + case Code.BIN16: + case Code.UINT16: + return readUint16(); + case Code.INT16: + return (short) readUint16(); + + case Code.BIN32: + case Code.UINT32: + return readUint32(); + + case Code.CHAR_UTF32: + case Code.INT32: + return (int) readUint32(); + + case Code.FLOAT: + return (float)BitConverter.Int64BitsToDouble(readUint32() << 32); + + case Code.BIN64: + case Code.UINT64: + case Code.INT64: + case Code.DATETIME: + return readUint64(); + + case Code.DOUBLE: + return BitConverter.Int64BitsToDouble(readUint64()); + case Code.UUID: + return readUuid(); + case Code.STR8: + return readStr8(); + case Code.STR16: + return readStr16(); + case Code.STR8_LATIN: + case Code.STR8_UTF16: + case Code.STR16_LATIN: + case Code.STR16_UTF16: + // XXX: need to do character conversion + return Encoding.UTF8.GetString(readBytes(t)); + + case Code.MAP: + return readMap(); + case Code.LIST: + return readList(); + case Code.ARRAY: + return readArray(); + case Code.STRUCT32: + return readStruct32(); + + case Code.BIN40: + case Code.DEC32: + case Code.BIN72: + case Code.DEC64: + // XXX: what types are we supposed to use here? + return readBytes(t); + + case Code.VOID: + return null; + + default: + return readBytes(t); + } + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs index 2e5ba56c28..dcb6c09925 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs @@ -1,589 +1,589 @@ -/*
-*
-* 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.Diagnostics;
-using System.IO;
-using System.Text;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.codec
-{
- /// <summary>
- /// AbstractEncoder
- /// </summary>
- public abstract class AbstractEncoder : Encoder
- {
- private static readonly Dictionary<Type, Code> ENCODINGS = new Dictionary<Type, Code>();
- private readonly Dictionary<String, byte[]> str8cache = new Dictionary<String, byte[]>();
-
- static AbstractEncoder()
- {
- ENCODINGS.Add(typeof (Boolean), Code.BOOLEAN);
- ENCODINGS.Add(typeof (String), Code.STR16);
- ENCODINGS.Add(typeof (long), Code.INT64);
- ENCODINGS.Add(typeof (int), Code.INT32);
- ENCODINGS.Add(typeof (short), Code.INT16);
- ENCODINGS.Add(typeof (Byte), Code.INT8);
- ENCODINGS.Add(typeof (Dictionary<String, Object>), Code.MAP);
- ENCODINGS.Add(typeof (List<Object>), Code.LIST);
- ENCODINGS.Add(typeof (float), Code.FLOAT);
- ENCODINGS.Add(typeof (Double), Code.DOUBLE);
- ENCODINGS.Add(typeof (char), Code.CHAR);
- ENCODINGS.Add(typeof (byte[]), Code.VBIN32);
- }
-
- protected abstract void doPut(byte b);
-
- protected abstract void doPut(MemoryStream src);
-
-
- protected void put(byte b)
- {
- doPut(b);
- }
-
- protected void put(MemoryStream src)
- {
- doPut(src);
- }
-
- protected virtual void put(byte[] bytes)
- {
- put(new MemoryStream(bytes));
- }
-
- protected abstract int beginSize8();
- protected abstract void endSize8(int pos);
-
- protected abstract int beginSize16();
- protected abstract void endSize16(int pos);
-
- protected abstract int beginSize32();
- protected abstract void endSize32(int pos);
-
- public virtual void writeUint8(short b)
- {
- Debug.Assert(b < 0x100);
- put((byte) b);
- }
-
- public virtual void writeUint16(int s)
- {
- Debug.Assert(s < 0x10000);
- put((byte) Functions.lsb(s >> 8));
- put((byte) Functions.lsb(s));
- }
-
- public virtual void writeUint32(long i)
- {
- Debug.Assert(i < 0x100000000L);
- put((byte) Functions.lsb(i >> 24));
- put((byte) Functions.lsb(i >> 16));
- put((byte) Functions.lsb(i >> 8));
- put((byte) Functions.lsb(i));
- }
-
- public void writeSequenceNo(int i)
- {
- writeUint32(i);
- }
-
- public virtual void writeUint64(long l)
- {
- for (int i = 0; i < 8; i++)
- {
- put((byte) Functions.lsb(l >> (56 - i*8)));
- }
- }
-
- public abstract void writeInt8(short b) ;
- public abstract void writeInt16(int s) ;
- public abstract void writeInt32(long i) ;
- public abstract void writeInt64(long l) ;
- public abstract void writeFloat(float f) ;
- public abstract void writeDouble(double d) ;
-
- public void writeDatetime(long l)
- {
- writeUint64(l);
- }
-
- private static byte[] encode(String s, Encoding encoding)
- {
- return encoding.GetBytes(s);
- }
-
- public void writeStr8(String s)
- {
- if (s == null)
- {
- s = "";
- }
-
- byte[] bytes;
- if (! str8cache.ContainsKey(s))
- {
- bytes = encode(s, Encoding.UTF8);
- str8cache.Add(s, bytes);
- }
- else
- {
- bytes = str8cache[s];
- }
- writeUint8((short) bytes.Length);
- put(bytes);
- }
-
- public void writeStr16(String s)
- {
- if (s == null)
- {
- s = "";
- }
-
- byte[] bytes = encode(s, Encoding.UTF8);
- writeUint16(bytes.Length);
- put(bytes);
- }
-
- public void writeVbin8(byte[] bytes)
- {
- if (bytes == null)
- {
- bytes = new byte[0];
- }
- if (bytes.Length > 255)
- {
- throw new Exception("array too long: " + bytes.Length);
- }
- writeUint8((short) bytes.Length);
- put(bytes);
- }
-
- public void writeVbin16(byte[] bytes)
- {
- if (bytes == null)
- {
- bytes = new byte[0];
- }
- writeUint16(bytes.Length);
- put(bytes);
- }
-
- public void writeVbin32(byte[] bytes)
- {
- if (bytes == null)
- {
- bytes = new byte[0];
- }
- writeUint32(bytes.Length);
- put(bytes);
- }
-
- public void writeSequenceSet(RangeSet ranges)
- {
- if (ranges == null)
- {
- writeUint16(0);
- }
- else
- {
- writeUint16(ranges.size()*8);
- foreach (Range range in ranges)
- {
- writeSequenceNo(range.Lower);
- writeSequenceNo(range.Upper);
- }
- }
- }
-
- public void writeByteRanges(RangeSet ranges)
- {
- throw new Exception("not implemented");
- }
-
- public void writeUuid(UUID uuid)
- {
- long msb = 0;
- long lsb = 0;
- if (uuid != null)
- {
- msb = uuid.MostSignificantBits;
- lsb = uuid.LeastSignificantBits;
- }
- writeUint64(msb);
- writeUint64(lsb);
- }
-
- public void writeStruct(int type, Struct s)
- {
- if (s == null)
- {
- s = Struct.create(type);
- }
-
- int width = s.getSizeWidth();
- int pos = -1;
- if (width > 0)
- {
- pos = beginSize(width);
- }
-
- if (type > 0)
- {
- writeUint16(type);
- }
-
- s.write(this);
-
- if (width > 0)
- {
- endSize(width, pos);
- }
- }
-
- public void writeStruct32(Struct s)
- {
- if (s == null)
- {
- writeUint32(0);
- }
- else
- {
- int pos = beginSize32();
- writeUint16(s.getEncodedType());
- s.write(this);
- endSize32(pos);
- }
- }
-
- private Code encoding(Object value)
- {
- if (value == null)
- {
- return Code.VOID;
- }
-
- Type klass = value.GetType();
- Code type = resolve(klass);
-
- if (type == Code.VOID)
- {
- throw new Exception
- ("unable to resolve type: " + klass + ", " + value);
- }
- else
- {
- return type;
- }
- }
-
- private static Code resolve(Type klass)
- {
- Code type;
- if(ENCODINGS.ContainsKey(klass))
- {
- return ENCODINGS[klass];
- }
-
- Type sup = klass.BaseType;
- if (sup != null)
- {
- type = resolve(sup);
-
- if (type != Code.VOID)
- {
- return type;
- }
- }
- foreach (Type iface in klass.GetInterfaces())
- {
- type = resolve(iface);
- if (type != Code.VOID)
- {
- return type;
- }
- }
- return Code.VOID;
- }
-
- public void writeMap(Dictionary<String, Object> map)
- {
- int pos = beginSize32();
- if (map != null)
- {
- writeUint32(map.Count);
- writeMapEntries(map);
- }
- endSize32(pos);
- }
-
- protected void writeMapEntries(Dictionary<String, Object> map)
- {
- foreach (KeyValuePair<String, Object> entry in map)
- {
- String key = entry.Key;
- Object value = entry.Value;
- Code type = encoding(value);
- writeStr8(key);
- put((byte) type);
- write(type, value);
- }
- }
-
- public void writeList(List<Object> list)
- {
- int pos = beginSize32();
- if (list != null)
- {
- writeUint32(list.Count);
- writeListEntries(list);
- }
- endSize32(pos);
- }
-
- protected void writeListEntries(List<Object> list)
- {
- foreach (Object value in list)
- {
- Code type = encoding(value);
- put((byte) type);
- write(type, value);
- }
- }
-
- public void writeArray(List<Object> array)
- {
- int pos = beginSize32();
- if (array != null)
- {
- writeArrayEntries(array);
- }
- endSize32(pos);
- }
-
- protected void writeArrayEntries(List<Object> array)
- {
- Code type;
-
- if (array.Count == 0)
- {
- return;
- }
- else
- {
- type = encoding(array[0]);
- }
- put((byte) type);
- writeUint32(array.Count);
-
- foreach (Object value in array)
- {
- write(type, value);
- }
- }
-
- private void writeSize(QpidType t, int size)
- {
- if (t.Fixed)
- {
- if (size != t.width)
- {
- throw new Exception("size does not match fixed width " + t.width + ": " + size);
- }
- }
- else
- {
- writeSize(t.width, size);
- }
- }
-
- private void writeSize(int width, int size)
- {
- // XXX: should check lengths
- switch (width)
- {
- case 1:
- writeUint8((short) size);
- break;
- case 2:
- writeUint16(size);
- break;
- case 4:
- writeUint32(size);
- break;
- default:
- throw new Exception("illegal width: " + width);
- }
- }
-
- private int beginSize(int width)
- {
- switch (width)
- {
- case 1:
- return beginSize8();
- case 2:
- return beginSize16();
- case 4:
- return beginSize32();
- default:
- throw new Exception("illegal width: " + width);
- }
- }
-
- private void endSize(int width, int pos)
- {
- switch (width)
- {
- case 1:
- endSize8(pos);
- break;
- case 2:
- endSize16(pos);
- break;
- case 4:
- endSize32(pos);
- break;
- default:
- throw new Exception("illegal width: " + width);
- }
- }
-
- private void writeBytes(QpidType t, byte[] bytes)
- {
- writeSize(t, bytes.Length);
- put(bytes);
- }
-
- private void write(Code t, Object value)
- {
- switch (t)
- {
- case Code.BIN8:
- case Code.UINT8:
- writeUint8((short) value);
- break;
- case Code.INT8:
- put((Byte) value);
- break;
- case Code.CHAR:
- byte[] b = BitConverter.GetBytes((char) value);
- put(b[0]);
- break;
- case Code.BOOLEAN:
- if ((bool) value)
- {
- put(1);
- }
- else
- {
- put(0);
- }
-
- break;
-
- case Code.BIN16:
- case Code.UINT16:
- writeUint16((int) value);
- break;
-
- case Code.INT16:
- writeUint16((short) value);
- break;
-
- case Code.BIN32:
- case Code.UINT32:
- writeUint32((long) value);
- break;
-
- case Code.CHAR_UTF32:
- case Code.INT32:
- writeUint32((int) value);
- break;
-
- case Code.FLOAT:
- writeUint32(BitConverter.DoubleToInt64Bits((float) value) >> 32);
- break;
-
- case Code.BIN64:
- case Code.UINT64:
- case Code.INT64:
- case Code.DATETIME:
- writeUint64((long) value);
- break;
-
- case Code.DOUBLE:
- writeUint64( BitConverter.DoubleToInt64Bits((double) value));
- break;
-
- case Code.UUID:
- writeUuid((UUID) value);
- break;
-
- case Code.STR8:
- writeStr8((string) value);
- break;
-
- case Code.STR16:
- writeStr16((string) value);
- break;
-
- case Code.STR8_LATIN:
- case Code.STR8_UTF16:
- case Code.STR16_LATIN:
- case Code.STR16_UTF16:
- // XXX: need to do character conversion
- writeBytes(QpidType.get((byte) t), encode((string) value, Encoding.Unicode));
- break;
-
- case Code.MAP:
- writeMap((Dictionary<String, Object>) value);
- break;
- case Code.LIST:
- writeList((List<Object>) value);
- break;
- case Code.ARRAY:
- writeList((List<Object>) value);
- break;
- case Code.STRUCT32:
- writeStruct32((Struct) value);
- break;
-
- case Code.BIN40:
- case Code.DEC32:
- case Code.BIN72:
- case Code.DEC64:
- // XXX: what types are we supposed to use here?
- writeBytes(QpidType.get((byte) t), (byte[]) value);
- break;
-
- case Code.VOID:
- break;
-
- default:
- writeBytes(QpidType.get((byte) t), (byte[]) value);
- break;
- }
- }
- }
-}
+/* +* +* 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.Diagnostics; +using System.IO; +using System.Text; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.codec +{ + /// <summary> + /// AbstractEncoder + /// </summary> + public abstract class AbstractEncoder : Encoder + { + private static readonly Dictionary<Type, Code> ENCODINGS = new Dictionary<Type, Code>(); + private readonly Dictionary<String, byte[]> str8cache = new Dictionary<String, byte[]>(); + + static AbstractEncoder() + { + ENCODINGS.Add(typeof (Boolean), Code.BOOLEAN); + ENCODINGS.Add(typeof (String), Code.STR16); + ENCODINGS.Add(typeof (long), Code.INT64); + ENCODINGS.Add(typeof (int), Code.INT32); + ENCODINGS.Add(typeof (short), Code.INT16); + ENCODINGS.Add(typeof (Byte), Code.INT8); + ENCODINGS.Add(typeof (Dictionary<String, Object>), Code.MAP); + ENCODINGS.Add(typeof (List<Object>), Code.LIST); + ENCODINGS.Add(typeof (float), Code.FLOAT); + ENCODINGS.Add(typeof (Double), Code.DOUBLE); + ENCODINGS.Add(typeof (char), Code.CHAR); + ENCODINGS.Add(typeof (byte[]), Code.VBIN32); + } + + protected abstract void doPut(byte b); + + protected abstract void doPut(MemoryStream src); + + + protected void put(byte b) + { + doPut(b); + } + + protected void put(MemoryStream src) + { + doPut(src); + } + + protected virtual void put(byte[] bytes) + { + put(new MemoryStream(bytes)); + } + + protected abstract int beginSize8(); + protected abstract void endSize8(int pos); + + protected abstract int beginSize16(); + protected abstract void endSize16(int pos); + + protected abstract int beginSize32(); + protected abstract void endSize32(int pos); + + public virtual void writeUint8(short b) + { + Debug.Assert(b < 0x100); + put((byte) b); + } + + public virtual void writeUint16(int s) + { + Debug.Assert(s < 0x10000); + put((byte) Functions.lsb(s >> 8)); + put((byte) Functions.lsb(s)); + } + + public virtual void writeUint32(long i) + { + Debug.Assert(i < 0x100000000L); + put((byte) Functions.lsb(i >> 24)); + put((byte) Functions.lsb(i >> 16)); + put((byte) Functions.lsb(i >> 8)); + put((byte) Functions.lsb(i)); + } + + public void writeSequenceNo(int i) + { + writeUint32(i); + } + + public virtual void writeUint64(long l) + { + for (int i = 0; i < 8; i++) + { + put((byte) Functions.lsb(l >> (56 - i*8))); + } + } + + public abstract void writeInt8(short b) ; + public abstract void writeInt16(int s) ; + public abstract void writeInt32(long i) ; + public abstract void writeInt64(long l) ; + public abstract void writeFloat(float f) ; + public abstract void writeDouble(double d) ; + + public void writeDatetime(long l) + { + writeUint64(l); + } + + private static byte[] encode(String s, Encoding encoding) + { + return encoding.GetBytes(s); + } + + public void writeStr8(String s) + { + if (s == null) + { + s = ""; + } + + byte[] bytes; + if (! str8cache.ContainsKey(s)) + { + bytes = encode(s, Encoding.UTF8); + str8cache.Add(s, bytes); + } + else + { + bytes = str8cache[s]; + } + writeUint8((short) bytes.Length); + put(bytes); + } + + public void writeStr16(String s) + { + if (s == null) + { + s = ""; + } + + byte[] bytes = encode(s, Encoding.UTF8); + writeUint16(bytes.Length); + put(bytes); + } + + public void writeVbin8(byte[] bytes) + { + if (bytes == null) + { + bytes = new byte[0]; + } + if (bytes.Length > 255) + { + throw new Exception("array too long: " + bytes.Length); + } + writeUint8((short) bytes.Length); + put(bytes); + } + + public void writeVbin16(byte[] bytes) + { + if (bytes == null) + { + bytes = new byte[0]; + } + writeUint16(bytes.Length); + put(bytes); + } + + public void writeVbin32(byte[] bytes) + { + if (bytes == null) + { + bytes = new byte[0]; + } + writeUint32(bytes.Length); + put(bytes); + } + + public void writeSequenceSet(RangeSet ranges) + { + if (ranges == null) + { + writeUint16(0); + } + else + { + writeUint16(ranges.size()*8); + foreach (Range range in ranges) + { + writeSequenceNo(range.Lower); + writeSequenceNo(range.Upper); + } + } + } + + public void writeByteRanges(RangeSet ranges) + { + throw new Exception("not implemented"); + } + + public void writeUuid(UUID uuid) + { + long msb = 0; + long lsb = 0; + if (uuid != null) + { + msb = uuid.MostSignificantBits; + lsb = uuid.LeastSignificantBits; + } + writeUint64(msb); + writeUint64(lsb); + } + + public void writeStruct(int type, Struct s) + { + if (s == null) + { + s = Struct.create(type); + } + + int width = s.getSizeWidth(); + int pos = -1; + if (width > 0) + { + pos = beginSize(width); + } + + if (type > 0) + { + writeUint16(type); + } + + s.write(this); + + if (width > 0) + { + endSize(width, pos); + } + } + + public void writeStruct32(Struct s) + { + if (s == null) + { + writeUint32(0); + } + else + { + int pos = beginSize32(); + writeUint16(s.getEncodedType()); + s.write(this); + endSize32(pos); + } + } + + private Code encoding(Object value) + { + if (value == null) + { + return Code.VOID; + } + + Type klass = value.GetType(); + Code type = resolve(klass); + + if (type == Code.VOID) + { + throw new Exception + ("unable to resolve type: " + klass + ", " + value); + } + else + { + return type; + } + } + + private static Code resolve(Type klass) + { + Code type; + if(ENCODINGS.ContainsKey(klass)) + { + return ENCODINGS[klass]; + } + + Type sup = klass.BaseType; + if (sup != null) + { + type = resolve(sup); + + if (type != Code.VOID) + { + return type; + } + } + foreach (Type iface in klass.GetInterfaces()) + { + type = resolve(iface); + if (type != Code.VOID) + { + return type; + } + } + return Code.VOID; + } + + public void writeMap(Dictionary<String, Object> map) + { + int pos = beginSize32(); + if (map != null) + { + writeUint32(map.Count); + writeMapEntries(map); + } + endSize32(pos); + } + + protected void writeMapEntries(Dictionary<String, Object> map) + { + foreach (KeyValuePair<String, Object> entry in map) + { + String key = entry.Key; + Object value = entry.Value; + Code type = encoding(value); + writeStr8(key); + put((byte) type); + write(type, value); + } + } + + public void writeList(List<Object> list) + { + int pos = beginSize32(); + if (list != null) + { + writeUint32(list.Count); + writeListEntries(list); + } + endSize32(pos); + } + + protected void writeListEntries(List<Object> list) + { + foreach (Object value in list) + { + Code type = encoding(value); + put((byte) type); + write(type, value); + } + } + + public void writeArray(List<Object> array) + { + int pos = beginSize32(); + if (array != null) + { + writeArrayEntries(array); + } + endSize32(pos); + } + + protected void writeArrayEntries(List<Object> array) + { + Code type; + + if (array.Count == 0) + { + return; + } + else + { + type = encoding(array[0]); + } + put((byte) type); + writeUint32(array.Count); + + foreach (Object value in array) + { + write(type, value); + } + } + + private void writeSize(QpidType t, int size) + { + if (t.Fixed) + { + if (size != t.width) + { + throw new Exception("size does not match fixed width " + t.width + ": " + size); + } + } + else + { + writeSize(t.width, size); + } + } + + private void writeSize(int width, int size) + { + // XXX: should check lengths + switch (width) + { + case 1: + writeUint8((short) size); + break; + case 2: + writeUint16(size); + break; + case 4: + writeUint32(size); + break; + default: + throw new Exception("illegal width: " + width); + } + } + + private int beginSize(int width) + { + switch (width) + { + case 1: + return beginSize8(); + case 2: + return beginSize16(); + case 4: + return beginSize32(); + default: + throw new Exception("illegal width: " + width); + } + } + + private void endSize(int width, int pos) + { + switch (width) + { + case 1: + endSize8(pos); + break; + case 2: + endSize16(pos); + break; + case 4: + endSize32(pos); + break; + default: + throw new Exception("illegal width: " + width); + } + } + + private void writeBytes(QpidType t, byte[] bytes) + { + writeSize(t, bytes.Length); + put(bytes); + } + + private void write(Code t, Object value) + { + switch (t) + { + case Code.BIN8: + case Code.UINT8: + writeUint8((short) value); + break; + case Code.INT8: + put((Byte) value); + break; + case Code.CHAR: + byte[] b = BitConverter.GetBytes((char) value); + put(b[0]); + break; + case Code.BOOLEAN: + if ((bool) value) + { + put(1); + } + else + { + put(0); + } + + break; + + case Code.BIN16: + case Code.UINT16: + writeUint16((int) value); + break; + + case Code.INT16: + writeUint16((short) value); + break; + + case Code.BIN32: + case Code.UINT32: + writeUint32((long) value); + break; + + case Code.CHAR_UTF32: + case Code.INT32: + writeUint32((int) value); + break; + + case Code.FLOAT: + writeUint32(BitConverter.DoubleToInt64Bits((float) value) >> 32); + break; + + case Code.BIN64: + case Code.UINT64: + case Code.INT64: + case Code.DATETIME: + writeUint64((long) value); + break; + + case Code.DOUBLE: + writeUint64( BitConverter.DoubleToInt64Bits((double) value)); + break; + + case Code.UUID: + writeUuid((UUID) value); + break; + + case Code.STR8: + writeStr8((string) value); + break; + + case Code.STR16: + writeStr16((string) value); + break; + + case Code.STR8_LATIN: + case Code.STR8_UTF16: + case Code.STR16_LATIN: + case Code.STR16_UTF16: + // XXX: need to do character conversion + writeBytes(QpidType.get((byte) t), encode((string) value, Encoding.Unicode)); + break; + + case Code.MAP: + writeMap((Dictionary<String, Object>) value); + break; + case Code.LIST: + writeList((List<Object>) value); + break; + case Code.ARRAY: + writeList((List<Object>) value); + break; + case Code.STRUCT32: + writeStruct32((Struct) value); + break; + + case Code.BIN40: + case Code.DEC32: + case Code.BIN72: + case Code.DEC64: + // XXX: what types are we supposed to use here? + writeBytes(QpidType.get((byte) t), (byte[]) value); + break; + + case Code.VOID: + break; + + default: + writeBytes(QpidType.get((byte) t), (byte[]) value); + break; + } + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/codec/Decoder.cs b/qpid/dotnet/client-010/client/transport/codec/Decoder.cs index f0de3f61ef..9afc23fd4e 100644 --- a/qpid/dotnet/client-010/client/transport/codec/Decoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/Decoder.cs @@ -1,72 +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.
-*
-*/
-
-using System;
-using System.Collections.Generic;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.codec
-{
- /// <summary>
- /// Decoder
- /// </summary>
-
- public interface Decoder
- {
-
- bool hasRemaining();
-
- short readUint8();
- int readUint16();
- long readUint32();
- long readUint64();
-
- short readInt8();
- int readInt16();
- long readInt32();
- long readInt64();
-
- double readDouble() ;
- float readFloat() ;
- long readDatetime();
-
- UUID readUuid();
-
- int readSequenceNo();
- RangeSet readSequenceSet(); // XXX
- RangeSet readByteRanges(); // XXX
-
- String readStr8();
- String readStr16();
-
- byte[] readVbin8();
- byte[] readVbin16();
- byte[] readVbin32();
-
- Struct readStruct32();
- Dictionary<String, Object> readMap();
- List<Object> readList();
- List<Object> readArray();
-
- Struct readStruct(int type);
- }
-
-}
+/* +* +* 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.transport.util; + +namespace org.apache.qpid.transport.codec +{ + /// <summary> + /// Decoder + /// </summary> + + public interface Decoder + { + + bool hasRemaining(); + + short readUint8(); + int readUint16(); + long readUint32(); + long readUint64(); + + short readInt8(); + int readInt16(); + long readInt32(); + long readInt64(); + + double readDouble() ; + float readFloat() ; + long readDatetime(); + + UUID readUuid(); + + int readSequenceNo(); + RangeSet readSequenceSet(); // XXX + RangeSet readByteRanges(); // XXX + + String readStr8(); + String readStr16(); + + byte[] readVbin8(); + byte[] readVbin16(); + byte[] readVbin32(); + + Struct readStruct32(); + Dictionary<String, Object> readMap(); + List<Object> readList(); + List<Object> readArray(); + + Struct readStruct(int type); + } + +} diff --git a/qpid/dotnet/client-010/client/transport/codec/Encodable.cs b/qpid/dotnet/client-010/client/transport/codec/Encodable.cs index 12ab7c52f1..71f4f62458 100644 --- a/qpid/dotnet/client-010/client/transport/codec/Encodable.cs +++ b/qpid/dotnet/client-010/client/transport/codec/Encodable.cs @@ -1,37 +1,37 @@ -/*
-*
-* 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.transport.codec
-{
-
-
- /// <summary>
- /// Encodable
- /// </summary>
-
- public interface Encodable
- {
-
- void write(Encoder enc);
-
- void read(Decoder dec);
- }
+/* +* +* 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.transport.codec +{ + + + /// <summary> + /// Encodable + /// </summary> + + public interface Encodable + { + + void write(Encoder enc); + + void read(Decoder dec); + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/codec/Encoder.cs b/qpid/dotnet/client-010/client/transport/codec/Encoder.cs index c071c4cbaf..282e3ff5b5 100644 --- a/qpid/dotnet/client-010/client/transport/codec/Encoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/Encoder.cs @@ -1,70 +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.
-*
-*/
-
-using System;
-using System.Collections.Generic;
-using org.apache.qpid.transport.util;
-using RangeSet = org.apache.qpid.transport.RangeSet;
-using Struct = org.apache.qpid.transport.Struct;
-namespace org.apache.qpid.transport.codec
-{
- /// <summary>
- /// Encoder
- /// </summary>
-
- public interface Encoder
- {
-
- void writeUint8(short b);
- void writeUint16(int s);
- void writeUint32(long i);
- void writeUint64(long l);
-
- void writeInt8(short b);
- void writeInt16(int s);
- void writeInt32(long i);
- void writeInt64(long l);
-
- void writeFloat(float f) ;
- void writeDouble(double d) ;
-
- void writeDatetime(long l);
- void writeUuid(UUID uuid);
-
- void writeSequenceNo(int s);
- void writeSequenceSet(RangeSet ranges); // XXX
- void writeByteRanges(RangeSet ranges); // XXX
-
- void writeStr8(string s);
- void writeStr16(string s);
-
- void writeVbin8(byte[] bytes);
- void writeVbin16(byte[] bytes);
- void writeVbin32(byte[] bytes);
-
- void writeStruct32(Struct s);
- void writeMap(Dictionary<String, Object> map);
- void writeList(List<Object> list);
- void writeArray(List<Object> array);
-
- void writeStruct(int type, Struct s);
- }
-}
+/* +* +* 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.transport.util; +using RangeSet = org.apache.qpid.transport.RangeSet; +using Struct = org.apache.qpid.transport.Struct; +namespace org.apache.qpid.transport.codec +{ + /// <summary> + /// Encoder + /// </summary> + + public interface Encoder + { + + void writeUint8(short b); + void writeUint16(int s); + void writeUint32(long i); + void writeUint64(long l); + + void writeInt8(short b); + void writeInt16(int s); + void writeInt32(long i); + void writeInt64(long l); + + void writeFloat(float f) ; + void writeDouble(double d) ; + + void writeDatetime(long l); + void writeUuid(UUID uuid); + + void writeSequenceNo(int s); + void writeSequenceSet(RangeSet ranges); // XXX + void writeByteRanges(RangeSet ranges); // XXX + + void writeStr8(string s); + void writeStr16(string s); + + void writeVbin8(byte[] bytes); + void writeVbin16(byte[] bytes); + void writeVbin32(byte[] bytes); + + void writeStruct32(Struct s); + void writeMap(Dictionary<String, Object> map); + void writeList(List<Object> list); + void writeArray(List<Object> array); + + void writeStruct(int type, Struct s); + } +} diff --git a/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs index 68d73232c5..75f982bdb1 100644 --- a/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs @@ -1,110 +1,110 @@ -/*
-*
-* 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.IO;
-using System.Text;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.codec
-{
-
-
- /// <summary>
- /// MSDecoder
- ///
- /// </summary>
-
-
- public sealed class MSDecoder:AbstractDecoder
- {
-
- private BinaryReader reader;
-
- public void init(MemoryStream st)
- {
- reader = new BinaryReader(st, Encoding.BigEndianUnicode);
- }
-
- protected override byte doGet()
- {
- return reader.ReadByte();
- }
-
- protected override void doGet(byte[] bytes)
- {
- reader.Read(bytes, 0, bytes.Length);
- }
-
- public override bool hasRemaining()
- {
- return (reader.BaseStream.Position < reader.BaseStream.Length);
- }
-
- public override short readUint8()
- {
- return (short) (0xFF & reader.ReadByte());
- }
-
- public override int readUint16()
- {
- return ByteEncoder.GetBigEndian((UInt16) reader.ReadInt16());
- }
-
- public override long readUint32()
- {
- return ByteEncoder.GetBigEndian((UInt32) reader.ReadInt32());
- }
-
- public override long readUint64()
- {
- return (long) ByteEncoder.GetBigEndian(reader.ReadInt64());
- }
-
- public override short readInt8()
- {
- return (short) (0xFF & reader.ReadByte());
- }
-
- public override int readInt16()
- {
- return ByteEncoder.GetBigEndian((Int16) reader.ReadInt16());
- }
-
- public override long readInt32()
- {
- return ByteEncoder.GetBigEndian((Int32) reader.ReadInt32());
- }
-
- public override long readInt64()
- {
- return (long) ByteEncoder.GetBigEndian(reader.ReadInt64());
- }
-
- public override double readDouble() {
- return (double) ByteEncoder.GetBigEndian(reader.ReadDouble()) ;
- }
-
- public override float readFloat() {
- return (float) reader.ReadSingle() ;
- }
- }
-}
+/* +* +* 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.IO; +using System.Text; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.codec +{ + + + /// <summary> + /// MSDecoder + /// + /// </summary> + + + public sealed class MSDecoder:AbstractDecoder + { + + private BinaryReader reader; + + public void init(MemoryStream st) + { + reader = new BinaryReader(st, Encoding.BigEndianUnicode); + } + + protected override byte doGet() + { + return reader.ReadByte(); + } + + protected override void doGet(byte[] bytes) + { + reader.Read(bytes, 0, bytes.Length); + } + + public override bool hasRemaining() + { + return (reader.BaseStream.Position < reader.BaseStream.Length); + } + + public override short readUint8() + { + return (short) (0xFF & reader.ReadByte()); + } + + public override int readUint16() + { + return ByteEncoder.GetBigEndian((UInt16) reader.ReadInt16()); + } + + public override long readUint32() + { + return ByteEncoder.GetBigEndian((UInt32) reader.ReadInt32()); + } + + public override long readUint64() + { + return (long) ByteEncoder.GetBigEndian(reader.ReadInt64()); + } + + public override short readInt8() + { + return (short) (0xFF & reader.ReadByte()); + } + + public override int readInt16() + { + return ByteEncoder.GetBigEndian((Int16) reader.ReadInt16()); + } + + public override long readInt32() + { + return ByteEncoder.GetBigEndian((Int32) reader.ReadInt32()); + } + + public override long readInt64() + { + return (long) ByteEncoder.GetBigEndian(reader.ReadInt64()); + } + + public override double readDouble() { + return (double) ByteEncoder.GetBigEndian(reader.ReadDouble()) ; + } + + public override float readFloat() { + return (float) reader.ReadSingle() ; + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs index 127b9c73ba..5660ffb53c 100644 --- a/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs @@ -1,172 +1,172 @@ -/*
-*
-* 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.IO;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.codec
-{
- /// <summary>
- /// MSEncoder
- /// </summary>
- public sealed class MSEncoder : AbstractEncoder
- {
- private readonly MemoryStream _out;
- private readonly BinaryWriter _writer;
-
- public MSEncoder(int capacity)
- {
- _out = new MemoryStream(capacity);
- _writer = new BinaryWriter(_out);
- }
-
- public void init()
- {
- _out.Seek(0, SeekOrigin.Begin);
- }
-
- public MemoryStream segment()
- {
- int length = (int) _out.Position;
- MemoryStream result = new MemoryStream(_out.ToArray(), 0, length);
- result.Seek(length, SeekOrigin.Begin);
- _out.Seek(0, SeekOrigin.Begin);
- return result;
- }
-
-
- protected override void doPut(byte b)
- {
- _writer.Write(b);
- }
-
- protected override void doPut(MemoryStream src)
- {
- _writer.Write(src.ToArray());
- }
-
- protected override void put(byte[] bytes)
- {
- _writer.Write(bytes);
- }
-
- public override void writeUint8(short b)
- {
- Debug.Assert(b < 0x100);
- _writer.Write((byte) b);
- }
-
- public override void writeUint16(int s)
- {
- Debug.Assert(s < 0x10000);
- _writer.Write(ByteEncoder.GetBigEndian((UInt16) s));
- }
-
- public override void writeUint32(long i)
- {
- Debug.Assert(i < 0x100000000L);
- _writer.Write(ByteEncoder.GetBigEndian((UInt32) i));
- }
-
- public override void writeUint64(long l)
- {
- _writer.Write(ByteEncoder.GetBigEndian(l));
- }
-
- public override void writeInt8(short b)
- {
- Debug.Assert(b < 0x100);
- _writer.Write((byte) b);
- }
-
- public override void writeInt16(int s)
- {
- Debug.Assert(s < 0x10000);
- _writer.Write(ByteEncoder.GetBigEndian((Int16) s));
- }
-
- public override void writeInt32(long i)
- {
- Debug.Assert(i < 0x100000000L);
- _writer.Write(ByteEncoder.GetBigEndian((Int32) i));
- }
-
- public override void writeInt64(long l)
- {
- _writer.Write(ByteEncoder.GetBigEndian(l));
- }
-
- public override void writeFloat(float f) {
- _writer.Write(f) ;
- }
-
- public override void writeDouble(double d) {
- _writer.Write(ByteEncoder.GetBigEndian(d)) ;
- }
-
- protected override int beginSize8()
- {
- int pos = (int) _out.Position;
- _writer.Write((byte) 0);
- return pos;
- }
-
- protected override void endSize8(int pos)
- {
- int cur = (int) _out.Position;
- _out.Seek(pos, SeekOrigin.Begin);
- _writer.Write((byte) (cur - pos - 1));
- _out.Seek(cur, SeekOrigin.Begin);
- }
-
- protected override int beginSize16()
- {
- int pos = (int) _out.Position;
- _writer.Write((short) 0);
- return pos;
- }
-
- protected override void endSize16(int pos)
- {
- int cur = (int) _out.Position;
- _out.Seek(pos, SeekOrigin.Begin);
- _writer.Write((short) (cur - pos - 2));
- _out.Seek(cur, SeekOrigin.Begin);
- }
-
- protected override int beginSize32()
- {
- int pos = (int) _out.Position;
- _writer.Write(0);
- return pos;
- }
-
- protected override void endSize32(int pos)
- {
- int cur = (int) _out.Position;
- _out.Seek(pos, SeekOrigin.Begin);
- _writer.Write(ByteEncoder.GetBigEndian((Int32) cur - pos - 4));
- _out.Seek(cur, SeekOrigin.Begin);
- }
- }
-}
+/* +* +* 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.IO; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.codec +{ + /// <summary> + /// MSEncoder + /// </summary> + public sealed class MSEncoder : AbstractEncoder + { + private readonly MemoryStream _out; + private readonly BinaryWriter _writer; + + public MSEncoder(int capacity) + { + _out = new MemoryStream(capacity); + _writer = new BinaryWriter(_out); + } + + public void init() + { + _out.Seek(0, SeekOrigin.Begin); + } + + public MemoryStream segment() + { + int length = (int) _out.Position; + MemoryStream result = new MemoryStream(_out.ToArray(), 0, length); + result.Seek(length, SeekOrigin.Begin); + _out.Seek(0, SeekOrigin.Begin); + return result; + } + + + protected override void doPut(byte b) + { + _writer.Write(b); + } + + protected override void doPut(MemoryStream src) + { + _writer.Write(src.ToArray()); + } + + protected override void put(byte[] bytes) + { + _writer.Write(bytes); + } + + public override void writeUint8(short b) + { + Debug.Assert(b < 0x100); + _writer.Write((byte) b); + } + + public override void writeUint16(int s) + { + Debug.Assert(s < 0x10000); + _writer.Write(ByteEncoder.GetBigEndian((UInt16) s)); + } + + public override void writeUint32(long i) + { + Debug.Assert(i < 0x100000000L); + _writer.Write(ByteEncoder.GetBigEndian((UInt32) i)); + } + + public override void writeUint64(long l) + { + _writer.Write(ByteEncoder.GetBigEndian(l)); + } + + public override void writeInt8(short b) + { + Debug.Assert(b < 0x100); + _writer.Write((byte) b); + } + + public override void writeInt16(int s) + { + Debug.Assert(s < 0x10000); + _writer.Write(ByteEncoder.GetBigEndian((Int16) s)); + } + + public override void writeInt32(long i) + { + Debug.Assert(i < 0x100000000L); + _writer.Write(ByteEncoder.GetBigEndian((Int32) i)); + } + + public override void writeInt64(long l) + { + _writer.Write(ByteEncoder.GetBigEndian(l)); + } + + public override void writeFloat(float f) { + _writer.Write(f) ; + } + + public override void writeDouble(double d) { + _writer.Write(ByteEncoder.GetBigEndian(d)) ; + } + + protected override int beginSize8() + { + int pos = (int) _out.Position; + _writer.Write((byte) 0); + return pos; + } + + protected override void endSize8(int pos) + { + int cur = (int) _out.Position; + _out.Seek(pos, SeekOrigin.Begin); + _writer.Write((byte) (cur - pos - 1)); + _out.Seek(cur, SeekOrigin.Begin); + } + + protected override int beginSize16() + { + int pos = (int) _out.Position; + _writer.Write((short) 0); + return pos; + } + + protected override void endSize16(int pos) + { + int cur = (int) _out.Position; + _out.Seek(pos, SeekOrigin.Begin); + _writer.Write((short) (cur - pos - 2)); + _out.Seek(cur, SeekOrigin.Begin); + } + + protected override int beginSize32() + { + int pos = (int) _out.Position; + _writer.Write(0); + return pos; + } + + protected override void endSize32(int pos) + { + int cur = (int) _out.Position; + _out.Seek(pos, SeekOrigin.Begin); + _writer.Write(ByteEncoder.GetBigEndian((Int32) cur - pos - 4)); + _out.Seek(cur, SeekOrigin.Begin); + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs b/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs index d380024c39..59289fe811 100644 --- a/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs +++ b/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs @@ -1,49 +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.
-*
-*/
-using System;
-namespace org.apache.qpid.transport
-{
-
-
- /// <summary>
- /// ConnectionException
- /// </summary>
-
- [Serializable]
- public class ConnectionException : Exception
- {
- virtual public ConnectionClose Close
- {
- get
- {
- return _close;
- }
-
- }
-
- private ConnectionClose _close;
-
- public ConnectionException(ConnectionClose close):base(close.getReplyText())
- {
- _close = close;
- }
- }
+/* +* +* 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; +namespace org.apache.qpid.transport +{ + + + /// <summary> + /// ConnectionException + /// </summary> + + [Serializable] + public class ConnectionException : Exception + { + virtual public ConnectionClose Close + { + get + { + return _close; + } + + } + + private ConnectionClose _close; + + public ConnectionException(ConnectionClose close):base(close.getReplyText()) + { + _close = close; + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/exception/ExceptionArgs.cs b/qpid/dotnet/client-010/client/transport/exception/ExceptionArgs.cs index e9cc1b6cad..1d2578fb88 100644 --- a/qpid/dotnet/client-010/client/transport/exception/ExceptionArgs.cs +++ b/qpid/dotnet/client-010/client/transport/exception/ExceptionArgs.cs @@ -1,41 +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.
-*
-*/
-
-using System;
-
-namespace org.apache.qpid.transport
-{
- public class ExceptionArgs : EventArgs
- {
- public ExceptionArgs(Exception e)
- {
- m_exception = e;
- }
- private Exception m_exception;
-
- public Exception Exception
- {
- get { return m_exception; }
- set { m_exception = value; }
- }
-
- }
-}
+/* +* +* 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; + +namespace org.apache.qpid.transport +{ + public class ExceptionArgs : EventArgs + { + public ExceptionArgs(Exception e) + { + m_exception = e; + } + private Exception m_exception; + + public Exception Exception + { + get { return m_exception; } + set { m_exception = value; } + } + + } +} diff --git a/qpid/dotnet/client-010/client/transport/exception/ProtocolVersionException.cs b/qpid/dotnet/client-010/client/transport/exception/ProtocolVersionException.cs index 2182ab9ba4..4a0bd8e9ce 100644 --- a/qpid/dotnet/client-010/client/transport/exception/ProtocolVersionException.cs +++ b/qpid/dotnet/client-010/client/transport/exception/ProtocolVersionException.cs @@ -1,59 +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.
-*
-*/
-using System;
-namespace org.apache.qpid.transport
-{
-
-
- /// <summary> ProtocolVersionException
- ///
- /// </summary>
-
- [Serializable]
- public sealed class ProtocolVersionException:TransportException
- {
- public sbyte Major
- {
- get
- {
- return this.major;
- }
-
- }
- public sbyte Minor
- {
- get
- {
- return this.minor;
- }
-
- }
-
- private sbyte major;
- private sbyte minor;
-
- public ProtocolVersionException(sbyte major, sbyte minor):base(String.Format("version missmatch: %{0}-{1}", major, minor))
- {
- this.major = major;
- this.minor = minor;
- }
- }
+/* +* +* 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; +namespace org.apache.qpid.transport +{ + + + /// <summary> ProtocolVersionException + /// + /// </summary> + + [Serializable] + public sealed class ProtocolVersionException:TransportException + { + public sbyte Major + { + get + { + return this.major; + } + + } + public sbyte Minor + { + get + { + return this.minor; + } + + } + + private sbyte major; + private sbyte minor; + + public ProtocolVersionException(sbyte major, sbyte minor):base(String.Format("version missmatch: %{0}-{1}", major, minor)) + { + this.major = major; + this.minor = minor; + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/exception/SessionClosedException.cs b/qpid/dotnet/client-010/client/transport/exception/SessionClosedException.cs index 9f3080ac96..89453433ee 100644 --- a/qpid/dotnet/client-010/client/transport/exception/SessionClosedException.cs +++ b/qpid/dotnet/client-010/client/transport/exception/SessionClosedException.cs @@ -1,38 +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.
-*
-*/
-using System.Collections.Generic;
-
-namespace org.apache.qpid.transport
-{
-
-
- /// <summary>
- /// SessionClosedException
- /// </summary>
-
- public class SessionClosedException : SessionException
- {
-
- public SessionClosedException(): base(new List<ExecutionException>())
- {
- }
- }
+/* +* +* 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.Collections.Generic; + +namespace org.apache.qpid.transport +{ + + + /// <summary> + /// SessionClosedException + /// </summary> + + public class SessionClosedException : SessionException + { + + public SessionClosedException(): base(new List<ExecutionException>()) + { + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/exception/SessionException.cs b/qpid/dotnet/client-010/client/transport/exception/SessionException.cs index b586019802..f02ffa5c2f 100644 --- a/qpid/dotnet/client-010/client/transport/exception/SessionException.cs +++ b/qpid/dotnet/client-010/client/transport/exception/SessionException.cs @@ -1,45 +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.
-*
-*/
-using System;
-using System.Collections.Generic;
-
-namespace org.apache.qpid.transport
-{
- /// <summary>
- /// SessionException
- /// </summary>
- public class SessionException : Exception
- {
- private readonly List<ExecutionException> _exceptions;
-
- public SessionException(List<ExecutionException> exceptions)
- : base(exceptions.Count == 0 ? "" : exceptions.ToString())
-
- {
- _exceptions = exceptions;
- }
-
- public List<ExecutionException> Exceptions
- {
- get { return _exceptions; }
- }
- }
+/* +* +* 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; + +namespace org.apache.qpid.transport +{ + /// <summary> + /// SessionException + /// </summary> + public class SessionException : Exception + { + private readonly List<ExecutionException> _exceptions; + + public SessionException(List<ExecutionException> exceptions) + : base(exceptions.Count == 0 ? "" : exceptions.ToString()) + + { + _exceptions = exceptions; + } + + public List<ExecutionException> Exceptions + { + get { return _exceptions; } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/exception/TransportException.cs b/qpid/dotnet/client-010/client/transport/exception/TransportException.cs index 1c216d51e4..d016f90a83 100644 --- a/qpid/dotnet/client-010/client/transport/exception/TransportException.cs +++ b/qpid/dotnet/client-010/client/transport/exception/TransportException.cs @@ -1,46 +1,46 @@ -/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-using System;
-namespace org.apache.qpid.transport
-{
-
-
- /// <summary>
- /// TransportException
- /// </summary>
-
-
- public class TransportException : Exception
- {
- public TransportException(String msg) : base(msg)
- {
- }
-
- public TransportException(String msg, Exception cause) : base(msg, cause)
- {
- }
-
- public TransportException(Exception cause): base("Transport Exception", cause)
- {
- }
-
- }
+/* +* +* 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; +namespace org.apache.qpid.transport +{ + + + /// <summary> + /// TransportException + /// </summary> + + + public class TransportException : Exception + { + public TransportException(String msg) : base(msg) + { + } + + public TransportException(String msg, Exception cause) : base(msg, cause) + { + } + + public TransportException(Exception cause): base("Transport Exception", cause) + { + } + + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/Assembler.cs b/qpid/dotnet/client-010/client/transport/network/Assembler.cs index 6f81c8edee..eb280df877 100644 --- a/qpid/dotnet/client-010/client/transport/network/Assembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Assembler.cs @@ -1,282 +1,282 @@ -/*
-*
-* 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.IO;
-using org.apache.qpid.transport.codec;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.network
-{
- /// <summary>
- /// Assembler
- /// </summary>
- public delegate void Processor(NetworkDelegate ndelegate);
-
- public class Assembler : NetworkDelegate, Receiver<ReceivedPayload<ProtocolEvent>>
- {
- private static readonly Logger log = Logger.get(typeof (Assembler));
- private readonly Dictionary<int, List<byte[]>> segments;
- private readonly Method[] incomplete;
- [ThreadStatic] static MSDecoder _decoder;
- private readonly Object m_objectLock = new object();
-
- // the event raised when a buffer is read from the wire
- public event EventHandler<ReceivedPayload<ProtocolEvent>> ReceivedEvent;
- public event EventHandler<ExceptionArgs> ExceptionProcessing;
- public event EventHandler HandlerClosed;
-
- event EventHandler<ReceivedPayload<ProtocolEvent>> Receiver<ReceivedPayload<ProtocolEvent>>.Received
- {
- add
- {
- lock (m_objectLock)
- {
- ReceivedEvent += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- ReceivedEvent -= value;
- }
- }
- }
-
- event EventHandler<ExceptionArgs> Receiver<ReceivedPayload<ProtocolEvent>>.Exception
- {
- add
- {
- lock (m_objectLock)
- {
- ExceptionProcessing += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- ExceptionProcessing -= value;
- }
- }
- }
-
- event EventHandler Receiver<ReceivedPayload<ProtocolEvent>>.Closed
- {
- add
- {
- lock (m_objectLock)
- {
- HandlerClosed += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- HandlerClosed -= value;
- }
- }
- }
-
- public Assembler()
- {
- segments = new Dictionary<int, List<byte[]>>();
- incomplete = new Method[64*1024];
- }
-
- // Invoked when a network event is received
- public void On_ReceivedEvent(object sender, ReceivedPayload<NetworkEvent> payload)
- {
- payload.Payload.ProcessNetworkEvent(this);
- }
-
- #region Interface NetworkDelegate
-
- public void Init(ProtocolHeader header)
- {
- Emit(0, header);
- }
-
- public void Error(ProtocolError error)
- {
- Emit(0, error);
- }
-
- public void Frame(Frame frame)
- {
- MemoryStream segment;
- if (frame.isFirstFrame() && frame.isLastFrame())
- {
- byte[] tmp = new byte[frame.BodySize];
- frame.Body.Read(tmp, 0, tmp.Length);
- segment = new MemoryStream();
- BinaryWriter w = new BinaryWriter(segment);
- w.Write(tmp);
- assemble(frame, new MemoryStream(tmp));
- }
- else
- {
- List<byte[]> frames;
- if (frame.isFirstFrame())
- {
- frames = new List<byte[]>();
- setSegment(frame, frames);
- }
- else
- {
- frames = getSegment(frame);
- }
- byte[] tmp = new byte[frame.BodySize];
- frame.Body.Read(tmp, 0, tmp.Length);
- frames.Add(tmp);
-
- if (frame.isLastFrame())
- {
- clearSegment(frame);
- segment = new MemoryStream();
- BinaryWriter w = new BinaryWriter(segment);
- foreach (byte[] f in frames)
- {
- w.Write(f);
- }
- assemble(frame, segment);
- }
- }
- }
-
- #endregion
-
- #region Private Support Functions
-
-
- private MSDecoder getDecoder()
- {
- if( _decoder == null )
- {
- _decoder = new MSDecoder();
- }
- return _decoder;
- }
-
- private void assemble(Frame frame, MemoryStream segment)
- {
- MSDecoder decoder = getDecoder();
- decoder.init(segment);
- int channel = frame.Channel;
- Method command;
- switch (frame.Type)
- {
- case SegmentType.CONTROL:
- int controlType = decoder.readUint16();
- Method control = Method.create(controlType);
- control.read(decoder);
- Emit(channel, control);
- break;
- case SegmentType.COMMAND:
- int commandType = decoder.readUint16();
- // read in the session header, right now we don't use it
- decoder.readUint16();
- command = Method.create(commandType);
- command.read(decoder);
- if (command.hasPayload())
- {
- incomplete[channel] = command;
- }
- else
- {
- Emit(channel, command);
- }
- break;
- case SegmentType.HEADER:
- command = incomplete[channel];
- List<Struct> structs = new List<Struct>();
- while (decoder.hasRemaining())
- {
- structs.Add(decoder.readStruct32());
- }
- command.Header = new Header(structs);
- if (frame.isLastSegment())
- {
- incomplete[channel] = null;
- Emit(channel, command);
- }
- break;
- case SegmentType.BODY:
- command = incomplete[channel];
- segment.Seek(0, SeekOrigin.Begin);
- command.Body = segment;
- incomplete[channel] = null;
- Emit(channel, command);
- break;
- default:
- throw new Exception("unknown frame type: " + frame.Type);
- }
- }
-
- private int segmentKey(Frame frame)
- {
- return (frame.Track + 1)*frame.Channel;
- }
-
- private List<byte[]> getSegment(Frame frame)
- {
- return segments[segmentKey(frame)];
- }
-
- private void setSegment(Frame frame, List<byte[]> segment)
- {
- int key = segmentKey(frame);
- if (segments.ContainsKey(key))
- {
- Error(new ProtocolError(network.Frame.L2, "segment in progress: %s",
- frame));
- }
- segments.Add(segmentKey(frame), segment);
- }
-
- private void clearSegment(Frame frame)
- {
- segments.Remove(segmentKey(frame));
- }
-
- // Emit a protocol event
- private void Emit(int channel, ProtocolEvent protevent)
- {
- protevent.Channel = channel;
- log.debug("Assembler: protocol event:", protevent);
- ReceivedPayload<ProtocolEvent> payload = new ReceivedPayload<ProtocolEvent>();
- payload.Payload = protevent;
- if (ReceivedEvent != null)
- {
- ReceivedEvent(this, payload);
- }
- else
- {
- log.debug("No listener for event: {0}", protevent);
- }
- }
-
- #endregion
- }
+/* +* +* 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.IO; +using org.apache.qpid.transport.codec; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.network +{ + /// <summary> + /// Assembler + /// </summary> + public delegate void Processor(NetworkDelegate ndelegate); + + public class Assembler : NetworkDelegate, Receiver<ReceivedPayload<ProtocolEvent>> + { + private static readonly Logger log = Logger.get(typeof (Assembler)); + private readonly Dictionary<int, List<byte[]>> segments; + private readonly Method[] incomplete; + [ThreadStatic] static MSDecoder _decoder; + private readonly Object m_objectLock = new object(); + + // the event raised when a buffer is read from the wire + public event EventHandler<ReceivedPayload<ProtocolEvent>> ReceivedEvent; + public event EventHandler<ExceptionArgs> ExceptionProcessing; + public event EventHandler HandlerClosed; + + event EventHandler<ReceivedPayload<ProtocolEvent>> Receiver<ReceivedPayload<ProtocolEvent>>.Received + { + add + { + lock (m_objectLock) + { + ReceivedEvent += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedEvent -= value; + } + } + } + + event EventHandler<ExceptionArgs> Receiver<ReceivedPayload<ProtocolEvent>>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionProcessing += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionProcessing -= value; + } + } + } + + event EventHandler Receiver<ReceivedPayload<ProtocolEvent>>.Closed + { + add + { + lock (m_objectLock) + { + HandlerClosed += value; + } + } + remove + { + lock (m_objectLock) + { + HandlerClosed -= value; + } + } + } + + public Assembler() + { + segments = new Dictionary<int, List<byte[]>>(); + incomplete = new Method[64*1024]; + } + + // Invoked when a network event is received + public void On_ReceivedEvent(object sender, ReceivedPayload<NetworkEvent> payload) + { + payload.Payload.ProcessNetworkEvent(this); + } + + #region Interface NetworkDelegate + + public void Init(ProtocolHeader header) + { + Emit(0, header); + } + + public void Error(ProtocolError error) + { + Emit(0, error); + } + + public void Frame(Frame frame) + { + MemoryStream segment; + if (frame.isFirstFrame() && frame.isLastFrame()) + { + byte[] tmp = new byte[frame.BodySize]; + frame.Body.Read(tmp, 0, tmp.Length); + segment = new MemoryStream(); + BinaryWriter w = new BinaryWriter(segment); + w.Write(tmp); + assemble(frame, new MemoryStream(tmp)); + } + else + { + List<byte[]> frames; + if (frame.isFirstFrame()) + { + frames = new List<byte[]>(); + setSegment(frame, frames); + } + else + { + frames = getSegment(frame); + } + byte[] tmp = new byte[frame.BodySize]; + frame.Body.Read(tmp, 0, tmp.Length); + frames.Add(tmp); + + if (frame.isLastFrame()) + { + clearSegment(frame); + segment = new MemoryStream(); + BinaryWriter w = new BinaryWriter(segment); + foreach (byte[] f in frames) + { + w.Write(f); + } + assemble(frame, segment); + } + } + } + + #endregion + + #region Private Support Functions + + + private MSDecoder getDecoder() + { + if( _decoder == null ) + { + _decoder = new MSDecoder(); + } + return _decoder; + } + + private void assemble(Frame frame, MemoryStream segment) + { + MSDecoder decoder = getDecoder(); + decoder.init(segment); + int channel = frame.Channel; + Method command; + switch (frame.Type) + { + case SegmentType.CONTROL: + int controlType = decoder.readUint16(); + Method control = Method.create(controlType); + control.read(decoder); + Emit(channel, control); + break; + case SegmentType.COMMAND: + int commandType = decoder.readUint16(); + // read in the session header, right now we don't use it + decoder.readUint16(); + command = Method.create(commandType); + command.read(decoder); + if (command.hasPayload()) + { + incomplete[channel] = command; + } + else + { + Emit(channel, command); + } + break; + case SegmentType.HEADER: + command = incomplete[channel]; + List<Struct> structs = new List<Struct>(); + while (decoder.hasRemaining()) + { + structs.Add(decoder.readStruct32()); + } + command.Header = new Header(structs); + if (frame.isLastSegment()) + { + incomplete[channel] = null; + Emit(channel, command); + } + break; + case SegmentType.BODY: + command = incomplete[channel]; + segment.Seek(0, SeekOrigin.Begin); + command.Body = segment; + incomplete[channel] = null; + Emit(channel, command); + break; + default: + throw new Exception("unknown frame type: " + frame.Type); + } + } + + private int segmentKey(Frame frame) + { + return (frame.Track + 1)*frame.Channel; + } + + private List<byte[]> getSegment(Frame frame) + { + return segments[segmentKey(frame)]; + } + + private void setSegment(Frame frame, List<byte[]> segment) + { + int key = segmentKey(frame); + if (segments.ContainsKey(key)) + { + Error(new ProtocolError(network.Frame.L2, "segment in progress: %s", + frame)); + } + segments.Add(segmentKey(frame), segment); + } + + private void clearSegment(Frame frame) + { + segments.Remove(segmentKey(frame)); + } + + // Emit a protocol event + private void Emit(int channel, ProtocolEvent protevent) + { + protevent.Channel = channel; + log.debug("Assembler: protocol event:", protevent); + ReceivedPayload<ProtocolEvent> payload = new ReceivedPayload<ProtocolEvent>(); + payload.Payload = protevent; + if (ReceivedEvent != null) + { + ReceivedEvent(this, payload); + } + else + { + log.debug("No listener for event: {0}", protevent); + } + } + + #endregion + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/Disassembler.cs b/qpid/dotnet/client-010/client/transport/network/Disassembler.cs index 4cf16a98fe..2d01656942 100644 --- a/qpid/dotnet/client-010/client/transport/network/Disassembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Disassembler.cs @@ -1,222 +1,222 @@ -/*
-*
-* 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.IO;
-using org.apache.qpid.transport.codec;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.network
-{
- /// <summary>
- /// Disassembler
- /// </summary>
- public sealed class Disassembler : Sender<ProtocolEvent>, ProtocolDelegate<Object>
- {
- private readonly IIOSender<MemoryStream> _sender;
- private readonly int _maxPayload;
- private readonly MemoryStream _header;
- private readonly BinaryWriter _writer;
- private readonly Object _sendlock = new Object();
- [ThreadStatic] static MSEncoder _encoder;
-
-
- public Disassembler(IIOSender<MemoryStream> sender, int maxFrame)
- {
- if (maxFrame <= Frame.HEADER_SIZE || maxFrame >= 64*1024)
- {
- throw new Exception(String.Format("maxFrame must be > {0} and < 64K: ", Frame.HEADER_SIZE) + maxFrame);
- }
- _sender = sender;
- _maxPayload = maxFrame - Frame.HEADER_SIZE;
- _header = new MemoryStream(Frame.HEADER_SIZE);
- _writer = new BinaryWriter(_header);
- }
-
- #region Sender Interface
-
- public void send(ProtocolEvent pevent)
- {
- pevent.ProcessProtocolEvent(null, this);
- }
-
- public void flush()
- {
- lock (_sendlock)
- {
- _sender.flush();
- }
- }
-
- public void close()
- {
- lock (_sendlock)
- {
- _sender.close();
- }
- }
-
- #endregion
-
- #region ProtocolDelegate<Object> Interface
-
- public void Init(Object v, ProtocolHeader header)
- {
- lock (_sendlock)
- {
- _sender.send(header.ToMemoryStream());
- _sender.flush();
- }
- }
-
- public void Control(Object v, Method method)
- {
- invokeMethod(method, SegmentType.CONTROL);
- }
-
- public void Command(Object v, Method method)
- {
- invokeMethod(method, SegmentType.COMMAND);
- }
-
- public void Error(Object v, ProtocolError error)
- {
- throw new Exception("Error: " + error);
- }
-
- #endregion
-
- #region private
-
- private void frame(byte flags, byte type, byte track, int channel, int size, MemoryStream buf)
- {
- lock (_sendlock)
- {
- _writer.Write(flags);
- _writer.Write(type);
- _writer.Write(ByteEncoder.GetBigEndian((UInt16)(size + Frame.HEADER_SIZE)));
- _writer.Write((byte)0);
- _writer.Write(track);
- _writer.Write(ByteEncoder.GetBigEndian((UInt16)( channel)));
- _writer.Write((byte)0);
- _writer.Write((byte)0);
- _writer.Write((byte)0);
- _writer.Write((byte)0);
- _sender.send(_header);
- _header.Seek(0, SeekOrigin.Begin);
- _sender.send(buf, size);
- }
- }
-
- private void fragment(byte flags, SegmentType type, ProtocolEvent mevent, MemoryStream buf)
- {
- byte typeb = (byte) type;
- byte track = mevent.EncodedTrack == Frame.L4 ? (byte) 1 : (byte) 0;
- int remaining = (int) buf.Length;
- buf.Seek(0, SeekOrigin.Begin);
- bool first = true;
- while (true)
- {
- int size = Math.Min(_maxPayload, remaining);
- remaining -= size;
-
- byte newflags = flags;
- if (first)
- {
- newflags |= Frame.FIRST_FRAME;
- first = false;
- }
- if (remaining == 0)
- {
- newflags |= Frame.LAST_FRAME;
- }
-
- frame(newflags, typeb, track, mevent.Channel, size, buf);
-
- if (remaining == 0)
- {
- break;
- }
- }
- }
-
- private MSEncoder getEncoder()
- {
- if( _encoder == null)
- {
- _encoder = new MSEncoder(4 * 1024);
- }
- return _encoder;
- }
-
- private void invokeMethod(Method method, SegmentType type)
- {
- MSEncoder encoder = getEncoder();
- encoder.init();
- encoder.writeUint16(method.getEncodedType());
- if (type == SegmentType.COMMAND)
- {
- if (method.Sync)
- {
- encoder.writeUint16(0x0101);
- }
- else
- {
- encoder.writeUint16(0x0100);
- }
- }
- method.write(_encoder);
- MemoryStream methodSeg = encoder.segment();
-
- byte flags = Frame.FIRST_SEG;
-
- bool payload = method.hasPayload();
- if (!payload)
- {
- flags |= Frame.LAST_SEG;
- }
-
- MemoryStream headerSeg = null;
- if (payload)
- {
- Header hdr = method.Header;
- Struct[] structs = hdr.Structs;
-
- foreach (Struct st in structs)
- {
- encoder.writeStruct32(st);
- }
- headerSeg = encoder.segment();
- }
-
- lock (_sendlock)
- {
- fragment(flags, type, method, methodSeg);
- if (payload)
- {
- fragment( 0x0, SegmentType.HEADER, method, headerSeg);
- fragment(Frame.LAST_SEG, SegmentType.BODY, method, method.Body);
- }
- }
- }
-
- #endregion
- }
+/* +* +* 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.IO; +using org.apache.qpid.transport.codec; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.network +{ + /// <summary> + /// Disassembler + /// </summary> + public sealed class Disassembler : Sender<ProtocolEvent>, ProtocolDelegate<Object> + { + private readonly IIOSender<MemoryStream> _sender; + private readonly int _maxPayload; + private readonly MemoryStream _header; + private readonly BinaryWriter _writer; + private readonly Object _sendlock = new Object(); + [ThreadStatic] static MSEncoder _encoder; + + + public Disassembler(IIOSender<MemoryStream> sender, int maxFrame) + { + if (maxFrame <= Frame.HEADER_SIZE || maxFrame >= 64*1024) + { + throw new Exception(String.Format("maxFrame must be > {0} and < 64K: ", Frame.HEADER_SIZE) + maxFrame); + } + _sender = sender; + _maxPayload = maxFrame - Frame.HEADER_SIZE; + _header = new MemoryStream(Frame.HEADER_SIZE); + _writer = new BinaryWriter(_header); + } + + #region Sender Interface + + public void send(ProtocolEvent pevent) + { + pevent.ProcessProtocolEvent(null, this); + } + + public void flush() + { + lock (_sendlock) + { + _sender.flush(); + } + } + + public void close() + { + lock (_sendlock) + { + _sender.close(); + } + } + + #endregion + + #region ProtocolDelegate<Object> Interface + + public void Init(Object v, ProtocolHeader header) + { + lock (_sendlock) + { + _sender.send(header.ToMemoryStream()); + _sender.flush(); + } + } + + public void Control(Object v, Method method) + { + invokeMethod(method, SegmentType.CONTROL); + } + + public void Command(Object v, Method method) + { + invokeMethod(method, SegmentType.COMMAND); + } + + public void Error(Object v, ProtocolError error) + { + throw new Exception("Error: " + error); + } + + #endregion + + #region private + + private void frame(byte flags, byte type, byte track, int channel, int size, MemoryStream buf) + { + lock (_sendlock) + { + _writer.Write(flags); + _writer.Write(type); + _writer.Write(ByteEncoder.GetBigEndian((UInt16)(size + Frame.HEADER_SIZE))); + _writer.Write((byte)0); + _writer.Write(track); + _writer.Write(ByteEncoder.GetBigEndian((UInt16)( channel))); + _writer.Write((byte)0); + _writer.Write((byte)0); + _writer.Write((byte)0); + _writer.Write((byte)0); + _sender.send(_header); + _header.Seek(0, SeekOrigin.Begin); + _sender.send(buf, size); + } + } + + private void fragment(byte flags, SegmentType type, ProtocolEvent mevent, MemoryStream buf) + { + byte typeb = (byte) type; + byte track = mevent.EncodedTrack == Frame.L4 ? (byte) 1 : (byte) 0; + int remaining = (int) buf.Length; + buf.Seek(0, SeekOrigin.Begin); + bool first = true; + while (true) + { + int size = Math.Min(_maxPayload, remaining); + remaining -= size; + + byte newflags = flags; + if (first) + { + newflags |= Frame.FIRST_FRAME; + first = false; + } + if (remaining == 0) + { + newflags |= Frame.LAST_FRAME; + } + + frame(newflags, typeb, track, mevent.Channel, size, buf); + + if (remaining == 0) + { + break; + } + } + } + + private MSEncoder getEncoder() + { + if( _encoder == null) + { + _encoder = new MSEncoder(4 * 1024); + } + return _encoder; + } + + private void invokeMethod(Method method, SegmentType type) + { + MSEncoder encoder = getEncoder(); + encoder.init(); + encoder.writeUint16(method.getEncodedType()); + if (type == SegmentType.COMMAND) + { + if (method.Sync) + { + encoder.writeUint16(0x0101); + } + else + { + encoder.writeUint16(0x0100); + } + } + method.write(_encoder); + MemoryStream methodSeg = encoder.segment(); + + byte flags = Frame.FIRST_SEG; + + bool payload = method.hasPayload(); + if (!payload) + { + flags |= Frame.LAST_SEG; + } + + MemoryStream headerSeg = null; + if (payload) + { + Header hdr = method.Header; + Struct[] structs = hdr.Structs; + + foreach (Struct st in structs) + { + encoder.writeStruct32(st); + } + headerSeg = encoder.segment(); + } + + lock (_sendlock) + { + fragment(flags, type, method, methodSeg); + if (payload) + { + fragment( 0x0, SegmentType.HEADER, method, headerSeg); + fragment(Frame.LAST_SEG, SegmentType.BODY, method, method.Body); + } + } + } + + #endregion + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/Frame.cs b/qpid/dotnet/client-010/client/transport/network/Frame.cs index 5b7e15b1aa..ba7ee475a0 100644 --- a/qpid/dotnet/client-010/client/transport/network/Frame.cs +++ b/qpid/dotnet/client-010/client/transport/network/Frame.cs @@ -1,143 +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.
-*
-*/
-using System;
-using System.IO;
-
-namespace org.apache.qpid.transport.network
-{
- public sealed class Frame : NetworkEvent
- {
- internal static int HEADER_SIZE = 12;
-
- // XXX: enums?
- public const byte L1 = 0;
- public const byte L2 = 1;
- public const byte L3 = 2;
- public const byte L4 = 3;
-
- public static byte RESERVED = 0x0;
-
- public static byte VERSION = 0x0;
-
- public static byte FIRST_SEG = 0x8;
- public static byte LAST_SEG = 0x4;
- public static byte FIRST_FRAME = 0x2;
- public static byte LAST_FRAME = 0x1;
-
- private readonly byte flags;
- private readonly SegmentType type;
- private readonly byte track;
- private readonly int channel;
- private readonly MemoryStream body;
- private int _bodySize;
-
-
- public Frame(byte flags, SegmentType type, byte track, int channel, int bodySize,
- MemoryStream body)
- {
- this.flags = flags;
- this.type = type;
- this.track = track;
- this.channel = channel;
- this.body = body;
- _bodySize = bodySize;
- }
-
- public int BodySize
- {
- get { return _bodySize; }
- }
-
- public MemoryStream Body
- {
- get { return body; }
- }
-
- public byte Flags
- {
- get { return flags; }
- }
-
- public int Channel
- {
- get { return channel; }
- }
-
- public int Size
- {
- get { return (int) body.Length;}
- }
-
- public SegmentType Type
- {
- get { return type; }
- }
-
- public byte Track
- {
- get { return track; }
- }
-
- private bool flag(byte mask)
- {
- return (flags & mask) != 0;
- }
-
- public bool isFirstSegment()
- {
- return flag(FIRST_SEG);
- }
-
- public bool isLastSegment()
- {
- return flag(LAST_SEG);
- }
-
- public bool isFirstFrame()
- {
- return flag(FIRST_FRAME);
- }
-
- public bool isLastFrame()
- {
- return flag(LAST_FRAME);
- }
-
- #region NetworkEvent Methods
-
- public void ProcessNetworkEvent(NetworkDelegate ndelegate)
- {
- ndelegate.Frame(this);
- }
-
- #endregion
-
- public String toString()
- {
- return String.Format
- ("[{0:d} {1:d} {2:d} {3} {4}{5}{6}{7}] ", Channel, Size, Track, Type,
- isFirstSegment() ? 1 : 0, isLastSegment() ? 1 : 0,
- isFirstFrame() ? 1 : 0, isLastFrame() ? 1 : 0);
- }
-
-
- }
+/* +* +* 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.IO; + +namespace org.apache.qpid.transport.network +{ + public sealed class Frame : NetworkEvent + { + internal static int HEADER_SIZE = 12; + + // XXX: enums? + public const byte L1 = 0; + public const byte L2 = 1; + public const byte L3 = 2; + public const byte L4 = 3; + + public static byte RESERVED = 0x0; + + public static byte VERSION = 0x0; + + public static byte FIRST_SEG = 0x8; + public static byte LAST_SEG = 0x4; + public static byte FIRST_FRAME = 0x2; + public static byte LAST_FRAME = 0x1; + + private readonly byte flags; + private readonly SegmentType type; + private readonly byte track; + private readonly int channel; + private readonly MemoryStream body; + private int _bodySize; + + + public Frame(byte flags, SegmentType type, byte track, int channel, int bodySize, + MemoryStream body) + { + this.flags = flags; + this.type = type; + this.track = track; + this.channel = channel; + this.body = body; + _bodySize = bodySize; + } + + public int BodySize + { + get { return _bodySize; } + } + + public MemoryStream Body + { + get { return body; } + } + + public byte Flags + { + get { return flags; } + } + + public int Channel + { + get { return channel; } + } + + public int Size + { + get { return (int) body.Length;} + } + + public SegmentType Type + { + get { return type; } + } + + public byte Track + { + get { return track; } + } + + private bool flag(byte mask) + { + return (flags & mask) != 0; + } + + public bool isFirstSegment() + { + return flag(FIRST_SEG); + } + + public bool isLastSegment() + { + return flag(LAST_SEG); + } + + public bool isFirstFrame() + { + return flag(FIRST_FRAME); + } + + public bool isLastFrame() + { + return flag(LAST_FRAME); + } + + #region NetworkEvent Methods + + public void ProcessNetworkEvent(NetworkDelegate ndelegate) + { + ndelegate.Frame(this); + } + + #endregion + + public String toString() + { + return String.Format + ("[{0:d} {1:d} {2:d} {3} {4}{5}{6}{7}] ", Channel, Size, Track, Type, + isFirstSegment() ? 1 : 0, isLastSegment() ? 1 : 0, + isFirstFrame() ? 1 : 0, isLastFrame() ? 1 : 0); + } + + + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/IIoSender.cs b/qpid/dotnet/client-010/client/transport/network/IIoSender.cs index 67a52ef707..747b5b9f98 100644 --- a/qpid/dotnet/client-010/client/transport/network/IIoSender.cs +++ b/qpid/dotnet/client-010/client/transport/network/IIoSender.cs @@ -1,28 +1,28 @@ -/*
-*
-* 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.transport.network
-{
- public interface IIOSender<T>:Sender<T>
- {
- void send(T body, int siz);
- }
-}
+/* +* +* 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.transport.network +{ + public interface IIOSender<T>:Sender<T> + { + void send(T body, int siz); + } +} diff --git a/qpid/dotnet/client-010/client/transport/network/InputHandler.cs b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs index f3bffdb821..8bd13c74a9 100644 --- a/qpid/dotnet/client-010/client/transport/network/InputHandler.cs +++ b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs @@ -1,282 +1,282 @@ -/*
-*
-* 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.IO;
-using System.Text;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.network
-{
- /// <summary>
- /// InputHandler
- /// </summary>
- public sealed class InputHandler : Receiver<ReceivedPayload<NetworkEvent>>
- {
- public enum State
- {
- PROTO_HDR,
- FRAME_HDR,
- FRAME_BODY,
- ERROR
- }
-
- private static readonly Logger log = Logger.get(typeof(InputHandler));
- private readonly Object m_objectLock = new object();
-
- // the event raised when a buffer is read from the wire
- public event EventHandler<ReceivedPayload<NetworkEvent>> ReceivedEvent;
- public event EventHandler<ExceptionArgs> ExceptionProcessing;
- public event EventHandler HandlerClosed;
-
- event EventHandler<ReceivedPayload<NetworkEvent>> Receiver<ReceivedPayload<NetworkEvent>>.Received
- {
- add
- {
- lock (m_objectLock)
- {
- ReceivedEvent += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- ReceivedEvent -= value;
- }
- }
- }
-
- event EventHandler<ExceptionArgs> Receiver<ReceivedPayload<NetworkEvent>>.Exception
- {
- add
- {
- lock (m_objectLock)
- {
- ExceptionProcessing += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- ExceptionProcessing -= value;
- }
- }
- }
-
- event EventHandler Receiver<ReceivedPayload<NetworkEvent>>.Closed
- {
- add
- {
- lock (m_objectLock)
- {
- HandlerClosed += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- HandlerClosed -= value;
- }
- }
- }
-
- private State state;
- private MemoryStream input;
- private int needed;
-
- private byte flags;
- private SegmentType type;
- private byte track;
- private int channel;
-
- public InputHandler(State state)
- {
- this.state = state;
- switch (state)
- {
- case State.PROTO_HDR:
- needed = 8;
- break;
- case State.FRAME_HDR:
- needed = Frame.HEADER_SIZE;
- break;
- }
- }
-
- // The command listening for a buffer read.
- public void On_ReceivedBuffer(object sender, ReceivedPayload<MemoryStream> payload)
- {
- MemoryStream buf = payload.Payload;
- int remaining = (int) buf.Length;
- if( input != null )
- {
- remaining += (int) input.Length;
- }
- try
- {
- while (remaining > 0)
- {
- if (remaining >= needed)
- {
- if (input != null)
- {
- byte[] tmp = new byte[buf.Length];
- buf.Read(tmp, 0, tmp.Length);
- input.Write(tmp, 0, tmp.Length);
- input.Seek(0, SeekOrigin.Begin);
- buf = input;
- }
- int startPos = (int)buf.Position;
- int consumed = needed;
- state = next(buf);
- if ((buf.Position - startPos) < consumed)
- {
- buf.Seek(consumed - (buf.Position - startPos), SeekOrigin.Current);
- }
- remaining -= consumed;
- input = null;
- }
- else
- {
- byte[] tmp;
- if (input == null)
- {
- input = new MemoryStream();
- tmp = new byte[remaining];
- }
- else
- {
- // this is a full buffer
- tmp = new byte[buf.Length];
- }
- buf.Read(tmp, 0, tmp.Length);
- input.Write(tmp, 0, tmp.Length);
- remaining = 0;
- }
- }
- }
- catch (Exception t)
- {
- Console.Write(t);
- if (ExceptionProcessing != null)
- {
- ExceptionProcessing(this, new ExceptionArgs(t));
- }
- }
- }
-
- #region Private Support Functions
-
- private State next(MemoryStream buf)
- {
- BinaryReader reader = new BinaryReader(buf);
-
- switch (state)
- {
- case State.PROTO_HDR:
- char a = reader.ReadChar();
- char m = reader.ReadChar();
- char q = reader.ReadChar();
- char p = reader.ReadChar();
- if (a != 'A' &&
- m != 'M' &&
- q != 'Q' &&
- p != 'P')
- {
- Error("bad protocol header: {0}", buf.ToString());
- return State.ERROR;
- }
- reader.ReadByte();
- byte instance = reader.ReadByte();
- byte major = reader.ReadByte();
- byte minor = reader.ReadByte();
- Fire_NetworkEvent(new ProtocolHeader(instance, major, minor));
- needed = Frame.HEADER_SIZE;
- return State.FRAME_HDR;
- case State.FRAME_HDR:
- reader = new BinaryReader(buf, Encoding.BigEndianUnicode);
- flags = reader.ReadByte();
- type = SegmentTypeGetter.get(reader.ReadByte()); // generated code
- int size = reader.ReadUInt16();
- size = ByteEncoder.GetBigEndian((UInt16)size);
- size -= Frame.HEADER_SIZE;
- if (size < 0 || size > (64 * 1024 - 12))
- {
- Error("bad frame size: {0:d}", size);
- return State.ERROR;
- }
- reader.ReadByte();
- byte b = reader.ReadByte();
- if ((b & 0xF0) != 0)
- {
- Error("non-zero reserved bits in upper nibble of " +
- "frame header byte 5: {0}", b);
- return State.ERROR;
- }
- track = (byte)(b & 0xF);
- channel = reader.ReadUInt16();
- channel = ByteEncoder.GetBigEndian((UInt16)channel);
- if (size == 0)
- {
- Fire_NetworkEvent(new Frame(flags, type, track, channel, 0, new MemoryStream()));
- needed = Frame.HEADER_SIZE;
- return State.FRAME_HDR;
- }
- needed = size;
- return State.FRAME_BODY;
- case State.FRAME_BODY:
- Fire_NetworkEvent(new Frame(flags, type, track, channel, needed, buf));
- needed = Frame.HEADER_SIZE;
- return State.FRAME_HDR;
- default:
- if (ExceptionProcessing != null)
- {
- ExceptionProcessing(this, new ExceptionArgs(new Exception("Error creating frame")));
- }
- throw new Exception("Error creating frame");
- }
- }
-
- private void Error(String fmt, params Object[] args)
- {
- Fire_NetworkEvent(new ProtocolError(Frame.L1, fmt, args));
- }
-
- private void Fire_NetworkEvent(NetworkEvent netevent)
- {
- log.debug("InputHandler: network event:", netevent);
- ReceivedPayload<NetworkEvent> payload = new ReceivedPayload<NetworkEvent>();
- payload.Payload = netevent;
- if (ReceivedEvent != null)
- {
- ReceivedEvent(this, payload);
- }
- else
- {
- log.debug("Nobody listening for event: {0}");
- }
- }
-
- #endregion
- }
+/* +* +* 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.IO; +using System.Text; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.network +{ + /// <summary> + /// InputHandler + /// </summary> + public sealed class InputHandler : Receiver<ReceivedPayload<NetworkEvent>> + { + public enum State + { + PROTO_HDR, + FRAME_HDR, + FRAME_BODY, + ERROR + } + + private static readonly Logger log = Logger.get(typeof(InputHandler)); + private readonly Object m_objectLock = new object(); + + // the event raised when a buffer is read from the wire + public event EventHandler<ReceivedPayload<NetworkEvent>> ReceivedEvent; + public event EventHandler<ExceptionArgs> ExceptionProcessing; + public event EventHandler HandlerClosed; + + event EventHandler<ReceivedPayload<NetworkEvent>> Receiver<ReceivedPayload<NetworkEvent>>.Received + { + add + { + lock (m_objectLock) + { + ReceivedEvent += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedEvent -= value; + } + } + } + + event EventHandler<ExceptionArgs> Receiver<ReceivedPayload<NetworkEvent>>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionProcessing += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionProcessing -= value; + } + } + } + + event EventHandler Receiver<ReceivedPayload<NetworkEvent>>.Closed + { + add + { + lock (m_objectLock) + { + HandlerClosed += value; + } + } + remove + { + lock (m_objectLock) + { + HandlerClosed -= value; + } + } + } + + private State state; + private MemoryStream input; + private int needed; + + private byte flags; + private SegmentType type; + private byte track; + private int channel; + + public InputHandler(State state) + { + this.state = state; + switch (state) + { + case State.PROTO_HDR: + needed = 8; + break; + case State.FRAME_HDR: + needed = Frame.HEADER_SIZE; + break; + } + } + + // The command listening for a buffer read. + public void On_ReceivedBuffer(object sender, ReceivedPayload<MemoryStream> payload) + { + MemoryStream buf = payload.Payload; + int remaining = (int) buf.Length; + if( input != null ) + { + remaining += (int) input.Length; + } + try + { + while (remaining > 0) + { + if (remaining >= needed) + { + if (input != null) + { + byte[] tmp = new byte[buf.Length]; + buf.Read(tmp, 0, tmp.Length); + input.Write(tmp, 0, tmp.Length); + input.Seek(0, SeekOrigin.Begin); + buf = input; + } + int startPos = (int)buf.Position; + int consumed = needed; + state = next(buf); + if ((buf.Position - startPos) < consumed) + { + buf.Seek(consumed - (buf.Position - startPos), SeekOrigin.Current); + } + remaining -= consumed; + input = null; + } + else + { + byte[] tmp; + if (input == null) + { + input = new MemoryStream(); + tmp = new byte[remaining]; + } + else + { + // this is a full buffer + tmp = new byte[buf.Length]; + } + buf.Read(tmp, 0, tmp.Length); + input.Write(tmp, 0, tmp.Length); + remaining = 0; + } + } + } + catch (Exception t) + { + Console.Write(t); + if (ExceptionProcessing != null) + { + ExceptionProcessing(this, new ExceptionArgs(t)); + } + } + } + + #region Private Support Functions + + private State next(MemoryStream buf) + { + BinaryReader reader = new BinaryReader(buf); + + switch (state) + { + case State.PROTO_HDR: + char a = reader.ReadChar(); + char m = reader.ReadChar(); + char q = reader.ReadChar(); + char p = reader.ReadChar(); + if (a != 'A' && + m != 'M' && + q != 'Q' && + p != 'P') + { + Error("bad protocol header: {0}", buf.ToString()); + return State.ERROR; + } + reader.ReadByte(); + byte instance = reader.ReadByte(); + byte major = reader.ReadByte(); + byte minor = reader.ReadByte(); + Fire_NetworkEvent(new ProtocolHeader(instance, major, minor)); + needed = Frame.HEADER_SIZE; + return State.FRAME_HDR; + case State.FRAME_HDR: + reader = new BinaryReader(buf, Encoding.BigEndianUnicode); + flags = reader.ReadByte(); + type = SegmentTypeGetter.get(reader.ReadByte()); // generated code + int size = reader.ReadUInt16(); + size = ByteEncoder.GetBigEndian((UInt16)size); + size -= Frame.HEADER_SIZE; + if (size < 0 || size > (64 * 1024 - 12)) + { + Error("bad frame size: {0:d}", size); + return State.ERROR; + } + reader.ReadByte(); + byte b = reader.ReadByte(); + if ((b & 0xF0) != 0) + { + Error("non-zero reserved bits in upper nibble of " + + "frame header byte 5: {0}", b); + return State.ERROR; + } + track = (byte)(b & 0xF); + channel = reader.ReadUInt16(); + channel = ByteEncoder.GetBigEndian((UInt16)channel); + if (size == 0) + { + Fire_NetworkEvent(new Frame(flags, type, track, channel, 0, new MemoryStream())); + needed = Frame.HEADER_SIZE; + return State.FRAME_HDR; + } + needed = size; + return State.FRAME_BODY; + case State.FRAME_BODY: + Fire_NetworkEvent(new Frame(flags, type, track, channel, needed, buf)); + needed = Frame.HEADER_SIZE; + return State.FRAME_HDR; + default: + if (ExceptionProcessing != null) + { + ExceptionProcessing(this, new ExceptionArgs(new Exception("Error creating frame"))); + } + throw new Exception("Error creating frame"); + } + } + + private void Error(String fmt, params Object[] args) + { + Fire_NetworkEvent(new ProtocolError(Frame.L1, fmt, args)); + } + + private void Fire_NetworkEvent(NetworkEvent netevent) + { + log.debug("InputHandler: network event:", netevent); + ReceivedPayload<NetworkEvent> payload = new ReceivedPayload<NetworkEvent>(); + payload.Payload = netevent; + if (ReceivedEvent != null) + { + ReceivedEvent(this, payload); + } + else + { + log.debug("Nobody listening for event: {0}"); + } + } + + #endregion + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/NetworkDelegate.cs b/qpid/dotnet/client-010/client/transport/network/NetworkDelegate.cs index 9549f5c295..69598a43e8 100644 --- a/qpid/dotnet/client-010/client/transport/network/NetworkDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/network/NetworkDelegate.cs @@ -1,40 +1,40 @@ -/*
-*
-* 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 ProtocolError = org.apache.qpid.transport.ProtocolError;
-using ProtocolHeader = org.apache.qpid.transport.ProtocolHeader;
-namespace org.apache.qpid.transport.network
-{
-
-
- /// <summary>
- /// NetworkDelegate
- /// </summary>
-
- public interface NetworkDelegate
- {
-
- void Init(ProtocolHeader header);
-
- void Frame(Frame frame);
-
- void Error(ProtocolError error);
- }
+/* +* +* 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 ProtocolError = org.apache.qpid.transport.ProtocolError; +using ProtocolHeader = org.apache.qpid.transport.ProtocolHeader; +namespace org.apache.qpid.transport.network +{ + + + /// <summary> + /// NetworkDelegate + /// </summary> + + public interface NetworkDelegate + { + + void Init(ProtocolHeader header); + + void Frame(Frame frame); + + void Error(ProtocolError error); + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/NetworkEvent.cs b/qpid/dotnet/client-010/client/transport/network/NetworkEvent.cs index c682e77560..e5ac6de93a 100644 --- a/qpid/dotnet/client-010/client/transport/network/NetworkEvent.cs +++ b/qpid/dotnet/client-010/client/transport/network/NetworkEvent.cs @@ -1,32 +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.
-*
-*/
-namespace org.apache.qpid.transport.network
-{
-
- /// <summary>
- /// NetworkEvent
- /// </summary>
-
- public interface NetworkEvent
- {
- void ProcessNetworkEvent(NetworkDelegate networkDelegate);
- }
+/* +* +* 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.transport.network +{ + + /// <summary> + /// NetworkEvent + /// </summary> + + public interface NetworkEvent + { + void ProcessNetworkEvent(NetworkDelegate networkDelegate); + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs b/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs index aab017dad1..a409b6de4c 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs @@ -1,57 +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.IO;
-using System.Net.Sockets;
-
-namespace org.apache.qpid.transport.network.io
-{
- public interface IIoTransport
- {
- Connection Connection
- {
- get;
- set;
- }
-
- Receiver<ReceivedPayload<MemoryStream>> Receiver
- {
- get;
- set;
- }
-
- IoSender Sender
- {
- get;
- set;
- }
-
-
- Stream Stream
- {
- get;
- set;
- }
-
- TcpClient Socket
- {
- get;
- set;
- }
- }
-}
+/* +* 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.IO; +using System.Net.Sockets; + +namespace org.apache.qpid.transport.network.io +{ + public interface IIoTransport + { + Connection Connection + { + get; + set; + } + + Receiver<ReceivedPayload<MemoryStream>> Receiver + { + get; + set; + } + + IoSender Sender + { + get; + set; + } + + + Stream Stream + { + get; + set; + } + + TcpClient Socket + { + get; + set; + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs index 4c59cf0a6c..1cfba9e928 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs @@ -1,189 +1,189 @@ -/*
-*
-* 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.IO;
-using System.Threading;
-using Logger = org.apache.qpid.transport.util.Logger;
-
-
-namespace org.apache.qpid.transport.network.io
-{
- /// <summary>
- /// IoReceiver
- /// </summary>
- public sealed class IoReceiver : Receiver<ReceivedPayload<MemoryStream>>
- {
- private static readonly Logger log = Logger.get(typeof(IoReceiver));
- private readonly int m_bufferSize;
- private readonly Stream m_bufStream;
- private readonly int m_timeout;
- private readonly Thread m_thread;
- private bool m_closed;
- private readonly Object m_objectLock = new object();
-
- // the event raised when a buffer is read from the wire
- event EventHandler<ReceivedPayload<MemoryStream>> ReceivedBuffer;
- event EventHandler<ExceptionArgs> ExceptionReading;
- event EventHandler ReceiverClosed;
-
- event EventHandler<ReceivedPayload<MemoryStream>> Receiver<ReceivedPayload<MemoryStream>>.Received
- {
- add
- {
- lock (m_objectLock)
- {
- ReceivedBuffer += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- ReceivedBuffer -= value;
- }
- }
- }
-
- event EventHandler<ExceptionArgs> Receiver<ReceivedPayload<MemoryStream>>.Exception
- {
- add
- {
- lock (m_objectLock)
- {
- ExceptionReading += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- ExceptionReading -= value;
- }
- }
- }
-
- event EventHandler Receiver<ReceivedPayload<MemoryStream>>.Closed
- {
- add
- {
- lock (m_objectLock)
- {
- ReceiverClosed += value;
- }
- }
- remove
- {
- lock (m_objectLock)
- {
- ReceiverClosed -= value;
- }
- }
- }
-
- public IoReceiver(Stream stream, int bufferSize, int timeout)
- {
- m_bufferSize = bufferSize;
- m_bufStream = stream;
- m_timeout = timeout;
- m_thread = new Thread(Go);
- m_thread.Name = String.Format("IoReceiver - {0}", stream);
- m_thread.IsBackground = true;
- m_thread.Start();
- }
-
- public void close()
- {
- Mutex mut = new Mutex();
- mut.WaitOne();
- if (!m_closed)
- {
- m_closed = true;
- try
- {
- log.debug("Receiver closing");
- m_bufStream.Close();
- m_thread.Join(m_timeout);
- if (m_thread.IsAlive)
- {
- throw new TransportException("join timed out");
- }
- }
- catch (ThreadInterruptedException e)
- {
- throw new TransportException(e);
- }
- catch (IOException e)
- {
- throw new TransportException(e);
- }
- }
- mut.ReleaseMutex();
- }
-
- void Go()
- {
- // create a BufferedStream on top of the NetworkStream.
- int threshold = m_bufferSize/2;
- byte[] buffer = new byte[m_bufferSize];
- try
- {
- int read;
- int offset = 0;
- ReceivedPayload<MemoryStream> payload = new ReceivedPayload<MemoryStream>();
- while ((read = m_bufStream.Read(buffer, offset, m_bufferSize - offset)) > 0)
- {
- MemoryStream memStream = new MemoryStream(buffer, offset, read);
- if (ReceivedBuffer != null)
- {
- // call the event
- payload.Payload = memStream;
- ReceivedBuffer(this, payload);
- }
- offset += read;
- if (offset > threshold)
- {
- offset = 0;
- buffer = new byte[m_bufferSize];
- }
- }
- log.debug("Receiver thread terminating");
- }
- catch (IOException e)
- {
- // IOException is thrown when the socket is closed according to the docs
- }
- catch (Exception t)
- {
- if (ExceptionReading != null)
- {
- ExceptionReading(this, new ExceptionArgs(t));
- }
- }
- finally
- {
- if (ReceiverClosed != null)
- {
- ReceiverClosed(this, new EventArgs());
- }
- }
- }
- }
+/* +* +* 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.IO; +using System.Threading; +using Logger = org.apache.qpid.transport.util.Logger; + + +namespace org.apache.qpid.transport.network.io +{ + /// <summary> + /// IoReceiver + /// </summary> + public sealed class IoReceiver : Receiver<ReceivedPayload<MemoryStream>> + { + private static readonly Logger log = Logger.get(typeof(IoReceiver)); + private readonly int m_bufferSize; + private readonly Stream m_bufStream; + private readonly int m_timeout; + private readonly Thread m_thread; + private bool m_closed; + private readonly Object m_objectLock = new object(); + + // the event raised when a buffer is read from the wire + event EventHandler<ReceivedPayload<MemoryStream>> ReceivedBuffer; + event EventHandler<ExceptionArgs> ExceptionReading; + event EventHandler ReceiverClosed; + + event EventHandler<ReceivedPayload<MemoryStream>> Receiver<ReceivedPayload<MemoryStream>>.Received + { + add + { + lock (m_objectLock) + { + ReceivedBuffer += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedBuffer -= value; + } + } + } + + event EventHandler<ExceptionArgs> Receiver<ReceivedPayload<MemoryStream>>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionReading += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionReading -= value; + } + } + } + + event EventHandler Receiver<ReceivedPayload<MemoryStream>>.Closed + { + add + { + lock (m_objectLock) + { + ReceiverClosed += value; + } + } + remove + { + lock (m_objectLock) + { + ReceiverClosed -= value; + } + } + } + + public IoReceiver(Stream stream, int bufferSize, int timeout) + { + m_bufferSize = bufferSize; + m_bufStream = stream; + m_timeout = timeout; + m_thread = new Thread(Go); + m_thread.Name = String.Format("IoReceiver - {0}", stream); + m_thread.IsBackground = true; + m_thread.Start(); + } + + public void close() + { + Mutex mut = new Mutex(); + mut.WaitOne(); + if (!m_closed) + { + m_closed = true; + try + { + log.debug("Receiver closing"); + m_bufStream.Close(); + m_thread.Join(m_timeout); + if (m_thread.IsAlive) + { + throw new TransportException("join timed out"); + } + } + catch (ThreadInterruptedException e) + { + throw new TransportException(e); + } + catch (IOException e) + { + throw new TransportException(e); + } + } + mut.ReleaseMutex(); + } + + void Go() + { + // create a BufferedStream on top of the NetworkStream. + int threshold = m_bufferSize/2; + byte[] buffer = new byte[m_bufferSize]; + try + { + int read; + int offset = 0; + ReceivedPayload<MemoryStream> payload = new ReceivedPayload<MemoryStream>(); + while ((read = m_bufStream.Read(buffer, offset, m_bufferSize - offset)) > 0) + { + MemoryStream memStream = new MemoryStream(buffer, offset, read); + if (ReceivedBuffer != null) + { + // call the event + payload.Payload = memStream; + ReceivedBuffer(this, payload); + } + offset += read; + if (offset > threshold) + { + offset = 0; + buffer = new byte[m_bufferSize]; + } + } + log.debug("Receiver thread terminating"); + } + catch (IOException e) + { + // IOException is thrown when the socket is closed according to the docs + } + catch (Exception t) + { + if (ExceptionReading != null) + { + ExceptionReading(this, new ExceptionArgs(t)); + } + } + finally + { + if (ReceiverClosed != null) + { + ReceiverClosed(this, new EventArgs()); + } + } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs b/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs index 8c5f161a35..ad12e24ac6 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs @@ -1,194 +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.IO;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.network.io
-{
- public sealed class IoSSLTransport : IIoTransport
- {
- // constants
- private const int DEFAULT_READ_WRITE_BUFFER_SIZE = 64*1024;
- private const int TIMEOUT = 60000;
- private const int QUEUE_SIZE = 1000;
- // props
- private static readonly Logger log = Logger.get(typeof (IoSSLTransport));
- private Stream m_stream;
- private IoSender m_sender;
- private Receiver<ReceivedPayload<MemoryStream>> m_receiver;
- private TcpClient m_socket;
- private Connection m_con;
- private readonly bool _rejectUntrusted;
-
- public static Connection connect(String host, int port, string serverName, string certPath, bool rejectUntrusted, ConnectionDelegate conndel)
- {
- IIoTransport transport = new IoSSLTransport(host, port, serverName, certPath, rejectUntrusted, conndel);
- return transport.Connection;
- }
-
- public IoSSLTransport(String host, int port, string serverName, string certPath, bool rejectUntrusted, ConnectionDelegate conndel)
- {
- _rejectUntrusted = rejectUntrusted;
- createSocket(host, port, serverName, certPath);
- Sender = new IoSender(this, QUEUE_SIZE, TIMEOUT);
- Receiver = new IoReceiver(Stream, Socket.ReceiveBufferSize*2, TIMEOUT);
- Assembler assembler = new Assembler();
- InputHandler inputHandler = new InputHandler(InputHandler.State.PROTO_HDR);
- Connection = new Connection(assembler, new Disassembler(Sender, 64*1024 - 1), conndel);
- // Input handler listen to Receiver events
- Receiver.Received += inputHandler.On_ReceivedBuffer;
- // Assembler listen to inputhandler events
- inputHandler.ReceivedEvent += assembler.On_ReceivedEvent;
- // Connection listen to asembler protocol event
- Receiver.Closed += Connection.On_ReceivedClosed;
- Receiver.Exception += Connection.On_ReceivedException;
- inputHandler.HandlerClosed += Connection.On_ReceivedClosed;
- inputHandler.ExceptionProcessing += Connection.On_ReceivedException;
- assembler.HandlerClosed += Connection.On_ReceivedClosed;
- assembler.ExceptionProcessing += Connection.On_ReceivedException;
- assembler.ReceivedEvent += Connection.On_ReceivedEvent;
- }
-
- public Connection Connection
- {
- get { return m_con; }
- set { m_con = value; }
- }
-
- public Receiver<ReceivedPayload<MemoryStream>> Receiver
- {
- get { return m_receiver; }
- set { m_receiver = value; }
- }
-
- public IoSender Sender
- {
- get { return m_sender; }
- set { m_sender = value; }
- }
-
-
- public Stream Stream
- {
- get { return m_stream; }
- set { m_stream = value; }
- }
-
- public TcpClient Socket
- {
- get { return m_socket; }
- set { m_socket = value; }
- }
-
- #region Private Support Functions
-
- private void createSocket(String host, int port, string serverName, string certPath)
- {
- TcpClient socket;
- try
- {
- socket = new TcpClient();
- String noDelay = Environment.GetEnvironmentVariable("qpid.tcpNoDelay");
- String writeBufferSize = Environment.GetEnvironmentVariable("qpid.writeBufferSize");
- String readBufferSize = Environment.GetEnvironmentVariable("qpid.readBufferSize");
- socket.NoDelay = noDelay != null && bool.Parse(noDelay);
- socket.ReceiveBufferSize = readBufferSize == null
- ? DEFAULT_READ_WRITE_BUFFER_SIZE
- : int.Parse(readBufferSize);
- socket.SendBufferSize = writeBufferSize == null
- ? DEFAULT_READ_WRITE_BUFFER_SIZE
- : int.Parse(writeBufferSize);
-
- log.debug("NoDelay : {0}", socket.NoDelay);
- log.debug("ReceiveBufferSize : {0}", socket.ReceiveBufferSize);
- log.debug("SendBufferSize : {0}", socket.SendBufferSize);
- log.debug("Openning connection with host : {0}; port: {1}", host, port);
-
- socket.Connect(host, port);
- Socket = socket;
- }
- catch (Exception e)
- {
- throw new TransportException("Error connecting to broker", e);
- }
- try
- {
- //Initializes a new instance of the SslStream class using the specified Stream, stream closure behavior, certificate validation delegate and certificate selection delegate
- SslStream sslStream = new SslStream(socket.GetStream(), false, ValidateServerCertificate, LocalCertificateSelection);
- if (certPath != null)
- {
- X509CertificateCollection col = new X509CertificateCollection();
- X509Certificate cert = X509Certificate.CreateFromCertFile(certPath);
- col.Add(cert);
- sslStream.AuthenticateAsClient(serverName, col, SslProtocols.Default, true);
- }
- else
- {
- sslStream.AuthenticateAsClient(serverName);
- }
- Stream = sslStream;
- }
- catch (AuthenticationException e)
- {
- log.warn("Exception: {0}", e.Message);
- if (e.InnerException != null)
- {
- log.warn("Inner exception: {0}", e.InnerException.Message);
- }
- socket.Close();
- throw new TransportException("Authentication failed - closing the connection.");
- }
- }
-
- // The following method is invoked by the RemoteCertificateValidationDelegate.
- public bool ValidateServerCertificate(
- object sender,
- X509Certificate certificate,
- X509Chain chain,
- SslPolicyErrors sslPolicyErrors)
- {
- bool result = true;
- if (sslPolicyErrors != SslPolicyErrors.None && _rejectUntrusted )
- {
- log.warn("Certificate error: {0}", sslPolicyErrors);
- // Do not allow this client to communicate with unauthenticated servers.
- result = false;
- }
- return result;
- }
-
- public X509Certificate LocalCertificateSelection(
- Object sender,
- string targetHost,
- X509CertificateCollection localCertificates,
- X509Certificate remoteCertificate,
- string[] acceptableIssuers
- )
- {
- return remoteCertificate;
- }
-
- #endregion
- }
-}
+/* +* 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.IO; +using System.Net.Security; +using System.Net.Sockets; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.network.io +{ + public sealed class IoSSLTransport : IIoTransport + { + // constants + private const int DEFAULT_READ_WRITE_BUFFER_SIZE = 64*1024; + private const int TIMEOUT = 60000; + private const int QUEUE_SIZE = 1000; + // props + private static readonly Logger log = Logger.get(typeof (IoSSLTransport)); + private Stream m_stream; + private IoSender m_sender; + private Receiver<ReceivedPayload<MemoryStream>> m_receiver; + private TcpClient m_socket; + private Connection m_con; + private readonly bool _rejectUntrusted; + + public static Connection connect(String host, int port, string serverName, string certPath, bool rejectUntrusted, ConnectionDelegate conndel) + { + IIoTransport transport = new IoSSLTransport(host, port, serverName, certPath, rejectUntrusted, conndel); + return transport.Connection; + } + + public IoSSLTransport(String host, int port, string serverName, string certPath, bool rejectUntrusted, ConnectionDelegate conndel) + { + _rejectUntrusted = rejectUntrusted; + createSocket(host, port, serverName, certPath); + Sender = new IoSender(this, QUEUE_SIZE, TIMEOUT); + Receiver = new IoReceiver(Stream, Socket.ReceiveBufferSize*2, TIMEOUT); + Assembler assembler = new Assembler(); + InputHandler inputHandler = new InputHandler(InputHandler.State.PROTO_HDR); + Connection = new Connection(assembler, new Disassembler(Sender, 64*1024 - 1), conndel); + // Input handler listen to Receiver events + Receiver.Received += inputHandler.On_ReceivedBuffer; + // Assembler listen to inputhandler events + inputHandler.ReceivedEvent += assembler.On_ReceivedEvent; + // Connection listen to asembler protocol event + Receiver.Closed += Connection.On_ReceivedClosed; + Receiver.Exception += Connection.On_ReceivedException; + inputHandler.HandlerClosed += Connection.On_ReceivedClosed; + inputHandler.ExceptionProcessing += Connection.On_ReceivedException; + assembler.HandlerClosed += Connection.On_ReceivedClosed; + assembler.ExceptionProcessing += Connection.On_ReceivedException; + assembler.ReceivedEvent += Connection.On_ReceivedEvent; + } + + public Connection Connection + { + get { return m_con; } + set { m_con = value; } + } + + public Receiver<ReceivedPayload<MemoryStream>> Receiver + { + get { return m_receiver; } + set { m_receiver = value; } + } + + public IoSender Sender + { + get { return m_sender; } + set { m_sender = value; } + } + + + public Stream Stream + { + get { return m_stream; } + set { m_stream = value; } + } + + public TcpClient Socket + { + get { return m_socket; } + set { m_socket = value; } + } + + #region Private Support Functions + + private void createSocket(String host, int port, string serverName, string certPath) + { + TcpClient socket; + try + { + socket = new TcpClient(); + String noDelay = Environment.GetEnvironmentVariable("qpid.tcpNoDelay"); + String writeBufferSize = Environment.GetEnvironmentVariable("qpid.writeBufferSize"); + String readBufferSize = Environment.GetEnvironmentVariable("qpid.readBufferSize"); + socket.NoDelay = noDelay != null && bool.Parse(noDelay); + socket.ReceiveBufferSize = readBufferSize == null + ? DEFAULT_READ_WRITE_BUFFER_SIZE + : int.Parse(readBufferSize); + socket.SendBufferSize = writeBufferSize == null + ? DEFAULT_READ_WRITE_BUFFER_SIZE + : int.Parse(writeBufferSize); + + log.debug("NoDelay : {0}", socket.NoDelay); + log.debug("ReceiveBufferSize : {0}", socket.ReceiveBufferSize); + log.debug("SendBufferSize : {0}", socket.SendBufferSize); + log.debug("Openning connection with host : {0}; port: {1}", host, port); + + socket.Connect(host, port); + Socket = socket; + } + catch (Exception e) + { + throw new TransportException("Error connecting to broker", e); + } + try + { + //Initializes a new instance of the SslStream class using the specified Stream, stream closure behavior, certificate validation delegate and certificate selection delegate + SslStream sslStream = new SslStream(socket.GetStream(), false, ValidateServerCertificate, LocalCertificateSelection); + if (certPath != null) + { + X509CertificateCollection col = new X509CertificateCollection(); + X509Certificate cert = X509Certificate.CreateFromCertFile(certPath); + col.Add(cert); + sslStream.AuthenticateAsClient(serverName, col, SslProtocols.Default, true); + } + else + { + sslStream.AuthenticateAsClient(serverName); + } + Stream = sslStream; + } + catch (AuthenticationException e) + { + log.warn("Exception: {0}", e.Message); + if (e.InnerException != null) + { + log.warn("Inner exception: {0}", e.InnerException.Message); + } + socket.Close(); + throw new TransportException("Authentication failed - closing the connection."); + } + } + + // The following method is invoked by the RemoteCertificateValidationDelegate. + public bool ValidateServerCertificate( + object sender, + X509Certificate certificate, + X509Chain chain, + SslPolicyErrors sslPolicyErrors) + { + bool result = true; + if (sslPolicyErrors != SslPolicyErrors.None && _rejectUntrusted ) + { + log.warn("Certificate error: {0}", sslPolicyErrors); + // Do not allow this client to communicate with unauthenticated servers. + result = false; + } + return result; + } + + public X509Certificate LocalCertificateSelection( + Object sender, + string targetHost, + X509CertificateCollection localCertificates, + X509Certificate remoteCertificate, + string[] acceptableIssuers + ) + { + return remoteCertificate; + } + + #endregion + } +} diff --git a/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs b/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs index 924d871dd2..4ae74bf787 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs @@ -1,134 +1,134 @@ -/*
-* 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.IO;
-using System.Threading;
-using common.org.apache.qpid.transport.util;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.network.io
-{
- public sealed class IoSender : IIOSender<MemoryStream>
- {
- private static readonly Logger log = Logger.get(typeof (IoReceiver));
- private readonly Stream bufStream;
- private bool closed;
- private readonly Mutex mutClosed = new Mutex();
- private readonly CircularBuffer<byte[]> queue;
- private readonly Thread thread;
- private readonly int timeout;
- private readonly MemoryStream _tobeSent = new MemoryStream();
- public IoSender(IIoTransport transport, int queueSize, int timeout)
- {
- this.timeout = timeout;
- bufStream = transport.Stream;
- queue = new CircularBuffer<byte[]>(queueSize);
- thread = new Thread(Go);
- log.debug("Creating IoSender thread");
- thread.Name = String.Format("IoSender - {0}", transport.Socket) ;
- thread.IsBackground = true;
- thread.Start();
- }
-
- public void send(MemoryStream str)
- {
- int pos = (int) str.Position;
- str.Seek(0, SeekOrigin.Begin);
- send(str, pos);
- }
-
- public void send(MemoryStream str, int size)
- {
- mutClosed.WaitOne();
- if (closed)
- {
- throw new TransportException("sender is closed");
- }
- mutClosed.ReleaseMutex();
- byte[] buf = new byte[size];
- str.Read(buf, 0, size);
- _tobeSent.Write(buf, 0, size);
- }
-
- public void flush()
- {
- int length = (int)_tobeSent.Position;
- byte[] buf = new byte[length];
- _tobeSent.Seek(0, SeekOrigin.Begin);
- _tobeSent.Read(buf, 0, length);
- queue.Enqueue(buf);
- // bufStream.Write(buf, 0, length);
- // _tobeSent = new MemoryStream();
- // _writer.Write(buf, 0, length);
- // _writer.Flush();
- _tobeSent.Seek(0, SeekOrigin.Begin);
- }
-
- public void close()
- {
- log.debug("Closing Sender");
- mutClosed.WaitOne();
- if (!closed)
- {
- try
- {
- closed = true;
- queue.close();
- thread.Join(timeout);
- if (thread.IsAlive)
- {
- throw new TransportException("join timed out");
- }
- }
- catch (ThreadInterruptedException e)
- {
- throw new TransportException(e);
- }
- catch (IOException e)
- {
- throw new TransportException(e);
- }
- }
- mutClosed.ReleaseMutex();
- }
-
- private void Go()
- {
- while (! closed)
- {
- //MemoryStream st = queue.Dequeue();
- byte[] st = queue.Dequeue();
- if (st != null)
- {
- try
- {
- // int length = (int) st.Length;
- // byte[] buf = new byte[length];
- // st.Read(buf, 0, length);
- bufStream.Write(st, 0, st.Length);
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- }
- }
- }
- }
+/* +* 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.IO; +using System.Threading; +using common.org.apache.qpid.transport.util; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.network.io +{ + public sealed class IoSender : IIOSender<MemoryStream> + { + private static readonly Logger log = Logger.get(typeof (IoReceiver)); + private readonly Stream bufStream; + private bool closed; + private readonly Mutex mutClosed = new Mutex(); + private readonly CircularBuffer<byte[]> queue; + private readonly Thread thread; + private readonly int timeout; + private readonly MemoryStream _tobeSent = new MemoryStream(); + public IoSender(IIoTransport transport, int queueSize, int timeout) + { + this.timeout = timeout; + bufStream = transport.Stream; + queue = new CircularBuffer<byte[]>(queueSize); + thread = new Thread(Go); + log.debug("Creating IoSender thread"); + thread.Name = String.Format("IoSender - {0}", transport.Socket) ; + thread.IsBackground = true; + thread.Start(); + } + + public void send(MemoryStream str) + { + int pos = (int) str.Position; + str.Seek(0, SeekOrigin.Begin); + send(str, pos); + } + + public void send(MemoryStream str, int size) + { + mutClosed.WaitOne(); + if (closed) + { + throw new TransportException("sender is closed"); + } + mutClosed.ReleaseMutex(); + byte[] buf = new byte[size]; + str.Read(buf, 0, size); + _tobeSent.Write(buf, 0, size); + } + + public void flush() + { + int length = (int)_tobeSent.Position; + byte[] buf = new byte[length]; + _tobeSent.Seek(0, SeekOrigin.Begin); + _tobeSent.Read(buf, 0, length); + queue.Enqueue(buf); + // bufStream.Write(buf, 0, length); + // _tobeSent = new MemoryStream(); + // _writer.Write(buf, 0, length); + // _writer.Flush(); + _tobeSent.Seek(0, SeekOrigin.Begin); + } + + public void close() + { + log.debug("Closing Sender"); + mutClosed.WaitOne(); + if (!closed) + { + try + { + closed = true; + queue.close(); + thread.Join(timeout); + if (thread.IsAlive) + { + throw new TransportException("join timed out"); + } + } + catch (ThreadInterruptedException e) + { + throw new TransportException(e); + } + catch (IOException e) + { + throw new TransportException(e); + } + } + mutClosed.ReleaseMutex(); + } + + private void Go() + { + while (! closed) + { + //MemoryStream st = queue.Dequeue(); + byte[] st = queue.Dequeue(); + if (st != null) + { + try + { + // int length = (int) st.Length; + // byte[] buf = new byte[length]; + // st.Read(buf, 0, length); + bufStream.Write(st, 0, st.Length); + } + catch (Exception e) + { + Console.WriteLine(e); + } + } + } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs b/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs index 3a2397870d..8e48ea33fd 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs @@ -1,143 +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.
-*/
-using System;
-using System.IO;
-using System.Net.Sockets;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.transport.network.io
-{
- /// <summary>
- /// This class provides a socket based transport using sync io classes.
- ///
- /// The following params are configurable via JVM arguments
- /// TCP_NO_DELAY - qpid.tcpNoDelay
- /// SO_RCVBUF - qpid.readBufferSize
- /// SO_SNDBUF - qpid.writeBufferSize
- /// </summary>
- public sealed class IoTransport : IIoTransport
- {
- // constants
- private const int DEFAULT_READ_WRITE_BUFFER_SIZE = 64*1024;
- private const int TIMEOUT = 60000;
- private const int QUEUE_SIZE = 1000;
- // props
- private static readonly Logger log = Logger.get(typeof (IoTransport));
- private Stream m_stream;
- private IoSender m_sender;
- private Receiver<ReceivedPayload<MemoryStream>> m_receiver;
- private TcpClient m_socket;
- private Connection m_con;
-
- public static Connection connect(String host, int port, ConnectionDelegate conndel)
- {
- IoTransport transport = new IoTransport(host, port, conndel);
- return transport.Connection;
- }
-
- public IoTransport(String host, int port, ConnectionDelegate conndel)
- {
- createSocket(host, port);
- Sender = new IoSender(this, QUEUE_SIZE, TIMEOUT);
- Receiver = new IoReceiver(Stream, Socket.ReceiveBufferSize * 2, TIMEOUT);
- Assembler assembler = new Assembler();
- InputHandler inputHandler = new InputHandler(InputHandler.State.PROTO_HDR);
- Connection = new Connection(assembler, new Disassembler(Sender, 64 * 1024 - 1), conndel);
- // Input handler listen to Receiver events
- Receiver.Received += inputHandler.On_ReceivedBuffer;
- // Assembler listen to inputhandler events
- inputHandler.ReceivedEvent += assembler.On_ReceivedEvent;
- // Connection listen to asembler protocol event
- Receiver.Closed += Connection.On_ReceivedClosed;
- Receiver.Exception += Connection.On_ReceivedException;
- inputHandler.HandlerClosed += Connection.On_ReceivedClosed;
- inputHandler.ExceptionProcessing += Connection.On_ReceivedException;
- assembler.HandlerClosed += Connection.On_ReceivedClosed;
- assembler.ExceptionProcessing += Connection.On_ReceivedException;
- assembler.ReceivedEvent += Connection.On_ReceivedEvent;
- }
-
- public Connection Connection
- {
- get { return m_con; }
- set { m_con = value; }
- }
-
- public Receiver<ReceivedPayload<MemoryStream>> Receiver
- {
- get { return m_receiver; }
- set { m_receiver = value; }
- }
-
- public IoSender Sender
- {
- get { return m_sender; }
- set { m_sender = value; }
- }
-
-
- public Stream Stream
- {
- get { return m_stream; }
- set { m_stream = value; }
- }
-
- public TcpClient Socket
- {
- get { return m_socket; }
- set { m_socket = value; }
- }
-
- #region Private Support Functions
-
- private void createSocket(String host, int port)
- {
- try
- {
- TcpClient socket = new TcpClient();
- String noDelay = Environment.GetEnvironmentVariable("qpid.tcpNoDelay");
- String writeBufferSize = Environment.GetEnvironmentVariable("qpid.writeBufferSize");
- String readBufferSize = Environment.GetEnvironmentVariable("qpid.readBufferSize");
- socket.NoDelay = noDelay != null && bool.Parse(noDelay);
- socket.ReceiveBufferSize = readBufferSize == null ? DEFAULT_READ_WRITE_BUFFER_SIZE : int.Parse(readBufferSize);
- socket.SendBufferSize = writeBufferSize == null ? DEFAULT_READ_WRITE_BUFFER_SIZE : int.Parse(writeBufferSize);
-
- log.debug("NoDelay : {0}", socket.NoDelay);
- log.debug("ReceiveBufferSize : {0}", socket.ReceiveBufferSize);
- log.debug("SendBufferSize : {0}", socket.SendBufferSize);
- log.debug("Openning connection with host : {0}; port: {1}", host, port);
-
- socket.Connect(host, port);
- Socket = socket;
- Stream = socket.GetStream();
- }
- catch (SocketException e)
- {
- Console.WriteLine(e.StackTrace);
- throw new TransportException("Error connecting to broker", e);
- }
- catch (IOException e)
- {
- throw new TransportException("Error connecting to broker", e);
- }
- }
-
- #endregion
- }
+/* +* 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.IO; +using System.Net.Sockets; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.network.io +{ + /// <summary> + /// This class provides a socket based transport using sync io classes. + /// + /// The following params are configurable via JVM arguments + /// TCP_NO_DELAY - qpid.tcpNoDelay + /// SO_RCVBUF - qpid.readBufferSize + /// SO_SNDBUF - qpid.writeBufferSize + /// </summary> + public sealed class IoTransport : IIoTransport + { + // constants + private const int DEFAULT_READ_WRITE_BUFFER_SIZE = 64*1024; + private const int TIMEOUT = 60000; + private const int QUEUE_SIZE = 1000; + // props + private static readonly Logger log = Logger.get(typeof (IoTransport)); + private Stream m_stream; + private IoSender m_sender; + private Receiver<ReceivedPayload<MemoryStream>> m_receiver; + private TcpClient m_socket; + private Connection m_con; + + public static Connection connect(String host, int port, ConnectionDelegate conndel) + { + IoTransport transport = new IoTransport(host, port, conndel); + return transport.Connection; + } + + public IoTransport(String host, int port, ConnectionDelegate conndel) + { + createSocket(host, port); + Sender = new IoSender(this, QUEUE_SIZE, TIMEOUT); + Receiver = new IoReceiver(Stream, Socket.ReceiveBufferSize * 2, TIMEOUT); + Assembler assembler = new Assembler(); + InputHandler inputHandler = new InputHandler(InputHandler.State.PROTO_HDR); + Connection = new Connection(assembler, new Disassembler(Sender, 64 * 1024 - 1), conndel); + // Input handler listen to Receiver events + Receiver.Received += inputHandler.On_ReceivedBuffer; + // Assembler listen to inputhandler events + inputHandler.ReceivedEvent += assembler.On_ReceivedEvent; + // Connection listen to asembler protocol event + Receiver.Closed += Connection.On_ReceivedClosed; + Receiver.Exception += Connection.On_ReceivedException; + inputHandler.HandlerClosed += Connection.On_ReceivedClosed; + inputHandler.ExceptionProcessing += Connection.On_ReceivedException; + assembler.HandlerClosed += Connection.On_ReceivedClosed; + assembler.ExceptionProcessing += Connection.On_ReceivedException; + assembler.ReceivedEvent += Connection.On_ReceivedEvent; + } + + public Connection Connection + { + get { return m_con; } + set { m_con = value; } + } + + public Receiver<ReceivedPayload<MemoryStream>> Receiver + { + get { return m_receiver; } + set { m_receiver = value; } + } + + public IoSender Sender + { + get { return m_sender; } + set { m_sender = value; } + } + + + public Stream Stream + { + get { return m_stream; } + set { m_stream = value; } + } + + public TcpClient Socket + { + get { return m_socket; } + set { m_socket = value; } + } + + #region Private Support Functions + + private void createSocket(String host, int port) + { + try + { + TcpClient socket = new TcpClient(); + String noDelay = Environment.GetEnvironmentVariable("qpid.tcpNoDelay"); + String writeBufferSize = Environment.GetEnvironmentVariable("qpid.writeBufferSize"); + String readBufferSize = Environment.GetEnvironmentVariable("qpid.readBufferSize"); + socket.NoDelay = noDelay != null && bool.Parse(noDelay); + socket.ReceiveBufferSize = readBufferSize == null ? DEFAULT_READ_WRITE_BUFFER_SIZE : int.Parse(readBufferSize); + socket.SendBufferSize = writeBufferSize == null ? DEFAULT_READ_WRITE_BUFFER_SIZE : int.Parse(writeBufferSize); + + log.debug("NoDelay : {0}", socket.NoDelay); + log.debug("ReceiveBufferSize : {0}", socket.ReceiveBufferSize); + log.debug("SendBufferSize : {0}", socket.SendBufferSize); + log.debug("Openning connection with host : {0}; port: {1}", host, port); + + socket.Connect(host, port); + Socket = socket; + Stream = socket.GetStream(); + } + catch (SocketException e) + { + Console.WriteLine(e.StackTrace); + throw new TransportException("Error connecting to broker", e); + } + catch (IOException e) + { + throw new TransportException("Error connecting to broker", e); + } + } + + #endregion + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs index c900e3adae..66d40d554a 100644 --- a/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs @@ -1,218 +1,218 @@ -/*
-*
-* 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;
-
-namespace org.apache.qpid.transport.util
-{
- public static class ByteEncoder
- {
- #region Endian conversion helper routines
- /// <summary>
- /// Returns the value encoded in Big Endian (PPC, XDR) format.
- /// </summary>
- /// <param name="value">Value to encode.</param>
- /// <returns>Big-endian encoded value.</returns>
- public static Int32 GetBigEndian(Int32 value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return swapByteOrder(value);
- }
- return value;
- }
-
- /// <summary>
- /// Returns the value encoded in Big Endian (PPC, XDR) format.
- /// </summary>
- /// <param name="value">Value to encode.</param>
- /// <returns>Big-endian encoded value.</returns>
- public static UInt16 GetBigEndian(UInt16 value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return swapByteOrder(value);
- }
- return value;
- }
-
- /// <summary>
- /// Returns the value encoded in Big Endian (PPC, XDR) format.
- /// </summary>
- /// <param name="value">Value to encode.</param>
- /// <returns>Big-endian encoded value.</returns>
- public static UInt32 GetBigEndian(UInt32 value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return swapByteOrder(value);
- }
- return value;
- }
-
- /// <summary>
- /// Returns the value encoded in Big Endian (PPC, XDR) format.
- /// </summary>
- /// <param name="value">Value to encode.</param>
- /// <returns>Big-endian encoded value.</returns>
- public static long GetBigEndian(long value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return swapByteOrder(value);
- }
- return value;
- }
-
- public static double GetBigEndian(double value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return swapByteOrder(value);
- }
- return value;
- }
-
- /// <summary>
- /// Returns the value encoded in Little Endian (x86, NDR) format.
- /// </summary>
- /// <param name="value">Value to encode.</param>
- /// <returns>Little-endian encoded value.</returns>
- public static Int32 GetLittleEndian(Int32 value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return value;
- }
- return swapByteOrder(value);
- }
-
- /// <summary>
- /// Returns the value encoded in Little Endian (x86, NDR) format.
- /// </summary>
- /// <param name="value">Value to encode.</param>
- /// <returns>Little-endian encoded value.</returns>
- public static UInt32 GetLittleEndian(UInt32 value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return value;
- }
- return swapByteOrder(value);
- }
-
- /// <summary>
- /// Returns the value encoded in Little Endian (x86, NDR) format.
- /// </summary>
- /// <param name="value">Value to encode.</param>
- /// <returns>Little-endian encoded value.</returns>
- public static UInt16 GetLittleEndian(UInt16 value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return value;
- }
- return swapByteOrder(value);
- }
-
- /// <summary>
- /// Returns the value encoded in Little Endian (x86, NDR) format.
- /// </summary>
- /// <param name="value">Value to encode.</param>
- /// <returns>Little-endian encoded value.</returns>
- public static long GetLittleEndian(long value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return value;
- }
- return swapByteOrder(value);
- }
-
- public static double GetLittleEndian(double value)
- {
- if (BitConverter.IsLittleEndian)
- {
- return value;
- }
- return swapByteOrder(value);
- }
-
- /// <summary>
- /// Swaps the Byte order of an <see cref="Int32"/>.
- /// </summary>
- /// <param name="value"><see cref="Int32"/> to swap the bytes of.</param>
- /// <returns>Byte order swapped <see cref="Int32"/>.</returns>
- private static Int32 swapByteOrder(Int32 value)
- {
- Int32 swapped = (Int32)((0x000000FF) & (value >> 24)
- | (0x0000FF00) & (value >> 8)
- | (0x00FF0000) & (value << 8)
- | (0xFF000000) & (value << 24));
- return swapped;
- }
-
- /// <summary>
- /// Swaps the byte order of a <see cref="UInt16"/>.
- /// </summary>
- /// <param name="value"><see cref="UInt16"/> to swap the bytes of.</param>
- /// <returns>Byte order swapped <see cref="UInt16"/>.</returns>
- private static UInt16 swapByteOrder(UInt16 value)
- {
- return (UInt16)((0x00FF & (value >> 8))
- | (0xFF00 & (value << 8)));
- }
-
- /// <summary>
- /// Swaps the byte order of a <see cref="UInt32"/>.
- /// </summary>
- /// <param name="value"><see cref="UInt32"/> to swap the bytes of.</param>
- /// <returns>Byte order swapped <see cref="UInt32"/>.</returns>
- private static UInt32 swapByteOrder(UInt32 value)
- {
- UInt32 swapped = ((0x000000FF) & (value >> 24)
- | (0x0000FF00) & (value >> 8)
- | (0x00FF0000) & (value << 8)
- | (0xFF000000) & (value << 24));
- return swapped;
- }
-
- /// <summary>
- /// Swaps the byte order of a <see cref="Double"/> (double precision IEEE 754)
- /// </summary>
- /// <param name="value"><see cref="Double"/> to swap.</param>
- /// <returns>Byte order swapped <see cref="Double"/> value.</returns>
- private static long swapByteOrder(long value)
- {
- Byte[] buffer = BitConverter.GetBytes(value);
- Array.Reverse(buffer, 0, buffer.Length);
- return BitConverter.ToInt64(buffer, 0);
- }
-
- private static double swapByteOrder(double value)
- {
- Byte[] buffer = BitConverter.GetBytes(value);
- Array.Reverse(buffer, 0, buffer.Length);
- return BitConverter.ToDouble(buffer,0) ;
- }
- #endregion
- }
-
-}
+/* +* +* 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; + +namespace org.apache.qpid.transport.util +{ + public static class ByteEncoder + { + #region Endian conversion helper routines + /// <summary> + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// </summary> + /// <param name="value">Value to encode.</param> + /// <returns>Big-endian encoded value.</returns> + public static Int32 GetBigEndian(Int32 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } + + /// <summary> + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// </summary> + /// <param name="value">Value to encode.</param> + /// <returns>Big-endian encoded value.</returns> + public static UInt16 GetBigEndian(UInt16 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } + + /// <summary> + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// </summary> + /// <param name="value">Value to encode.</param> + /// <returns>Big-endian encoded value.</returns> + public static UInt32 GetBigEndian(UInt32 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } + + /// <summary> + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// </summary> + /// <param name="value">Value to encode.</param> + /// <returns>Big-endian encoded value.</returns> + public static long GetBigEndian(long value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } + + public static double GetBigEndian(double value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } + + /// <summary> + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// </summary> + /// <param name="value">Value to encode.</param> + /// <returns>Little-endian encoded value.</returns> + public static Int32 GetLittleEndian(Int32 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } + + /// <summary> + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// </summary> + /// <param name="value">Value to encode.</param> + /// <returns>Little-endian encoded value.</returns> + public static UInt32 GetLittleEndian(UInt32 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } + + /// <summary> + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// </summary> + /// <param name="value">Value to encode.</param> + /// <returns>Little-endian encoded value.</returns> + public static UInt16 GetLittleEndian(UInt16 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } + + /// <summary> + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// </summary> + /// <param name="value">Value to encode.</param> + /// <returns>Little-endian encoded value.</returns> + public static long GetLittleEndian(long value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } + + public static double GetLittleEndian(double value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } + + /// <summary> + /// Swaps the Byte order of an <see cref="Int32"/>. + /// </summary> + /// <param name="value"><see cref="Int32"/> to swap the bytes of.</param> + /// <returns>Byte order swapped <see cref="Int32"/>.</returns> + private static Int32 swapByteOrder(Int32 value) + { + Int32 swapped = (Int32)((0x000000FF) & (value >> 24) + | (0x0000FF00) & (value >> 8) + | (0x00FF0000) & (value << 8) + | (0xFF000000) & (value << 24)); + return swapped; + } + + /// <summary> + /// Swaps the byte order of a <see cref="UInt16"/>. + /// </summary> + /// <param name="value"><see cref="UInt16"/> to swap the bytes of.</param> + /// <returns>Byte order swapped <see cref="UInt16"/>.</returns> + private static UInt16 swapByteOrder(UInt16 value) + { + return (UInt16)((0x00FF & (value >> 8)) + | (0xFF00 & (value << 8))); + } + + /// <summary> + /// Swaps the byte order of a <see cref="UInt32"/>. + /// </summary> + /// <param name="value"><see cref="UInt32"/> to swap the bytes of.</param> + /// <returns>Byte order swapped <see cref="UInt32"/>.</returns> + private static UInt32 swapByteOrder(UInt32 value) + { + UInt32 swapped = ((0x000000FF) & (value >> 24) + | (0x0000FF00) & (value >> 8) + | (0x00FF0000) & (value << 8) + | (0xFF000000) & (value << 24)); + return swapped; + } + + /// <summary> + /// Swaps the byte order of a <see cref="Double"/> (double precision IEEE 754) + /// </summary> + /// <param name="value"><see cref="Double"/> to swap.</param> + /// <returns>Byte order swapped <see cref="Double"/> value.</returns> + private static long swapByteOrder(long value) + { + Byte[] buffer = BitConverter.GetBytes(value); + Array.Reverse(buffer, 0, buffer.Length); + return BitConverter.ToInt64(buffer, 0); + } + + private static double swapByteOrder(double value) + { + Byte[] buffer = BitConverter.GetBytes(value); + Array.Reverse(buffer, 0, buffer.Length); + return BitConverter.ToDouble(buffer,0) ; + } + #endregion + } + +} diff --git a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs index 05c26bcc49..ef31a6ead2 100644 --- a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs +++ b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs @@ -1,132 +1,132 @@ -/*
-*
-* 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.Threading;
-
-namespace common.org.apache.qpid.transport.util
-{
- public class CircularBuffer<T>
- {
- private readonly T[] buffer;
- private Int32 nrp, nwp;
- private readonly Int32 len;
- private Int32 countValue;
- private readonly Int32 add;
-
-
- /// <summary>
- /// Constructor creates N=len element
- /// Circular Buffer that olds MemoryStream
- /// </summary>
- public CircularBuffer(Int32 len)
- {
- buffer = new T[len];
- this.len = len;
- add = 1 - len;
- nrp = 0;
- nwp = 0;
- countValue = 0;
- }
-
-
- public void Enqueue(T t)
- {
- lock (this)
- {
- if (countValue >= (len - 1))
- {
- // wait for room to be available
- Monitor.Wait(this);
- }
- bool notifyDequeue = countValue <= 0;
- load(t);
- if (notifyDequeue) //notifyDequeue)
- {
- Monitor.PulseAll(this);
- }
- }
- }
-
-
- public T Dequeue()
- {
- lock (this)
- {
- if (countValue <= 0)
- {
- Monitor.Wait(this);
- }
- bool notifyEnqueue = countValue >= (len - 1);
- T temp = get();
- if (notifyEnqueue) //notifyEnqueue)
- {
- Monitor.PulseAll(this);
- }
- return temp;
- }
- }
-
- public void close()
- {
- nrp = 0;
- nwp = 0;
- countValue = 0;
- Array.Clear(buffer, 0, len);
- lock (this)
- {
- Monitor.PulseAll(this);
- }
- }
-
- #region Private Support Functions
-
- private void load(T t)
- {
- Int32 i = nwp;
- buffer[i] = t;
- i += add;
- if (i < 0) i += len;
- nwp = i;
- updateCount();
- }
-
- private void updateCount()
- {
- countValue = nwp - nrp;
- if (countValue <= 0 )
- countValue += len; // modulo buffer size
- }
-
- private T get()
- {
- Int32 i = nrp;
- T temp = buffer[i];
- i += add;
- if (i < 0) i += len;
- nrp = i;
- countValue--;
- return (temp);
- }
-
- #endregion
- }
-}
+/* +* +* 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.Threading; + +namespace common.org.apache.qpid.transport.util +{ + public class CircularBuffer<T> + { + private readonly T[] buffer; + private Int32 nrp, nwp; + private readonly Int32 len; + private Int32 countValue; + private readonly Int32 add; + + + /// <summary> + /// Constructor creates N=len element + /// Circular Buffer that olds MemoryStream + /// </summary> + public CircularBuffer(Int32 len) + { + buffer = new T[len]; + this.len = len; + add = 1 - len; + nrp = 0; + nwp = 0; + countValue = 0; + } + + + public void Enqueue(T t) + { + lock (this) + { + if (countValue >= (len - 1)) + { + // wait for room to be available + Monitor.Wait(this); + } + bool notifyDequeue = countValue <= 0; + load(t); + if (notifyDequeue) //notifyDequeue) + { + Monitor.PulseAll(this); + } + } + } + + + public T Dequeue() + { + lock (this) + { + if (countValue <= 0) + { + Monitor.Wait(this); + } + bool notifyEnqueue = countValue >= (len - 1); + T temp = get(); + if (notifyEnqueue) //notifyEnqueue) + { + Monitor.PulseAll(this); + } + return temp; + } + } + + public void close() + { + nrp = 0; + nwp = 0; + countValue = 0; + Array.Clear(buffer, 0, len); + lock (this) + { + Monitor.PulseAll(this); + } + } + + #region Private Support Functions + + private void load(T t) + { + Int32 i = nwp; + buffer[i] = t; + i += add; + if (i < 0) i += len; + nwp = i; + updateCount(); + } + + private void updateCount() + { + countValue = nwp - nrp; + if (countValue <= 0 ) + countValue += len; // modulo buffer size + } + + private T get() + { + Int32 i = nrp; + T temp = buffer[i]; + i += add; + if (i < 0) i += len; + nrp = i; + countValue--; + return (temp); + } + + #endregion + } +} diff --git a/qpid/dotnet/client-010/client/transport/util/Functions.cs b/qpid/dotnet/client-010/client/transport/util/Functions.cs index f5777d8ee9..63ef9ddcaf 100644 --- a/qpid/dotnet/client-010/client/transport/util/Functions.cs +++ b/qpid/dotnet/client-010/client/transport/util/Functions.cs @@ -1,41 +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.
-*
-*/
-
-namespace org.apache.qpid.transport.util
-{
-
- /// <summary>
- /// Functions
- /// </summary>
-
- public class Functions
- {
- public static sbyte lsb(int i)
- {
- return (sbyte) (0xFF & i);
- }
-
- public static sbyte lsb(long l)
- {
- return (sbyte) (0xFF & l);
- }
- }
+/* +* +* 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.transport.util +{ + + /// <summary> + /// Functions + /// </summary> + + public class Functions + { + public static sbyte lsb(int i) + { + return (sbyte) (0xFF & i); + } + + public static sbyte lsb(long l) + { + return (sbyte) (0xFF & l); + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/util/Logger.cs b/qpid/dotnet/client-010/client/transport/util/Logger.cs index 04473575c2..b87f97dd53 100644 --- a/qpid/dotnet/client-010/client/transport/util/Logger.cs +++ b/qpid/dotnet/client-010/client/transport/util/Logger.cs @@ -1,114 +1,114 @@ -/*
-*
-* 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 log4net;
-
-namespace org.apache.qpid.transport.util
-{
-
- /// <summary> Logger
- ///
- /// </summary>
-
- public sealed class Logger
- {
- private readonly ILog log;
-
- public static Logger get(Type type)
- {
- return new Logger(LogManager.GetLogger(type));
- }
-
- private Logger(ILog log)
- {
- this.log = log;
- }
-
- public bool isDebugEnabled()
- {
- return log.IsDebugEnabled;
- }
-
- public void debug(String message, params Object[] args)
- {
- if (log.IsDebugEnabled)
- {
- log.Debug(String.Format(message, args));
- }
- }
-
- public void debug(Exception t, String message, params Object[] args)
- {
- if (log.IsDebugEnabled)
- {
- log.Debug(String.Format(message, args), t);
- }
- }
-
- public void error(String message, params Object[] args)
- {
- if (log.IsErrorEnabled)
- {
- log.Error(String.Format(message, args));
- }
- }
-
- public void error(Exception t, String message, params Object[] args)
- {
- if (log.IsErrorEnabled)
- {
- log.Error(String.Format(message, args), t);
- }
- }
-
- public void warn(String message, params Object[] args)
- {
- if (log.IsWarnEnabled)
- {
- log.Warn(String.Format(message, args));
- }
- }
-
- public void warn(Exception t, String message, params Object[] args)
- {
- if (log.IsWarnEnabled)
- {
- log.Warn(String.Format(message, args), t);
- }
- }
-
- public void info(String message, params Object[] args)
- {
- if (log.IsInfoEnabled)
- {
- log.Info(String.Format(message, args));
- }
- }
-
- public void info(Exception t, String message, params Object[] args)
- {
- if (log.IsInfoEnabled)
- {
- log.Info(String.Format(message, args), t);
- }
- }
- }
+/* +* +* 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 log4net; + +namespace org.apache.qpid.transport.util +{ + + /// <summary> Logger + /// + /// </summary> + + public sealed class Logger + { + private readonly ILog log; + + public static Logger get(Type type) + { + return new Logger(LogManager.GetLogger(type)); + } + + private Logger(ILog log) + { + this.log = log; + } + + public bool isDebugEnabled() + { + return log.IsDebugEnabled; + } + + public void debug(String message, params Object[] args) + { + if (log.IsDebugEnabled) + { + log.Debug(String.Format(message, args)); + } + } + + public void debug(Exception t, String message, params Object[] args) + { + if (log.IsDebugEnabled) + { + log.Debug(String.Format(message, args), t); + } + } + + public void error(String message, params Object[] args) + { + if (log.IsErrorEnabled) + { + log.Error(String.Format(message, args)); + } + } + + public void error(Exception t, String message, params Object[] args) + { + if (log.IsErrorEnabled) + { + log.Error(String.Format(message, args), t); + } + } + + public void warn(String message, params Object[] args) + { + if (log.IsWarnEnabled) + { + log.Warn(String.Format(message, args)); + } + } + + public void warn(Exception t, String message, params Object[] args) + { + if (log.IsWarnEnabled) + { + log.Warn(String.Format(message, args), t); + } + } + + public void info(String message, params Object[] args) + { + if (log.IsInfoEnabled) + { + log.Info(String.Format(message, args)); + } + } + + public void info(Exception t, String message, params Object[] args) + { + if (log.IsInfoEnabled) + { + log.Info(String.Format(message, args), t); + } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/util/Serial.cs b/qpid/dotnet/client-010/client/transport/util/Serial.cs index e47a6745a5..5dee37e686 100644 --- a/qpid/dotnet/client-010/client/transport/util/Serial.cs +++ b/qpid/dotnet/client-010/client/transport/util/Serial.cs @@ -1,94 +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.
-*
-*/
-namespace org.apache.qpid.transport.util
-{
- /// <summary>
- /// This class provides basic serial number comparisons as defined in
- /// RFC 1982.
- /// </summary>
- public class Serial
- {
- ///
- ///
- ///Compares two numbers using serial arithmetic.
- ///
- /// param s1 the first serial number
- /// param s2 the second serial number
- ///
- /// return a negative integer, zero, or a positive integer as the
- /// first argument is less than, equal to, or greater than the
- /// second
- ///
- public static int compare(int s1, int s2)
- {
- return s1 - s2;
- }
-
- public static bool lt(int s1, int s2)
- {
- return compare(s1, s2) < 0;
- }
-
- public static bool le(int s1, int s2)
- {
- return compare(s1, s2) <= 0;
- }
-
- public static bool gt(int s1, int s2)
- {
- return compare(s1, s2) > 0;
- }
-
- public static bool ge(int s1, int s2)
- {
- return compare(s1, s2) >= 0;
- }
-
- public static bool eq(int s1, int s2)
- {
- return s1 == s2;
- }
-
- public static int min(int s1, int s2)
- {
- if (lt(s1, s2))
- {
- return s1;
- }
- else
- {
- return s2;
- }
- }
-
- public static int max(int s1, int s2)
- {
- if (gt(s1, s2))
- {
- return s1;
- }
- else
- {
- return s2;
- }
- }
- }
+/* +* +* 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.transport.util +{ + /// <summary> + /// This class provides basic serial number comparisons as defined in + /// RFC 1982. + /// </summary> + public class Serial + { + /// + /// + ///Compares two numbers using serial arithmetic. + /// + /// param s1 the first serial number + /// param s2 the second serial number + /// + /// return a negative integer, zero, or a positive integer as the + /// first argument is less than, equal to, or greater than the + /// second + /// + public static int compare(int s1, int s2) + { + return s1 - s2; + } + + public static bool lt(int s1, int s2) + { + return compare(s1, s2) < 0; + } + + public static bool le(int s1, int s2) + { + return compare(s1, s2) <= 0; + } + + public static bool gt(int s1, int s2) + { + return compare(s1, s2) > 0; + } + + public static bool ge(int s1, int s2) + { + return compare(s1, s2) >= 0; + } + + public static bool eq(int s1, int s2) + { + return s1 == s2; + } + + public static int min(int s1, int s2) + { + if (lt(s1, s2)) + { + return s1; + } + else + { + return s2; + } + } + + public static int max(int s1, int s2) + { + if (gt(s1, s2)) + { + return s1; + } + else + { + return s2; + } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/util/UUID.cs b/qpid/dotnet/client-010/client/transport/util/UUID.cs index ff237f689e..2cbbd460bc 100644 --- a/qpid/dotnet/client-010/client/transport/util/UUID.cs +++ b/qpid/dotnet/client-010/client/transport/util/UUID.cs @@ -1,123 +1,123 @@ -/*
-*
-* 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;
-
-namespace org.apache.qpid.transport.util
-{
- public class UUID
- {
- private long _mostSigBits;
-
- private long _leastSigBits;
- private static readonly Random _random = new Random();
-
-
- public UUID(long mostSigBits, long leastSigBits)
- {
- _mostSigBits = mostSigBits;
- _leastSigBits = leastSigBits;
- }
-
- public long MostSignificantBits
- {
- get { return _mostSigBits; }
- set { _mostSigBits = value; }
- }
-
- public long LeastSignificantBits
- {
- get { return _leastSigBits; }
- set { _leastSigBits = value; }
- }
-
- private UUID(byte[] r)
- {
- MostSignificantBits = 0;
- LeastSignificantBits = 0;
- for (int i = 0; i < 8; i++)
- MostSignificantBits = (MostSignificantBits << 8) | (r[i] & 0xff);
- for (int i = 8; i < 16; i++)
- LeastSignificantBits = (LeastSignificantBits << 8) | (r[i] & 0xff);
- }
-
- public static UUID randomUUID()
- {
- byte[] randomBytes = new byte[16];
- _random.NextBytes(randomBytes);
- randomBytes[6] &= 0x0f;
- randomBytes[6] |= 0x40;
- randomBytes[8] &= 0x3f;
- randomBytes[8] |= 0x80;
- return new UUID(randomBytes);
- }
-
- public override String ToString()
- {
- return (digits(_mostSigBits >> 32, 8) + "-" +
- digits(_mostSigBits >> 16, 4) + "-" +
- digits(_mostSigBits, 4) + "-" +
- digits(_leastSigBits >> 48, 4) + "-" +
- digits(_leastSigBits, 12));
- }
-
- private static String digits(long val, int digits)
- {
- long hi = 1L << (digits * 4);
- return Convert.ToString((hi | (val & (hi - 1))), 16);
- }
-
- #region equality
- public bool Equals(UUID other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return other._mostSigBits == _mostSigBits && other._leastSigBits == _leastSigBits;
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (UUID)) return false;
- return Equals((UUID) obj);
- }
-
- public override int GetHashCode()
- {
- unchecked
- {
- return (_mostSigBits.GetHashCode()*397) ^ _leastSigBits.GetHashCode();
- }
- }
-
- public static bool operator ==(UUID left, UUID right)
- {
- return Equals(left, right);
- }
-
- public static bool operator !=(UUID left, UUID right)
- {
- return !Equals(left, right);
- }
- #endregion
- }
-}
+/* +* +* 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; + +namespace org.apache.qpid.transport.util +{ + public class UUID + { + private long _mostSigBits; + + private long _leastSigBits; + private static readonly Random _random = new Random(); + + + public UUID(long mostSigBits, long leastSigBits) + { + _mostSigBits = mostSigBits; + _leastSigBits = leastSigBits; + } + + public long MostSignificantBits + { + get { return _mostSigBits; } + set { _mostSigBits = value; } + } + + public long LeastSignificantBits + { + get { return _leastSigBits; } + set { _leastSigBits = value; } + } + + private UUID(byte[] r) + { + MostSignificantBits = 0; + LeastSignificantBits = 0; + for (int i = 0; i < 8; i++) + MostSignificantBits = (MostSignificantBits << 8) | (r[i] & 0xff); + for (int i = 8; i < 16; i++) + LeastSignificantBits = (LeastSignificantBits << 8) | (r[i] & 0xff); + } + + public static UUID randomUUID() + { + byte[] randomBytes = new byte[16]; + _random.NextBytes(randomBytes); + randomBytes[6] &= 0x0f; + randomBytes[6] |= 0x40; + randomBytes[8] &= 0x3f; + randomBytes[8] |= 0x80; + return new UUID(randomBytes); + } + + public override String ToString() + { + return (digits(_mostSigBits >> 32, 8) + "-" + + digits(_mostSigBits >> 16, 4) + "-" + + digits(_mostSigBits, 4) + "-" + + digits(_leastSigBits >> 48, 4) + "-" + + digits(_leastSigBits, 12)); + } + + private static String digits(long val, int digits) + { + long hi = 1L << (digits * 4); + return Convert.ToString((hi | (val & (hi - 1))), 16); + } + + #region equality + public bool Equals(UUID other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return other._mostSigBits == _mostSigBits && other._leastSigBits == _leastSigBits; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof (UUID)) return false; + return Equals((UUID) obj); + } + + public override int GetHashCode() + { + unchecked + { + return (_mostSigBits.GetHashCode()*397) ^ _leastSigBits.GetHashCode(); + } + } + + public static bool operator ==(UUID left, UUID right) + { + return Equals(left, right); + } + + public static bool operator !=(UUID left, UUID right) + { + return !Equals(left, right); + } + #endregion + } +} diff --git a/qpid/dotnet/client-010/demo/Demo.csproj b/qpid/dotnet/client-010/demo/Demo.csproj index ce326f5822..c621d4dad8 100644 --- a/qpid/dotnet/client-010/demo/Demo.csproj +++ b/qpid/dotnet/client-010/demo/Demo.csproj @@ -1,84 +1,84 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{E4C46FBC-7560-406D-BFEF-CA010E584DF4}</ProjectGuid>
- <OutputType>WinExe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>demo</RootNamespace>
- <AssemblyName>Qpid Demo</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\log4net\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Deployment" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <EmbeddedResource Include="Properties\Resources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Resources.Designer.cs</LastGenOutput>
- <SubType>Designer</SubType>
- </EmbeddedResource>
- <Compile Include="Properties\Resources.Designer.cs">
- <AutoGen>True</AutoGen>
- <DependentUpon>Resources.resx</DependentUpon>
- <DesignTime>True</DesignTime>
- </Compile>
- <None Include="Properties\Settings.settings">
- <Generator>SettingsSingleFileGenerator</Generator>
- <LastGenOutput>Settings.Designer.cs</LastGenOutput>
- </None>
- <Compile Include="Properties\Settings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DependentUpon>Settings.settings</DependentUpon>
- <DesignTimeSharedInput>True</DesignTimeSharedInput>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\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>
- -->
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{E4C46FBC-7560-406D-BFEF-CA010E584DF4}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>demo</RootNamespace> + <AssemblyName>Qpid Demo</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\lib\log4net\log4net.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Deployment" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="*.cs" /> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + <SubType>Designer</SubType> + </EmbeddedResource> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Resources.resx</DependentUpon> + <DesignTime>True</DesignTime> + </Compile> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/demo/Properties/Resources.Designer.cs b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs index 6e11238248..761056a770 100644 --- a/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs +++ b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs @@ -1,63 +1,63 @@ -//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace demo.Properties {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // 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.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demo.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <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)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
+//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.3053 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace demo.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // 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. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demo.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <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)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/qpid/dotnet/client-010/demo/Properties/Resources.resx b/qpid/dotnet/client-010/demo/Properties/Resources.resx index ffecec851a..af7dbebbac 100644 --- a/qpid/dotnet/client-010/demo/Properties/Resources.resx +++ b/qpid/dotnet/client-010/demo/Properties/Resources.resx @@ -1,117 +1,117 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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>
+<?xml version="1.0" encoding="utf-8"?> +<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>
\ No newline at end of file diff --git a/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs index 467ca52f9f..6bf34e7ce0 100644 --- a/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs +++ b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs @@ -1,26 +1,26 @@ -//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace demo.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
+//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.3053 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace demo.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/qpid/dotnet/client-010/demo/Properties/Settings.settings b/qpid/dotnet/client-010/demo/Properties/Settings.settings index abf36c5d3d..39645652af 100644 --- a/qpid/dotnet/client-010/demo/Properties/Settings.settings +++ b/qpid/dotnet/client-010/demo/Properties/Settings.settings @@ -1,7 +1,7 @@ -<?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
- <Profiles>
- <Profile Name="(Default)" />
- </Profiles>
- <Settings />
-</SettingsFile>
+<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile> diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Listener.cs b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Listener.cs index dd044e8aed..12002ce771 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Listener.cs +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Listener.cs @@ -1,112 +1,112 @@ -/*
-* 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.IO;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-
-namespace org.apache.qpid.example.direct
-{
- /// <summary>
- /// This program is one of three programs designed to be used
- /// together. These programs use the "amq.direct" exchange.
- ///
- /// Producer:
- ///
- /// Publishes to a broker, specifying a routing key.
- ///
- /// Listener (this program):
- ///
- /// Reads from a queue on the broker using a message listener.
- ///
- /// </summary>
- public class Listener
- {
- private static void Main(string[] args)
- {
- string host = args.Length > 0 ? args[0] : "localhost";
- int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672;
- Client connection = new Client();
- try
- {
- connection.connect(host, port, "test", "guest", "guest");
- ClientSession session = connection.createSession(50000);
-
- //--------- Main body of program --------------------------------------------
- // Create a queue named "message_queue", and route all messages whose
- // routing key is "routing_key" to this newly created queue.
-
- session.queueDeclare("message_queue");
- session.exchangeBind("message_queue", "amq.direct", "routing_key");
-
- lock (session)
- {
- // Create a listener and subscribe it to the queue named "message_queue"
- IMessageListener listener = new MessageListener(session);
- session.attachMessageListener(listener, "message_queue");
- session.messageSubscribe("message_queue");
- // Receive messages until all messages are received
- Monitor.Wait(session);
- }
-
- //---------------------------------------------------------------------------
-
- connection.close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Error: \n" + e.StackTrace);
- }
- }
- }
-
- public class MessageListener : IMessageListener
- {
- private readonly ClientSession _session;
- private readonly RangeSet _range = new RangeSet();
- public MessageListener(ClientSession session)
- {
- _session = session;
- }
-
- public void messageTransfer(IMessage m)
- {
- BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
- byte[] body = new byte[m.Body.Length - m.Body.Position];
- reader.Read(body, 0, body.Length);
- ASCIIEncoding enc = new ASCIIEncoding();
- string message = enc.GetString(body);
- Console.WriteLine("Message: " + message);
- // Add this message to the list of message to be acknowledged
- _range.add(m.Id);
- if( message.Equals("That's all, folks!") )
- {
- // Acknowledge all the received messages
- _session.messageAccept(_range);
- lock(_session)
- {
- Monitor.Pulse(_session);
- }
- }
- }
- }
-}
+/* +* 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.IO; +using System.Text; +using System.Threading; +using org.apache.qpid.client; +using org.apache.qpid.transport; + +namespace org.apache.qpid.example.direct +{ + /// <summary> + /// This program is one of three programs designed to be used + /// together. These programs use the "amq.direct" exchange. + /// + /// Producer: + /// + /// Publishes to a broker, specifying a routing key. + /// + /// Listener (this program): + /// + /// Reads from a queue on the broker using a message listener. + /// + /// </summary> + public class Listener + { + private static void Main(string[] args) + { + string host = args.Length > 0 ? args[0] : "localhost"; + int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + Client connection = new Client(); + try + { + connection.connect(host, port, "test", "guest", "guest"); + ClientSession session = connection.createSession(50000); + + //--------- Main body of program -------------------------------------------- + // Create a queue named "message_queue", and route all messages whose + // routing key is "routing_key" to this newly created queue. + + session.queueDeclare("message_queue"); + session.exchangeBind("message_queue", "amq.direct", "routing_key"); + + lock (session) + { + // Create a listener and subscribe it to the queue named "message_queue" + IMessageListener listener = new MessageListener(session); + session.attachMessageListener(listener, "message_queue"); + session.messageSubscribe("message_queue"); + // Receive messages until all messages are received + Monitor.Wait(session); + } + + //--------------------------------------------------------------------------- + + connection.close(); + } + catch (Exception e) + { + Console.WriteLine("Error: \n" + e.StackTrace); + } + } + } + + public class MessageListener : IMessageListener + { + private readonly ClientSession _session; + private readonly RangeSet _range = new RangeSet(); + public MessageListener(ClientSession session) + { + _session = session; + } + + public void messageTransfer(IMessage m) + { + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + ASCIIEncoding enc = new ASCIIEncoding(); + string message = enc.GetString(body); + Console.WriteLine("Message: " + message); + // Add this message to the list of message to be acknowledged + _range.add(m.Id); + if( message.Equals("That's all, folks!") ) + { + // Acknowledge all the received messages + _session.messageAccept(_range); + lock(_session) + { + Monitor.Pulse(_session); + } + } + } + } +} diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/example-direct-Listener.csproj b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/example-direct-Listener.csproj index 3c9ae20af8..2c345d997d 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/example-direct-Listener.csproj +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/example-direct-Listener.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>example_direct_Listener</RootNamespace>
- <AssemblyName>example-direct-Listener</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Listener.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>example_direct_Listener</RootNamespace> + <AssemblyName>example-direct-Listener</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Listener.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/examples/direct/example-direct-producer/Producer.cs b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Producer.cs index c9f1a475a4..ede90411d4 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-producer/Producer.cs +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Producer.cs @@ -1,87 +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.Text;
-using org.apache.qpid.client;
-
-namespace org.apache.qpid.example.direct
-{
- /// <summary>
- /// This program is one of three programs designed to be used
- /// together. These programs use the "amq.direct" exchange.
- ///
- /// Producer (this program):
- ///
- /// Publishes to a broker, specifying a routing key.
- ///
- /// Listener:
- ///
- /// Reads from a queue on the broker using a message listener.
- ///
- /// </summary>
- class Producer
- {
- static void Main(string[] args)
- {
- string host = args.Length > 0 ? args[0] : "localhost";
- int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672;
- Client connection = new Client();
- try
- {
- connection.connect(host, port, "test", "guest", "guest");
- ClientSession session = connection.createSession(50000);
-
- //--------- Main body of program --------------------------------------------
-
- IMessage message = new Message();
-
- // The routing key is a message property. We will use the same
- // routing key for each message, so we'll set this property
- // just once. (In most simple cases, there is no need to set
- // other message properties.)
-
- message.DeliveryProperties.setRoutingKey("routing_key");
-
- // Asynchronous transfer sends messages as quickly as
- // possible without waiting for confirmation.
- for (int i = 0; i < 10; i++)
- {
- message.clearData();
- message.appendData(Encoding.UTF8.GetBytes("Message " + i));
- session.messageTransfer("amq.direct", message);
- }
-
- // And send a syncrhonous final message to indicate termination.
- message.clearData();
- message.appendData(Encoding.UTF8.GetBytes("That's all, folks!"));
- session.messageTransfer("amq.direct", "routing_key", message);
- session.sync();
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Error: \n" + e.StackTrace);
- }
- }
- }
-}
+/* +* 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.Text; +using org.apache.qpid.client; + +namespace org.apache.qpid.example.direct +{ + /// <summary> + /// This program is one of three programs designed to be used + /// together. These programs use the "amq.direct" exchange. + /// + /// Producer (this program): + /// + /// Publishes to a broker, specifying a routing key. + /// + /// Listener: + /// + /// Reads from a queue on the broker using a message listener. + /// + /// </summary> + class Producer + { + static void Main(string[] args) + { + string host = args.Length > 0 ? args[0] : "localhost"; + int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + Client connection = new Client(); + try + { + connection.connect(host, port, "test", "guest", "guest"); + ClientSession session = connection.createSession(50000); + + //--------- Main body of program -------------------------------------------- + + IMessage message = new Message(); + + // The routing key is a message property. We will use the same + // routing key for each message, so we'll set this property + // just once. (In most simple cases, there is no need to set + // other message properties.) + + message.DeliveryProperties.setRoutingKey("routing_key"); + + // Asynchronous transfer sends messages as quickly as + // possible without waiting for confirmation. + for (int i = 0; i < 10; i++) + { + message.clearData(); + message.appendData(Encoding.UTF8.GetBytes("Message " + i)); + session.messageTransfer("amq.direct", message); + } + + // And send a syncrhonous final message to indicate termination. + message.clearData(); + message.appendData(Encoding.UTF8.GetBytes("That's all, folks!")); + session.messageTransfer("amq.direct", "routing_key", message); + session.sync(); + + //----------------------------------------------------------------------------- + + connection.close(); + } + catch (Exception e) + { + Console.WriteLine("Error: \n" + e.StackTrace); + } + } + } +} diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-producer/example-direct-producer.csproj b/qpid/dotnet/client-010/examples/direct/example-direct-producer/example-direct-producer.csproj index 18dcc3a0d6..151c9214ee 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-producer/example-direct-producer.csproj +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/example-direct-producer.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{96FCB250-8142-40EE-9BDD-CA839EE21021}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>example_direct_producer</RootNamespace>
- <AssemblyName>example-direct-producer</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Producer.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{96FCB250-8142-40EE-9BDD-CA839EE21021}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>example_direct_producer</RootNamespace> + <AssemblyName>example-direct-producer</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Producer.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/examples/fanout/example-fanout-Listener/Listener.cs b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Listener.cs index 4d3da690a9..5315808465 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Listener.cs +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Listener.cs @@ -1,121 +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.
-*/
-
-using System;
-using System.IO;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-
-namespace org.apache.qpid.example.fanout
-{
- /// <summary>
- /// This program is one of two programs designed to be used
- /// together.
- ///
- /// Producer (this program):
- ///
- /// Publishes to a broker, specifying a routing key.
- ///
- /// Listener:
- ///
- /// Reads from a queue on the broker using a message listener.
- ///
- /// </summary>
- public class Listener
- {
- private static void Main(string[] args)
- {
- string host = args.Length > 0 ? args[0] : "localhost";
- int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672;
- Client connection = new Client();
- try
- {
- connection.connect(host, port, "test", "guest", "guest");
- ClientSession session = connection.createSession(50000);
-
- //--------- Main body of program --------------------------------------------
- // Each client creates its own private queue, using the
- // session id to guarantee a unique name. It then routes
- // all messages from the fanout exchange to its own queue
- // by binding to the queue.
- //
- // The binding specifies a binding key, but for a fanout
- // exchange, the binding key is optional and is not used
- // for routing decisions. It can be useful for tracking
- // messages and routing in logs.
-
- string myQueue = session.Name;
- session.queueDeclare(myQueue, Option.EXCLUSIVE, Option.AUTO_DELETE);
- session.exchangeBind(myQueue, "amq.fanout", "my-key");
-
- lock (session)
- {
- Console.WriteLine("Listening");
- // Create a listener and subscribe it to my queue.
- IMessageListener listener = new MessageListener(session);
- session.attachMessageListener(listener, myQueue);
- session.messageSubscribe(myQueue);
- // Receive messages until all messages are received
- Monitor.Wait(session);
- }
-
- //---------------------------------------------------------------------------
-
- connection.close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Error: \n" + e.StackTrace);
- }
- }
- }
-
- public class MessageListener : IMessageListener
- {
- private readonly ClientSession _session;
- private readonly RangeSet _range = new RangeSet();
- public MessageListener(ClientSession session)
- {
- _session = session;
- }
-
- public void messageTransfer(IMessage m)
- {
- BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
- byte[] body = new byte[m.Body.Length - m.Body.Position];
- reader.Read(body, 0, body.Length);
- ASCIIEncoding enc = new ASCIIEncoding();
- string message = enc.GetString(body);
- Console.WriteLine("Message: " + message);
- // Add this message to the list of message to be acknowledged
- _range.add(m.Id);
- if (message.Equals("That's all, folks!"))
- {
- // Acknowledge all the received messages
- _session.messageAccept(_range);
- lock (_session)
- {
- Monitor.Pulse(_session);
- }
- }
- }
- }
-}
+/* +* 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.IO; +using System.Text; +using System.Threading; +using org.apache.qpid.client; +using org.apache.qpid.transport; + +namespace org.apache.qpid.example.fanout +{ + /// <summary> + /// This program is one of two programs designed to be used + /// together. + /// + /// Producer (this program): + /// + /// Publishes to a broker, specifying a routing key. + /// + /// Listener: + /// + /// Reads from a queue on the broker using a message listener. + /// + /// </summary> + public class Listener + { + private static void Main(string[] args) + { + string host = args.Length > 0 ? args[0] : "localhost"; + int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + Client connection = new Client(); + try + { + connection.connect(host, port, "test", "guest", "guest"); + ClientSession session = connection.createSession(50000); + + //--------- Main body of program -------------------------------------------- + // Each client creates its own private queue, using the + // session id to guarantee a unique name. It then routes + // all messages from the fanout exchange to its own queue + // by binding to the queue. + // + // The binding specifies a binding key, but for a fanout + // exchange, the binding key is optional and is not used + // for routing decisions. It can be useful for tracking + // messages and routing in logs. + + string myQueue = session.Name; + session.queueDeclare(myQueue, Option.EXCLUSIVE, Option.AUTO_DELETE); + session.exchangeBind(myQueue, "amq.fanout", "my-key"); + + lock (session) + { + Console.WriteLine("Listening"); + // Create a listener and subscribe it to my queue. + IMessageListener listener = new MessageListener(session); + session.attachMessageListener(listener, myQueue); + session.messageSubscribe(myQueue); + // Receive messages until all messages are received + Monitor.Wait(session); + } + + //--------------------------------------------------------------------------- + + connection.close(); + } + catch (Exception e) + { + Console.WriteLine("Error: \n" + e.StackTrace); + } + } + } + + public class MessageListener : IMessageListener + { + private readonly ClientSession _session; + private readonly RangeSet _range = new RangeSet(); + public MessageListener(ClientSession session) + { + _session = session; + } + + public void messageTransfer(IMessage m) + { + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + ASCIIEncoding enc = new ASCIIEncoding(); + string message = enc.GetString(body); + Console.WriteLine("Message: " + message); + // Add this message to the list of message to be acknowledged + _range.add(m.Id); + if (message.Equals("That's all, folks!")) + { + // Acknowledge all the received messages + _session.messageAccept(_range); + lock (_session) + { + Monitor.Pulse(_session); + } + } + } + } +} diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/example-fanout-Listener.csproj b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/example-fanout-Listener.csproj index c2c8833e34..91a6ec4786 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/example-fanout-Listener.csproj +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/example-fanout-Listener.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>example_fanout_Listener</RootNamespace>
- <AssemblyName>example-fanout-Listener</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Listener.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{18A0792B-DC3A-4EC5-93D6-DB8A111D8F15}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>example_fanout_Listener</RootNamespace> + <AssemblyName>example-fanout-Listener</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Listener.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/examples/fanout/example-fanout-Producer/Producer.cs b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Producer.cs index f2818a4099..047d3097a4 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Producer.cs +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Producer.cs @@ -1,84 +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.
-*/
-
-using System;
-using System.Text;
-using org.apache.qpid.client;
-
-namespace org.apache.qpid.example.fanout
-{
- /// <summary>
- /// This program is one of two programs designed to be used
- /// together. These programs do not specify the exchange type - the
- /// default exchange type is the direct exchange.
- ///
- ///
- /// Producer (this program):
- ///
- /// Publishes to a broker, specifying a routing key.
- ///
- /// Listener:
- ///
- /// Reads from a queue on the broker using a message listener.
- ///
- /// </summary>
- class Producer
- {
- static void Main(string[] args)
- {
- string host = args.Length > 0 ? args[0] : "localhost";
- int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672;
- Client connection = new Client();
- try
- {
- connection.connect(host, port, "test", "guest", "guest");
- ClientSession session = connection.createSession(50000);
-
- //--------- Main body of program --------------------------------------------
-
- // Unlike topic exchanges and direct exchanges, a fanout
- // exchange need not set a routing key.
- IMessage message = new Message();
-
- // Asynchronous transfer sends messages as quickly as
- // possible without waiting for confirmation.
- for (int i = 0; i < 10; i++)
- {
- message.clearData();
- message.appendData(Encoding.UTF8.GetBytes("Message " + i));
- session.messageTransfer("amq.fanout", message);
- }
-
- // And send a syncrhonous final message to indicate termination.
- message.clearData();
- message.appendData(Encoding.UTF8.GetBytes("That's all, folks!"));
- session.messageTransfer("amq.fanout", message);
- session.sync();
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Error: \n" + e.StackTrace);
- }
- }
- }
-}
+/* +* 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.Text; +using org.apache.qpid.client; + +namespace org.apache.qpid.example.fanout +{ + /// <summary> + /// This program is one of two programs designed to be used + /// together. These programs do not specify the exchange type - the + /// default exchange type is the direct exchange. + /// + /// + /// Producer (this program): + /// + /// Publishes to a broker, specifying a routing key. + /// + /// Listener: + /// + /// Reads from a queue on the broker using a message listener. + /// + /// </summary> + class Producer + { + static void Main(string[] args) + { + string host = args.Length > 0 ? args[0] : "localhost"; + int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + Client connection = new Client(); + try + { + connection.connect(host, port, "test", "guest", "guest"); + ClientSession session = connection.createSession(50000); + + //--------- Main body of program -------------------------------------------- + + // Unlike topic exchanges and direct exchanges, a fanout + // exchange need not set a routing key. + IMessage message = new Message(); + + // Asynchronous transfer sends messages as quickly as + // possible without waiting for confirmation. + for (int i = 0; i < 10; i++) + { + message.clearData(); + message.appendData(Encoding.UTF8.GetBytes("Message " + i)); + session.messageTransfer("amq.fanout", message); + } + + // And send a syncrhonous final message to indicate termination. + message.clearData(); + message.appendData(Encoding.UTF8.GetBytes("That's all, folks!")); + session.messageTransfer("amq.fanout", message); + session.sync(); + + //----------------------------------------------------------------------------- + + connection.close(); + } + catch (Exception e) + { + Console.WriteLine("Error: \n" + e.StackTrace); + } + } + } +} diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/example-fanout-Producer.csproj b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/example-fanout-Producer.csproj index 83959fe3af..59d194badb 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/example-fanout-Producer.csproj +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/example-fanout-Producer.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{4513BF94-D54A-42FE-8506-FE2CD57B2C51}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>example_fanout_Producer</RootNamespace>
- <AssemblyName>example-fanout-Producer</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Producer.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{4513BF94-D54A-42FE-8506-FE2CD57B2C51}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>example_fanout_Producer</RootNamespace> + <AssemblyName>example-fanout-Producer</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Producer.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Listener.cs b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Listener.cs index 0f09307cd4..f08e1a70f8 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Listener.cs +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Listener.cs @@ -1,138 +1,138 @@ -/*
-* 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.IO;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-
-namespace org.apache.qpid.example.pubsub
-{
- /// <summary>
- /// This program is one of two programs designed to be used
- /// together. These programs use the topic exchange.
- ///
- /// Publisher:
- ///
- /// Publishes to a broker, specifying a routing key.
- ///
- /// Listener (this program):
- ///
- /// Reads from a queue on the broker using a message listener.
- ///
- /// </summary>
- internal class Listener
- {
- public static int _count = 4;
-
- private static void Main(string[] args)
- {
- string host = args.Length > 0 ? args[0] : "localhost";
- int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672;
- Client connection = new Client();
- try
- {
- connection.connect(host, port, "test", "guest", "guest");
- ClientSession session = connection.createSession(50000);
-
- //--------- Main body of program --------------------------------------------
-
- lock (session)
- {
- Console.WriteLine("Listening for messages ...");
- // Create a listener
- prepareQueue("usa", "usa.#", session);
- prepareQueue("europe", "europe.#", session);
- prepareQueue("news", "#.news", session);
- prepareQueue("weather", "#.weather", session);
- while (_count > 0)
- {
- Monitor.Wait(session);
- }
- }
-
- //---------------------------------------------------------------------------
-
- connection.close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Error: \n" + e.StackTrace);
- }
- }
-
- private static void prepareQueue(string queue, string routing_key, ClientSession session)
- {
- // Create a unique queue name for this consumer by concatenating
- // the queue name parameter with the Session ID.
- Console.WriteLine("Declaring queue: " + queue);
- session.queueDeclare(queue, Option.EXCLUSIVE, Option.AUTO_DELETE);
-
- // Route messages to the new queue if they match the routing key.
- // Also route any messages to with the "control" routing key to
- // this queue so we know when it's time to stop. A publisher sends
- // a message with the content "That's all, Folks!", using the
- // "control" routing key, when it is finished.
-
- session.exchangeBind(queue, "amq.topic", routing_key);
- session.exchangeBind(queue, "amq.topic", "control");
-
- // subscribe the listener to the queue
- IMessageListener listener = new MessageListener(session);
- session.attachMessageListener(listener, queue);
- session.messageSubscribe(queue);
- }
- }
-
- public class MessageListener : IMessageListener
- {
- private readonly ClientSession _session;
- private readonly RangeSet _range = new RangeSet();
-
- public MessageListener(ClientSession session)
- {
- _session = session;
- }
-
- public void messageTransfer(IMessage m)
- {
- BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
- byte[] body = new byte[m.Body.Length - m.Body.Position];
- reader.Read(body, 0, body.Length);
- ASCIIEncoding enc = new ASCIIEncoding();
- string message = enc.GetString(body);
- Console.WriteLine("Message: " + message + " from " + m.Destination);
- // Add this message to the list of message to be acknowledged
- _range.add(m.Id);
- if (message.Equals("That's all, folks!"))
- {
- Console.WriteLine("Shutting down listener for " + m.DeliveryProperties.getRoutingKey());
- Listener._count--;
- // Acknowledge all the received messages
- _session.messageAccept(_range);
- lock (_session)
- {
- Monitor.Pulse(_session);
- }
- }
- }
- }
-}
+/* +* 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.IO; +using System.Text; +using System.Threading; +using org.apache.qpid.client; +using org.apache.qpid.transport; + +namespace org.apache.qpid.example.pubsub +{ + /// <summary> + /// This program is one of two programs designed to be used + /// together. These programs use the topic exchange. + /// + /// Publisher: + /// + /// Publishes to a broker, specifying a routing key. + /// + /// Listener (this program): + /// + /// Reads from a queue on the broker using a message listener. + /// + /// </summary> + internal class Listener + { + public static int _count = 4; + + private static void Main(string[] args) + { + string host = args.Length > 0 ? args[0] : "localhost"; + int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + Client connection = new Client(); + try + { + connection.connect(host, port, "test", "guest", "guest"); + ClientSession session = connection.createSession(50000); + + //--------- Main body of program -------------------------------------------- + + lock (session) + { + Console.WriteLine("Listening for messages ..."); + // Create a listener + prepareQueue("usa", "usa.#", session); + prepareQueue("europe", "europe.#", session); + prepareQueue("news", "#.news", session); + prepareQueue("weather", "#.weather", session); + while (_count > 0) + { + Monitor.Wait(session); + } + } + + //--------------------------------------------------------------------------- + + connection.close(); + } + catch (Exception e) + { + Console.WriteLine("Error: \n" + e.StackTrace); + } + } + + private static void prepareQueue(string queue, string routing_key, ClientSession session) + { + // Create a unique queue name for this consumer by concatenating + // the queue name parameter with the Session ID. + Console.WriteLine("Declaring queue: " + queue); + session.queueDeclare(queue, Option.EXCLUSIVE, Option.AUTO_DELETE); + + // Route messages to the new queue if they match the routing key. + // Also route any messages to with the "control" routing key to + // this queue so we know when it's time to stop. A publisher sends + // a message with the content "That's all, Folks!", using the + // "control" routing key, when it is finished. + + session.exchangeBind(queue, "amq.topic", routing_key); + session.exchangeBind(queue, "amq.topic", "control"); + + // subscribe the listener to the queue + IMessageListener listener = new MessageListener(session); + session.attachMessageListener(listener, queue); + session.messageSubscribe(queue); + } + } + + public class MessageListener : IMessageListener + { + private readonly ClientSession _session; + private readonly RangeSet _range = new RangeSet(); + + public MessageListener(ClientSession session) + { + _session = session; + } + + public void messageTransfer(IMessage m) + { + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + ASCIIEncoding enc = new ASCIIEncoding(); + string message = enc.GetString(body); + Console.WriteLine("Message: " + message + " from " + m.Destination); + // Add this message to the list of message to be acknowledged + _range.add(m.Id); + if (message.Equals("That's all, folks!")) + { + Console.WriteLine("Shutting down listener for " + m.DeliveryProperties.getRoutingKey()); + Listener._count--; + // Acknowledge all the received messages + _session.messageAccept(_range); + lock (_session) + { + Monitor.Pulse(_session); + } + } + } + } +} diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/example-pub-sub-Listener.csproj b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/example-pub-sub-Listener.csproj index 0b9d259373..2a15b4f224 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/example-pub-sub-Listener.csproj +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/example-pub-sub-Listener.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>example_pub_sub_Listener</RootNamespace>
- <AssemblyName>example-pub-sub-Listener</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Listener.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>example_pub_sub_Listener</RootNamespace> + <AssemblyName>example-pub-sub-Listener</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Listener.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Publisher.cs b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Publisher.cs index 6c78eb5193..a876f0f170 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Publisher.cs +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Publisher.cs @@ -1,93 +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.
-*/
-
-using System;
-using System.Text;
-using org.apache.qpid.client;
-
-namespace org.apache.qpid.example.pubsub
-{
- /// <summary>
- /// This program is one of two programs designed to be used
- /// together. These programs use the topic exchange.
- ///
- /// Publisher (this program):
- ///
- /// Publishes to a broker, specifying a routing key.
- ///
- /// Listener:
- ///
- /// Reads from a queue on the broker using a message listener.
- ///
- /// </summary>
- internal class Publisher
- {
- private static void Main(string[] args)
- {
- string host = args.Length > 0 ? args[0] : "localhost";
- int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672;
- Client connection = new Client();
- try
- {
- connection.connect(host, port, "test", "guest", "guest");
- ClientSession session = connection.createSession(50000);
-
- //--------- Main body of program --------------------------------------------
-
- publishMessages(session, "usa.news");
- publishMessages(session, "usa.weather");
- publishMessages(session, "europe.news");
- publishMessages(session, "europe.weather");
-
- noMoreMessages(session);
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Error: \n" + e.StackTrace);
- }
- }
-
- private static void publishMessages(ClientSession session, string routing_key)
- {
- IMessage message = new Message();
- // Asynchronous transfer sends messages as quickly as
- // possible without waiting for confirmation.
- for (int i = 0; i < 10; i++)
- {
- message.clearData();
- message.appendData(Encoding.UTF8.GetBytes("Message " + i));
- session.messageTransfer("amq.topic", routing_key, message);
- }
- }
-
- private static void noMoreMessages(ClientSession session)
- {
- IMessage message = new Message();
- // And send a syncrhonous final message to indicate termination.
- message.clearData();
- message.appendData(Encoding.UTF8.GetBytes("That's all, folks!"));
- session.messageTransfer("amq.topic", "control", message);
- session.sync();
- }
- }
-}
+/* +* 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.Text; +using org.apache.qpid.client; + +namespace org.apache.qpid.example.pubsub +{ + /// <summary> + /// This program is one of two programs designed to be used + /// together. These programs use the topic exchange. + /// + /// Publisher (this program): + /// + /// Publishes to a broker, specifying a routing key. + /// + /// Listener: + /// + /// Reads from a queue on the broker using a message listener. + /// + /// </summary> + internal class Publisher + { + private static void Main(string[] args) + { + string host = args.Length > 0 ? args[0] : "localhost"; + int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + Client connection = new Client(); + try + { + connection.connect(host, port, "test", "guest", "guest"); + ClientSession session = connection.createSession(50000); + + //--------- Main body of program -------------------------------------------- + + publishMessages(session, "usa.news"); + publishMessages(session, "usa.weather"); + publishMessages(session, "europe.news"); + publishMessages(session, "europe.weather"); + + noMoreMessages(session); + + //----------------------------------------------------------------------------- + + connection.close(); + } + catch (Exception e) + { + Console.WriteLine("Error: \n" + e.StackTrace); + } + } + + private static void publishMessages(ClientSession session, string routing_key) + { + IMessage message = new Message(); + // Asynchronous transfer sends messages as quickly as + // possible without waiting for confirmation. + for (int i = 0; i < 10; i++) + { + message.clearData(); + message.appendData(Encoding.UTF8.GetBytes("Message " + i)); + session.messageTransfer("amq.topic", routing_key, message); + } + } + + private static void noMoreMessages(ClientSession session) + { + IMessage message = new Message(); + // And send a syncrhonous final message to indicate termination. + message.clearData(); + message.appendData(Encoding.UTF8.GetBytes("That's all, folks!")); + session.messageTransfer("amq.topic", "control", message); + session.sync(); + } + } +} diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/example-pub-sub-Publisher.csproj b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/example-pub-sub-Publisher.csproj index 7c47550420..b7425a535e 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/example-pub-sub-Publisher.csproj +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/example-pub-sub-Publisher.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F8857634-A134-44E7-A953-F2B22688C599}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>example_pub_sub_Publisher</RootNamespace>
- <AssemblyName>example-pub-sub-Publisher</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Publisher.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{F8857634-A134-44E7-A953-F2B22688C599}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>example_pub_sub_Publisher</RootNamespace> + <AssemblyName>example-pub-sub-Publisher</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Publisher.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/examples/request-response/example-request-response-Client/Client.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Client.cs index 1d361199f1..1e15109b11 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Client.cs +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Client.cs @@ -1,137 +1,137 @@ -/*
-* 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.IO;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-
-namespace org.apache.qpid.example.requestresponse
-{
- /// <summary>
- /// This program is one of two programs that illustrate the
- /// request/response pattern.
- ///
- /// Client (this program):
- /// Make requests of a service, print the response.
- ///
- /// Server:
- /// Accept requests, set the letters to uppercase in each message, and
- /// return it as a response.
- ///
- /// </summary>
- internal class Client
- {
- private static void Main(string[] args)
- {
- string host = args.Length > 0 ? args[0] : "localhost";
- int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672;
- client.Client connection = new client.Client();
- try
- {
- connection.connect(host, port, "test", "guest", "guest");
- ClientSession session = connection.createSession(50000);
- IMessage request = new Message();
-
- //--------- Main body of program --------------------------------------------
- // Create a response queue so the server can send us responses
- // to our requests. Use the client's session ID as the name
- // of the response queue.
- string response_queue = "client" + session.getName();
- // Use the name of the response queue as the routing key
- session.queueDeclare(response_queue);
- session.exchangeBind(response_queue, "amq.direct", response_queue);
-
- // Each client sends the name of their own response queue so
- // the service knows where to route messages.
- request.DeliveryProperties.setRoutingKey("request");
- request.MessageProperties.setReplyTo(new ReplyTo("amq.direct", response_queue));
-
- lock (session)
- {
- // Create a listener for the response queue and listen for response messages.
- Console.WriteLine("Activating response queue listener for: " + response_queue);
- IMessageListener listener = new ClientMessageListener(session);
- session.attachMessageListener(listener, response_queue);
- session.messageSubscribe(response_queue);
-
- // Now send some requests ...
- string[] strs = {
- "Twas brillig, and the slithy toves",
- "Did gire and gymble in the wabe.",
- "All mimsy were the borogroves,",
- "And the mome raths outgrabe.",
- "That's all, folks!"
- };
- foreach (string s in strs)
- {
- request.clearData();
- request.appendData(Encoding.UTF8.GetBytes(s));
- session.messageTransfer("amq.direct", request);
- }
- Console.WriteLine("Waiting for all responses to arrive ...");
- Monitor.Wait(session);
- }
- //---------------------------------------------------------------------------
-
- connection.close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Error: \n" + e.StackTrace);
- }
- }
- }
-
- public class ClientMessageListener : IMessageListener
- {
- private readonly ClientSession _session;
- private readonly RangeSet _range = new RangeSet();
- private int _counter;
- public ClientMessageListener(ClientSession session)
- {
- _session = session;
- }
-
- public void messageTransfer(IMessage m)
- {
- _counter++;
- BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
- byte[] body = new byte[m.Body.Length - m.Body.Position];
- reader.Read(body, 0, body.Length);
- ASCIIEncoding enc = new ASCIIEncoding();
- string message = enc.GetString(body);
- Console.WriteLine("Response: " + message);
- // Add this message to the list of message to be acknowledged
- _range.add(m.Id);
- if (_counter == 4)
- {
- Console.WriteLine("Shutting down listener for " + m.DeliveryProperties.getRoutingKey());
- // Acknowledge all the received messages
- _session.messageAccept(_range);
- lock (_session)
- {
- Monitor.Pulse(_session);
- }
- }
- }
- }
-}
+/* +* 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.IO; +using System.Text; +using System.Threading; +using org.apache.qpid.client; +using org.apache.qpid.transport; + +namespace org.apache.qpid.example.requestresponse +{ + /// <summary> + /// This program is one of two programs that illustrate the + /// request/response pattern. + /// + /// Client (this program): + /// Make requests of a service, print the response. + /// + /// Server: + /// Accept requests, set the letters to uppercase in each message, and + /// return it as a response. + /// + /// </summary> + internal class Client + { + private static void Main(string[] args) + { + string host = args.Length > 0 ? args[0] : "localhost"; + int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + client.Client connection = new client.Client(); + try + { + connection.connect(host, port, "test", "guest", "guest"); + ClientSession session = connection.createSession(50000); + IMessage request = new Message(); + + //--------- Main body of program -------------------------------------------- + // Create a response queue so the server can send us responses + // to our requests. Use the client's session ID as the name + // of the response queue. + string response_queue = "client" + session.getName(); + // Use the name of the response queue as the routing key + session.queueDeclare(response_queue); + session.exchangeBind(response_queue, "amq.direct", response_queue); + + // Each client sends the name of their own response queue so + // the service knows where to route messages. + request.DeliveryProperties.setRoutingKey("request"); + request.MessageProperties.setReplyTo(new ReplyTo("amq.direct", response_queue)); + + lock (session) + { + // Create a listener for the response queue and listen for response messages. + Console.WriteLine("Activating response queue listener for: " + response_queue); + IMessageListener listener = new ClientMessageListener(session); + session.attachMessageListener(listener, response_queue); + session.messageSubscribe(response_queue); + + // Now send some requests ... + string[] strs = { + "Twas brillig, and the slithy toves", + "Did gire and gymble in the wabe.", + "All mimsy were the borogroves,", + "And the mome raths outgrabe.", + "That's all, folks!" + }; + foreach (string s in strs) + { + request.clearData(); + request.appendData(Encoding.UTF8.GetBytes(s)); + session.messageTransfer("amq.direct", request); + } + Console.WriteLine("Waiting for all responses to arrive ..."); + Monitor.Wait(session); + } + //--------------------------------------------------------------------------- + + connection.close(); + } + catch (Exception e) + { + Console.WriteLine("Error: \n" + e.StackTrace); + } + } + } + + public class ClientMessageListener : IMessageListener + { + private readonly ClientSession _session; + private readonly RangeSet _range = new RangeSet(); + private int _counter; + public ClientMessageListener(ClientSession session) + { + _session = session; + } + + public void messageTransfer(IMessage m) + { + _counter++; + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + ASCIIEncoding enc = new ASCIIEncoding(); + string message = enc.GetString(body); + Console.WriteLine("Response: " + message); + // Add this message to the list of message to be acknowledged + _range.add(m.Id); + if (_counter == 4) + { + Console.WriteLine("Shutting down listener for " + m.DeliveryProperties.getRoutingKey()); + // Acknowledge all the received messages + _session.messageAccept(_range); + lock (_session) + { + Monitor.Pulse(_session); + } + } + } + } +} diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/example-request-response-Client.csproj b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/example-request-response-Client.csproj index c92a920953..d86e013538 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/example-request-response-Client.csproj +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/example-request-response-Client.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{1BC63815-4029-4039-9207-35E7E06ECC99}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>example_request_response_Client</RootNamespace>
- <AssemblyName>example-request-response-Client</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Client.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{1BC63815-4029-4039-9207-35E7E06ECC99}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>example_request_response_Client</RootNamespace> + <AssemblyName>example-request-response-Client</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Client.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/examples/request-response/example-request-response-Server/Server.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Server.cs index 2ce493626f..aa14be0e55 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Server.cs +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Server.cs @@ -1,136 +1,136 @@ -/*
-* 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.IO;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-
-namespace org.apache.qpid.example.requestresponse
-{
- /// <summary>
- /// This program is one of two programs that illustrate the
- /// request/response pattern.
- ///
- /// Client:
- /// Make requests of a service, print the response.
- ///
- /// Server (this program):
- /// Accept requests, set the letters to uppercase in each message, and
- /// return it as a response.
- ///
- /// </summary>
- class Server
- {
- static void Main(string[] args)
- {
- string host = args.Length > 0 ? args[0] : "localhost";
- int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672;
- client.Client connection = new client.Client();
- try
- {
- connection.connect(host, port, "test", "guest", "guest");
- ClientSession session = connection.createSession(50000);
-
- //--------- Main body of program --------------------------------------------
- // Create a request queue for clients to use when making
- // requests.
- const string request_queue = "request";
- // Use the name of the request queue as the routing key
- session.queueDeclare(request_queue);
- session.exchangeBind(request_queue, "amq.direct", request_queue);
-
- lock (session)
- {
- // Create a listener and subscribe it to the request_queue
- IMessageListener listener = new MessageListener(session);
- session.attachMessageListener(listener, request_queue);
- session.messageSubscribe(request_queue);
- // Receive messages until all messages are received
- Console.WriteLine("Waiting for requests");
- Monitor.Wait(session);
- }
-
- //---------------------------------------------------------------------------
-
- connection.close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Error: \n" + e.StackTrace);
- }
- }
- }
-
- public class MessageListener : IMessageListener
- {
- private readonly ClientSession _session;
- private readonly RangeSet _range = new RangeSet();
- public MessageListener(ClientSession session)
- {
- _session = session;
- }
-
- public void messageTransfer(IMessage request)
- {
- IMessage response = new Message();
-
- // Get routing key for response from the request's replyTo property
- string routingKey;
- if( request.MessageProperties.hasReplyTo() )
- {
- routingKey = request.MessageProperties.getReplyTo().getRoutingKey();
- }
- else
- {
- Console.WriteLine("Error: \n No routing key for request " + request);
- return;
- }
-
- BinaryReader reader = new BinaryReader(request.Body, Encoding.UTF8);
- byte[] body = new byte[request.Body.Length - request.Body.Position];
- reader.Read(body, 0, body.Length);
- ASCIIEncoding enc = new ASCIIEncoding();
- string message = enc.GetString(body);
- Console.WriteLine("Request: " + message);
-
- // Transform message content to upper case
- string responseBody = message.ToUpper();
-
- // Send it back to the user
- response.clearData();
- response.appendData(Encoding.UTF8.GetBytes(responseBody));
- _session.messageTransfer("amq.direct", routingKey, response);
-
- // Add this message to the list of message to be acknowledged
- _range.add(request.Id);
- if (message.Equals("That's all, folks!"))
- {
- // Acknowledge all the received messages
- _session.messageAccept(_range);
- lock (_session)
- {
- Monitor.Pulse(_session);
- }
- }
- }
- }
-}
+/* +* 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.IO; +using System.Text; +using System.Threading; +using org.apache.qpid.client; +using org.apache.qpid.transport; + +namespace org.apache.qpid.example.requestresponse +{ + /// <summary> + /// This program is one of two programs that illustrate the + /// request/response pattern. + /// + /// Client: + /// Make requests of a service, print the response. + /// + /// Server (this program): + /// Accept requests, set the letters to uppercase in each message, and + /// return it as a response. + /// + /// </summary> + class Server + { + static void Main(string[] args) + { + string host = args.Length > 0 ? args[0] : "localhost"; + int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + client.Client connection = new client.Client(); + try + { + connection.connect(host, port, "test", "guest", "guest"); + ClientSession session = connection.createSession(50000); + + //--------- Main body of program -------------------------------------------- + // Create a request queue for clients to use when making + // requests. + const string request_queue = "request"; + // Use the name of the request queue as the routing key + session.queueDeclare(request_queue); + session.exchangeBind(request_queue, "amq.direct", request_queue); + + lock (session) + { + // Create a listener and subscribe it to the request_queue + IMessageListener listener = new MessageListener(session); + session.attachMessageListener(listener, request_queue); + session.messageSubscribe(request_queue); + // Receive messages until all messages are received + Console.WriteLine("Waiting for requests"); + Monitor.Wait(session); + } + + //--------------------------------------------------------------------------- + + connection.close(); + } + catch (Exception e) + { + Console.WriteLine("Error: \n" + e.StackTrace); + } + } + } + + public class MessageListener : IMessageListener + { + private readonly ClientSession _session; + private readonly RangeSet _range = new RangeSet(); + public MessageListener(ClientSession session) + { + _session = session; + } + + public void messageTransfer(IMessage request) + { + IMessage response = new Message(); + + // Get routing key for response from the request's replyTo property + string routingKey; + if( request.MessageProperties.hasReplyTo() ) + { + routingKey = request.MessageProperties.getReplyTo().getRoutingKey(); + } + else + { + Console.WriteLine("Error: \n No routing key for request " + request); + return; + } + + BinaryReader reader = new BinaryReader(request.Body, Encoding.UTF8); + byte[] body = new byte[request.Body.Length - request.Body.Position]; + reader.Read(body, 0, body.Length); + ASCIIEncoding enc = new ASCIIEncoding(); + string message = enc.GetString(body); + Console.WriteLine("Request: " + message); + + // Transform message content to upper case + string responseBody = message.ToUpper(); + + // Send it back to the user + response.clearData(); + response.appendData(Encoding.UTF8.GetBytes(responseBody)); + _session.messageTransfer("amq.direct", routingKey, response); + + // Add this message to the list of message to be acknowledged + _range.add(request.Id); + if (message.Equals("That's all, folks!")) + { + // Acknowledge all the received messages + _session.messageAccept(_range); + lock (_session) + { + Monitor.Pulse(_session); + } + } + } + } +} diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/example-request-response-Server.csproj b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/example-request-response-Server.csproj index be61ddaf01..f747f5692d 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/example-request-response-Server.csproj +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/example-request-response-Server.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{922FBA9C-E483-4AEF-ABE8-AC87421E829B}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>example_request_response_Server</RootNamespace>
- <AssemblyName>example-request-response-Server</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Server.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{922FBA9C-E483-4AEF-ABE8-AC87421E829B}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>example_request_response_Server</RootNamespace> + <AssemblyName>example-request-response-Server</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Server.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/gentool/build.xml b/qpid/dotnet/client-010/gentool/build.xml index dc8e51acfb..26fa65545c 100644 --- a/qpid/dotnet/client-010/gentool/build.xml +++ b/qpid/dotnet/client-010/gentool/build.xml @@ -1,52 +1,52 @@ -<!--
- -
- - 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 name="GenTool" default="build">
-
- <property name="generated.dir" location="../client/" />
- <property name="gentools.timestamp" location="${generated.dir}/gentools.timestamp" />
- <property name="jython.timestamp" location="${generated.dir}/jython.timestamp" />
- <property name="java.basedir" location="../../../java/common" />
- <property name="mllib.dir" location="../../../python" />
- <property name="xml.spec.dir" location="../../../specs" />
-
-
- <target name="check_jython_deps">
- <uptodate property="jython.notRequired" targetfile="${jython.timestamp}">
- <srcfiles dir="${xml.spec.dir}" includes="amqp.0-10-qpid-errata.xml" />
- </uptodate>
- </target>
-
- <target name="build" depends="check_jython_deps" unless="jython.notRequired">
- <java classname="org.python.util.jython" fork="true" failonerror="true">
- <arg value="-Dpython.cachedir.skip=true"/>
- <arg value="-Dpython.path=${java.basedir}/../lib/jython-lib.jar/Lib${path.separator}${mllib.dir}${path.separator}${java.basedir}${path.separator}${basedir}"/>
- <arg value="${basedir}/codegen"/>
- <arg value="${generated.dir}"/>
- <arg value="${xml.spec.dir}/amqp.0-10-qpid-errata.xml"/>
- <arg value="${basedir}"/>
- <classpath>
- <pathelement location="${java.basedir}/../lib/jython-2.2-rc2.jar"/>
- </classpath>
- </java>
- <touch file="${jython.timestamp}" />
- </target>
-
-</project>
+<!-- + - + - 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 name="GenTool" default="build"> + + <property name="generated.dir" location="../client/" /> + <property name="gentools.timestamp" location="${generated.dir}/gentools.timestamp" /> + <property name="jython.timestamp" location="${generated.dir}/jython.timestamp" /> + <property name="java.basedir" location="../../../java/common" /> + <property name="mllib.dir" location="../../../python" /> + <property name="xml.spec.dir" location="../../../specs" /> + + + <target name="check_jython_deps"> + <uptodate property="jython.notRequired" targetfile="${jython.timestamp}"> + <srcfiles dir="${xml.spec.dir}" includes="amqp.0-10-qpid-errata.xml" /> + </uptodate> + </target> + + <target name="build" depends="check_jython_deps" unless="jython.notRequired"> + <java classname="org.python.util.jython" fork="true" failonerror="true"> + <arg value="-Dpython.cachedir.skip=true"/> + <arg value="-Dpython.path=${java.basedir}/../lib/jython-lib.jar/Lib${path.separator}${mllib.dir}${path.separator}${java.basedir}${path.separator}${basedir}"/> + <arg value="${basedir}/codegen"/> + <arg value="${generated.dir}"/> + <arg value="${xml.spec.dir}/amqp.0-10-qpid-errata.xml"/> + <arg value="${basedir}"/> + <classpath> + <pathelement location="${java.basedir}/../lib/jython-2.2-rc2.jar"/> + </classpath> + </java> + <touch file="${jython.timestamp}" /> + </target> + +</project> diff --git a/qpid/dotnet/client-010/lib/log4net/log4net-licence.txt b/qpid/dotnet/client-010/lib/log4net/log4net-licence.txt index 29f81d812f..261eeb9e9f 100644 --- a/qpid/dotnet/client-010/lib/log4net/log4net-licence.txt +++ b/qpid/dotnet/client-010/lib/log4net/log4net-licence.txt @@ -1,201 +1,201 @@ - Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
+ Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/qpid/dotnet/client-010/lib/nunit/nunit-licence.txt b/qpid/dotnet/client-010/lib/nunit/nunit-licence.txt index e6275d834b..b2316295d3 100644 --- a/qpid/dotnet/client-010/lib/nunit/nunit-licence.txt +++ b/qpid/dotnet/client-010/lib/nunit/nunit-licence.txt @@ -1,23 +1,23 @@ -Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov,
- Charlie Poole
-Copyright © 2000-2004 Philip A. Craig
-
-This software is provided 'as-is', without any express or implied warranty. In
-no event will the authors be held liable for any damages arising from the use
-of this software.
-
-Permission is granted to anyone to use this software for any purpose, including
-commercial applications, and to alter it and redistribute it freely, subject to
-the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not claim
- that you wrote the original software. If you use this software in a product, an
- acknowledgment (see the following) in the product documentation is required.
-
- Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
- or Copyright © 2000-2002 Philip A. Craig
-
-2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source distribution.
+Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, + Charlie Poole +Copyright © 2000-2004 Philip A. Craig + +This software is provided 'as-is', without any express or implied warranty. In +no event will the authors be held liable for any damages arising from the use +of this software. + +Permission is granted to anyone to use this software for any purpose, including +commercial applications, and to alter it and redistribute it freely, subject to +the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim + that you wrote the original software. If you use this software in a product, an + acknowledgment (see the following) in the product documentation is required. + + Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov + or Copyright © 2000-2002 Philip A. Craig + +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. diff --git a/qpid/dotnet/client-010/lib/plossum/C5-License.txt b/qpid/dotnet/client-010/lib/plossum/C5-License.txt index e1c0876081..5649c70cf3 100644 --- a/qpid/dotnet/client-010/lib/plossum/C5-License.txt +++ b/qpid/dotnet/client-010/lib/plossum/C5-License.txt @@ -1,27 +1,27 @@ ------------------------------------------------------------------------------
-
-The following license applies to the C5 library (found in C5.dll and C5.pdb)
-The source code for this library together with more information can be found on
-http://www.itu.dk/research/c5/.
-
------------------------------------------------------------------------------
-
-Copyright (c) 2003-2007 Niels Kokholm and Peter Sestoft.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+----------------------------------------------------------------------------- + +The following license applies to the C5 library (found in C5.dll and C5.pdb) +The source code for this library together with more information can be found on +http://www.itu.dk/research/c5/. + +----------------------------------------------------------------------------- + +Copyright (c) 2003-2007 Niels Kokholm and Peter Sestoft. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/qpid/dotnet/client-010/lib/plossum/license.txt b/qpid/dotnet/client-010/lib/plossum/license.txt index 714c2d8821..532b9c11a3 100644 --- a/qpid/dotnet/client-010/lib/plossum/license.txt +++ b/qpid/dotnet/client-010/lib/plossum/license.txt @@ -1,28 +1,28 @@ -Copyright (c) Peter Palotas 2007
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the distribution.
- * Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Copyright (c) Peter Palotas 2007 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/qpid/dotnet/client-010/management/console/console.sln b/qpid/dotnet/client-010/management/console/console.sln index d5e70001a5..8c08a9a2ce 100644 --- a/qpid/dotnet/client-010/management/console/console.sln +++ b/qpid/dotnet/client-010/management/console/console.sln @@ -1,20 +1,20 @@ -
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console", "console.csproj", "{42E3CD17-EFDC-4533-95AA-4AF67FF534B5}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {42E3CD17-EFDC-4533-95AA-4AF67FF534B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {42E3CD17-EFDC-4533-95AA-4AF67FF534B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {42E3CD17-EFDC-4533-95AA-4AF67FF534B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {42E3CD17-EFDC-4533-95AA-4AF67FF534B5}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = console.csproj
- EndGlobalSection
-EndGlobal
+ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console", "console.csproj", "{42E3CD17-EFDC-4533-95AA-4AF67FF534B5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {42E3CD17-EFDC-4533-95AA-4AF67FF534B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42E3CD17-EFDC-4533-95AA-4AF67FF534B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42E3CD17-EFDC-4533-95AA-4AF67FF534B5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42E3CD17-EFDC-4533-95AA-4AF67FF534B5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = console.csproj + EndGlobalSection +EndGlobal diff --git a/qpid/dotnet/client-010/perftest/README.txt b/qpid/dotnet/client-010/perftest/README.txt index fadde27693..1c920a30b6 100644 --- a/qpid/dotnet/client-010/perftest/README.txt +++ b/qpid/dotnet/client-010/perftest/README.txt @@ -1,38 +1,38 @@ -There are two ways to use perftest:
-- single process:
-If none of the -Setup, -Publish, -Subscribe or -Control options are given perftest will run a single-process test.
-- multi-process:
-For a multi-process test first run:
-Perftest.exe -Setup <other options>
-and wait for it to complete. The remaining process should run concurrently:
-Run -Pubs times: Perftest.exe -Publish <other options>
-Run -Subs times: Perftest.exe -Subscribe <other options>
-Run once: Perftest.exe -Control <other options>
-Note the <other options> must be identical for all processes.
-
-Options:
- -Broker Specifies the broler name
- -Confirm Publisher use confirm-mode.
- -Control Run test, print report.
- -Count Each publisher sends N messages.
- -Durable Publish messages as durable.
- -Help Displays this help text
- -IntervalPub >=0 delay between msg publish.
- -IntervalSub >=0 delay between msg consume
- -Iterations Desired number of iterations of the test.
- -Mode Test mode: [shared|fanout|topic]
- -Port Specifies the port name
- -Publish Publish messages.
- -Pubs Create N publishers.
- -QueueDurable Make queue durable (implied if durable set.
- -QueueMaxCount Queue policy: count to trigger 'flow to disk'
- -QueueMaxSize Queue policy: accumulated size to trigger 'flow to disk'
- -Queues Create N queues.
- -Setup Create shared queues.
- -Size Size of messages in bytes.
- -SubAck N>0: Subscriber acks batches of N. N==0: Subscriber uses unconfirmed mode
- -Subs Create N subscribers.
- -Subscribe Subscribe for messages.
- -SyncPub Wait for confirmation of each message before sending the next one.
- -Tx If non-zero, the transaction batch size.
+There are two ways to use perftest: +- single process: +If none of the -Setup, -Publish, -Subscribe or -Control options are given perftest will run a single-process test. +- multi-process: +For a multi-process test first run: +Perftest.exe -Setup <other options> +and wait for it to complete. The remaining process should run concurrently: +Run -Pubs times: Perftest.exe -Publish <other options> +Run -Subs times: Perftest.exe -Subscribe <other options> +Run once: Perftest.exe -Control <other options> +Note the <other options> must be identical for all processes. + +Options: + -Broker Specifies the broler name + -Confirm Publisher use confirm-mode. + -Control Run test, print report. + -Count Each publisher sends N messages. + -Durable Publish messages as durable. + -Help Displays this help text + -IntervalPub >=0 delay between msg publish. + -IntervalSub >=0 delay between msg consume + -Iterations Desired number of iterations of the test. + -Mode Test mode: [shared|fanout|topic] + -Port Specifies the port name + -Publish Publish messages. + -Pubs Create N publishers. + -QueueDurable Make queue durable (implied if durable set. + -QueueMaxCount Queue policy: count to trigger 'flow to disk' + -QueueMaxSize Queue policy: accumulated size to trigger 'flow to disk' + -Queues Create N queues. + -Setup Create shared queues. + -Size Size of messages in bytes. + -SubAck N>0: Subscriber acks batches of N. N==0: Subscriber uses unconfirmed mode + -Subs Create N subscribers. + -Subscribe Subscribe for messages. + -SyncPub Wait for confirmation of each message before sending the next one. + -Tx If non-zero, the transaction batch size. -UniqueData Make data for each message unique.
\ No newline at end of file diff --git a/qpid/dotnet/client-010/perftest/perftest.csproj b/qpid/dotnet/client-010/perftest/perftest.csproj index f8fa7aa27c..57e49cc954 100644 --- a/qpid/dotnet/client-010/perftest/perftest.csproj +++ b/qpid/dotnet/client-010/perftest/perftest.csproj @@ -1,67 +1,67 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>perftest</RootNamespace>
- <AssemblyName>perftest</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="C5, Version=1.0.2.0, Culture=neutral, PublicKeyToken=06a1b38866503b69, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\plossum\C5.dll</HintPath>
- </Reference>
- <Reference Include="Plossum CommandLine, Version=0.3.0.14, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\plossum\Plossum CommandLine.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="PerfTest.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>perftest</RootNamespace> + <AssemblyName>perftest</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="C5, Version=1.0.2.0, Culture=neutral, PublicKeyToken=06a1b38866503b69, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\lib\plossum\C5.dll</HintPath> + </Reference> + <Reference Include="Plossum CommandLine, Version=0.3.0.14, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\lib\plossum\Plossum CommandLine.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="PerfTest.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/test/Test.csproj b/qpid/dotnet/client-010/test/Test.csproj index e2680e16bc..f5f338aebb 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -1,75 +1,75 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95CB4C90-7C53-44A9-B11C-96235F158ACA}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>test</RootNamespace>
- <AssemblyName>Qpid Test</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\log4net\log4net.dll</HintPath>
- </Reference>
- <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\nunit\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="interop\Admin.cs" />
- <Compile Include="interop\ApplicationHeaders.cs" />
- <Compile Include="interop\Message.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="interop\TestCase.cs" />
- <Compile Include="transport\util\ByteEncoderTest.cs" />
- <Compile Include="transport\util\CircularBufferTest.cs" />
- <Compile Include="transport\util\ResultFutureTest.cs" />
- <Compile Include="transport\util\SerialTest.cs" />
- <Compile Include="transport\util\UUIDTest.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\client\Client.csproj">
- <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
- <Name>Client</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95CB4C90-7C53-44A9-B11C-96235F158ACA}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>test</RootNamespace> + <AssemblyName>Qpid Test</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\lib\log4net\log4net.dll</HintPath> + </Reference> + <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\lib\nunit\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="interop\Admin.cs" /> + <Compile Include="interop\ApplicationHeaders.cs" /> + <Compile Include="interop\Message.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="interop\TestCase.cs" /> + <Compile Include="transport\util\ByteEncoderTest.cs" /> + <Compile Include="transport\util\CircularBufferTest.cs" /> + <Compile Include="transport\util\ResultFutureTest.cs" /> + <Compile Include="transport\util\SerialTest.cs" /> + <Compile Include="transport\util\UUIDTest.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\client\Client.csproj"> + <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project> + <Name>Client</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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/dotnet/client-010/test/interop/Admin.cs b/qpid/dotnet/client-010/test/interop/Admin.cs index 93b24ea505..18ab58599a 100644 --- a/qpid/dotnet/client-010/test/interop/Admin.cs +++ b/qpid/dotnet/client-010/test/interop/Admin.cs @@ -1,90 +1,90 @@ -/*
-*
-* 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 NUnit.Framework;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace test.interop
-{
- public class Admin:TestCase
- {
- private static readonly Logger _log = Logger.get(typeof(Admin));
-
- [Test]
- public void createSession()
- {
- _log.debug("Running: createSession");
- ClientSession ssn = Client.createSession(0);
- ssn.close();
- // This test fails if an exception is thrown
- }
-
- [Test]
- public void queueLifecycle()
- {
- _log.debug("Running: queueLifecycle");
- ClientSession ssn = Client.createSession(0);
- ssn.queueDeclare("queue1", null, null);
- ssn.sync();
- ssn.queueDelete("queue1");
- ssn.sync();
- try
- {
- ssn.exchangeBind("queue1", "amq.direct", "queue1", null);
- ssn.sync();
- }
- catch (SessionException e)
- {
- // as expected
- }
- // This test fails if an exception is thrown
- }
-
- [Test]
- public void exchangeCheck()
- {
- _log.debug("Running: exchangeCheck");
- ClientSession ssn = Client.createSession(0);
- ExchangeQueryResult query = (ExchangeQueryResult) ssn.exchangeQuery("amq.direct").Result;
- Assert.IsFalse(query.getNotFound());
- Assert.IsTrue(query.getDurable());
- query = (ExchangeQueryResult)ssn.exchangeQuery("amq.topic").Result;
- Assert.IsFalse(query.getNotFound());
- Assert.IsTrue(query.getDurable());
- query = (ExchangeQueryResult) ssn.exchangeQuery("foo").Result;
- Assert.IsTrue(query.getNotFound());
- }
-
- [Test]
- public void exchangeBind()
- {
- _log.debug("Running: exchangeBind");
- ClientSession ssn = Client.createSession(0);
- ssn.queueDeclare("queue1", null, null);
- ssn.exchangeBind("queue1", "amq.direct", "queue1", null);
- // This test fails if an exception is thrown
- }
-
-
- }
-}
+/* +* +* 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 NUnit.Framework; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace test.interop +{ + public class Admin:TestCase + { + private static readonly Logger _log = Logger.get(typeof(Admin)); + + [Test] + public void createSession() + { + _log.debug("Running: createSession"); + ClientSession ssn = Client.createSession(0); + ssn.close(); + // This test fails if an exception is thrown + } + + [Test] + public void queueLifecycle() + { + _log.debug("Running: queueLifecycle"); + ClientSession ssn = Client.createSession(0); + ssn.queueDeclare("queue1", null, null); + ssn.sync(); + ssn.queueDelete("queue1"); + ssn.sync(); + try + { + ssn.exchangeBind("queue1", "amq.direct", "queue1", null); + ssn.sync(); + } + catch (SessionException e) + { + // as expected + } + // This test fails if an exception is thrown + } + + [Test] + public void exchangeCheck() + { + _log.debug("Running: exchangeCheck"); + ClientSession ssn = Client.createSession(0); + ExchangeQueryResult query = (ExchangeQueryResult) ssn.exchangeQuery("amq.direct").Result; + Assert.IsFalse(query.getNotFound()); + Assert.IsTrue(query.getDurable()); + query = (ExchangeQueryResult)ssn.exchangeQuery("amq.topic").Result; + Assert.IsFalse(query.getNotFound()); + Assert.IsTrue(query.getDurable()); + query = (ExchangeQueryResult) ssn.exchangeQuery("foo").Result; + Assert.IsTrue(query.getNotFound()); + } + + [Test] + public void exchangeBind() + { + _log.debug("Running: exchangeBind"); + ClientSession ssn = Client.createSession(0); + ssn.queueDeclare("queue1", null, null); + ssn.exchangeBind("queue1", "amq.direct", "queue1", null); + // This test fails if an exception is thrown + } + + + } +} diff --git a/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs b/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs index 9e27673a49..5dbb9e15e2 100644 --- a/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs +++ b/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs @@ -1,83 +1,83 @@ -/*
-*
-* 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 common.org.apache.qpid.transport.util;
-using NUnit.Framework;
-using org.apache.qpid.client;
-using org.apache.qpid.transport.util;
-
-namespace test.interop
-{
- public class ApplicationHeaders:TestCase
- {
- private static readonly Logger _log = Logger.get(typeof(ApplicationHeaders));
-
- [Test]
- public void setHeaders()
- {
- _log.debug("Running: setHeaders");
- ClientSession ssn = Client.createSession(0);
- ssn.queueDeclare("queue1");
- ssn.exchangeBind("queue1", "amq.direct", "queue1");
- ssn.sync();
- CircularBuffer<IMessage> buff = new CircularBuffer<IMessage>(10);
- SyncListener listener = new SyncListener(ssn, buff);
- ssn.attachMessageListener(listener, "queue1");
- ssn.messageSubscribe("queue1");
-
- IMessage message = new org.apache.qpid.client.Message();
- message.DeliveryProperties.setRoutingKey("queue1");
- const long someLong = 14444444;
- message.ApplicationHeaders.Add("someLong", someLong);
- const int someInt = 14;
- message.ApplicationHeaders.Add("soneInt", someInt);
- const float someFloat = 14.001F;
- message.ApplicationHeaders.Add("soneFloat", someFloat);
- const double someDouble = 14.5555555;
- message.ApplicationHeaders.Add("someDouble", someDouble);
- const byte someByte = 2;
- message.ApplicationHeaders.Add("someByte", someByte);
- const string someString = "someString";
- message.ApplicationHeaders.Add("someString", someString);
- const char someChar = 'a';
- message.ApplicationHeaders.Add("someChar", someChar);
- const Boolean someBoolean = true;
- message.ApplicationHeaders.Add("someBoolean", someBoolean);
-
- // transfer the message
- ssn.messageTransfer("amq.direct", message);
-
- // get the message and check the headers
- IMessage messageBack = buff.Dequeue();
- Assert.IsTrue(((string) messageBack.ApplicationHeaders["someString"]).Equals(someString));
- Assert.IsTrue(((char)messageBack.ApplicationHeaders["someChar"]).Equals(someChar));
- Assert.IsTrue((long)messageBack.ApplicationHeaders["someLong"] == someLong);
- Assert.IsTrue((int)messageBack.ApplicationHeaders["soneInt"] == someInt);
- Assert.IsTrue((double)messageBack.ApplicationHeaders["someDouble"] == someDouble);
- Assert.IsTrue((byte) messageBack.ApplicationHeaders["someByte"] == someByte);
- Assert.IsTrue((Boolean)messageBack.ApplicationHeaders["someBoolean"]);
- // c# has an conversion precision issue with decimal
- Assert.IsTrue((float) messageBack.ApplicationHeaders["soneFloat"] <= someFloat);
- float b = (float) messageBack.ApplicationHeaders["soneFloat"];
- Assert.IsTrue(Convert.ToInt32(b) == Convert.ToInt32(someFloat));
- }
- }
-}
+/* +* +* 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 common.org.apache.qpid.transport.util; +using NUnit.Framework; +using org.apache.qpid.client; +using org.apache.qpid.transport.util; + +namespace test.interop +{ + public class ApplicationHeaders:TestCase + { + private static readonly Logger _log = Logger.get(typeof(ApplicationHeaders)); + + [Test] + public void setHeaders() + { + _log.debug("Running: setHeaders"); + ClientSession ssn = Client.createSession(0); + ssn.queueDeclare("queue1"); + ssn.exchangeBind("queue1", "amq.direct", "queue1"); + ssn.sync(); + CircularBuffer<IMessage> buff = new CircularBuffer<IMessage>(10); + SyncListener listener = new SyncListener(ssn, buff); + ssn.attachMessageListener(listener, "queue1"); + ssn.messageSubscribe("queue1"); + + IMessage message = new org.apache.qpid.client.Message(); + message.DeliveryProperties.setRoutingKey("queue1"); + const long someLong = 14444444; + message.ApplicationHeaders.Add("someLong", someLong); + const int someInt = 14; + message.ApplicationHeaders.Add("soneInt", someInt); + const float someFloat = 14.001F; + message.ApplicationHeaders.Add("soneFloat", someFloat); + const double someDouble = 14.5555555; + message.ApplicationHeaders.Add("someDouble", someDouble); + const byte someByte = 2; + message.ApplicationHeaders.Add("someByte", someByte); + const string someString = "someString"; + message.ApplicationHeaders.Add("someString", someString); + const char someChar = 'a'; + message.ApplicationHeaders.Add("someChar", someChar); + const Boolean someBoolean = true; + message.ApplicationHeaders.Add("someBoolean", someBoolean); + + // transfer the message + ssn.messageTransfer("amq.direct", message); + + // get the message and check the headers + IMessage messageBack = buff.Dequeue(); + Assert.IsTrue(((string) messageBack.ApplicationHeaders["someString"]).Equals(someString)); + Assert.IsTrue(((char)messageBack.ApplicationHeaders["someChar"]).Equals(someChar)); + Assert.IsTrue((long)messageBack.ApplicationHeaders["someLong"] == someLong); + Assert.IsTrue((int)messageBack.ApplicationHeaders["soneInt"] == someInt); + Assert.IsTrue((double)messageBack.ApplicationHeaders["someDouble"] == someDouble); + Assert.IsTrue((byte) messageBack.ApplicationHeaders["someByte"] == someByte); + Assert.IsTrue((Boolean)messageBack.ApplicationHeaders["someBoolean"]); + // c# has an conversion precision issue with decimal + Assert.IsTrue((float) messageBack.ApplicationHeaders["soneFloat"] <= someFloat); + float b = (float) messageBack.ApplicationHeaders["soneFloat"]; + Assert.IsTrue(Convert.ToInt32(b) == Convert.ToInt32(someFloat)); + } + } +} diff --git a/qpid/dotnet/client-010/test/interop/Message.cs b/qpid/dotnet/client-010/test/interop/Message.cs index 3267af9c0c..935978864c 100644 --- a/qpid/dotnet/client-010/test/interop/Message.cs +++ b/qpid/dotnet/client-010/test/interop/Message.cs @@ -1,179 +1,179 @@ -/*
-*
-* 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.Text;
-using System.Threading;
-using NUnit.Framework;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace test.interop
-{
- public class Message : TestCase
- {
- private static readonly Logger _log = Logger.get(typeof (Message));
-
- [Test]
- public void sendAndPurge()
- {
- _log.debug("Running: exchangeBind");
- ClientSession ssn = Client.createSession(0);
- ssn.queueDelete("queue1");
- QueueQueryResult result = (QueueQueryResult) ssn.queueQuery("queue1").Result;
- Assert.IsNull(result.getQueue());
- ssn.queueDeclare("queue1", null, null);
- ssn.exchangeBind("queue1", "amq.direct", "queue1", null);
- for (int i = 0; i < 10; i++)
- {
- ssn.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- new Header(new DeliveryProperties().setRoutingKey("queue1"),
- new MessageProperties().setMessageId(UUID.randomUUID())),
- Encoding.UTF8.GetBytes("test: " + i));
- }
- ssn.sync();
- result = (QueueQueryResult) ssn.queueQuery("queue1").Result;
- Assert.IsTrue(result.getMessageCount() == 10);
- ssn.queuePurge("queue1");
- ssn.sync();
- result = (QueueQueryResult) ssn.queueQuery("queue1").Result;
- Assert.IsTrue(result.getMessageCount() == 0);
- }
-
- [Test]
- public void sendAndReceiveSmallMessages()
- {
- _log.debug("Running: sendAndReceiveSmallMessages");
- byte[] smallMessage = Encoding.UTF8.GetBytes("test");
- sendAndReceive(smallMessage, 100);
- }
-
- [Test]
- public void sendAndReceiveLargeMessages()
- {
- _log.debug("Running: sendAndReceiveSmallMessages");
- byte[] largeMessage = new byte[100 * 1024];
- Random random = new Random();
- random.NextBytes(largeMessage);
- sendAndReceive(largeMessage, 10);
- }
-
- [Test]
- public void sendAndReceiveVeryLargeMessages()
- {
- _log.debug("Running: sendAndReceiveSmallMessages");
- byte[] verylargeMessage = new byte[1000 * 1024];
- Random random = new Random();
- random.NextBytes(verylargeMessage);
- sendAndReceive(verylargeMessage, 2);
- }
-
- private void sendAndReceive(byte[] messageBody, int count)
- {
- ClientSession ssn = Client.createSession(0);
- ssn.sync();
- ssn.queueDeclare("queue1", null, null);
- ssn.queueDelete("queue1");
- QueueQueryResult result = (QueueQueryResult) ssn.queueQuery("queue1").Result;
- Assert.IsNull(result.getQueue());
- ssn.queueDeclare("queue1", null, null);
- ssn.exchangeBind("queue1", "amq.direct", "queue1", null);
- Object myLock = new Object();
- MyListener myListener = new MyListener(myLock, count);
- ssn.attachMessageListener(myListener, "myDest");
-
- ssn.messageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null,
- 0, null);
-
-
- // issue credits
- ssn.messageSetFlowMode("myDest", MessageFlowMode.WINDOW);
- ssn.messageFlow("myDest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES);
- ssn.messageFlow("myDest", MessageCreditUnit.MESSAGE, 10000);
- ssn.sync();
-
- for (int i = 0; i < count; i++)
- {
- ssn.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- new Header(new DeliveryProperties().setRoutingKey("queue1"),
- new MessageProperties().setMessageId(UUID.randomUUID())),
- messageBody);
- }
- ssn.sync();
-
- lock (myLock)
- {
- if (myListener.Count != 0)
- {
- Monitor.Wait(myLock, 10000000);
- }
- }
- Assert.IsTrue(myListener.Count == 0);
- ssn.messageAccept(myListener.UnAck);
- ssn.sync();
- // the queue should be empty
- result = (QueueQueryResult)ssn.queueQuery("queue1").Result;
- Assert.IsTrue(result.getMessageCount() == 0);
- ssn.close();
- }
-
-
-
- private class MyListener : IMessageListener
- {
- private static readonly Logger _log = Logger.get(typeof (MyListener));
- private readonly Object _wl;
- private int _count;
- private RangeSet _rs = new RangeSet();
-
- public MyListener(Object wl, int count)
- {
- _wl = wl;
- _count = count;
- }
-
- public void messageTransfer(IMessage m)
- {
- byte[] body = new byte[m.Body.Length - m.Body.Position];
- _log.debug("Got a message of size: " + body.Length + " count = " + _count);
- _rs.add(m.Id);
- lock (_wl)
- {
- _count--;
- if (_count == 0)
- {
- Monitor.PulseAll(_wl);
- }
- }
- }
-
- public int Count
- {
- get { return _count; }
- }
-
- public RangeSet UnAck
- {
- get { return _rs; }
- }
- }
- }
-}
+/* +* +* 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.Text; +using System.Threading; +using NUnit.Framework; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace test.interop +{ + public class Message : TestCase + { + private static readonly Logger _log = Logger.get(typeof (Message)); + + [Test] + public void sendAndPurge() + { + _log.debug("Running: exchangeBind"); + ClientSession ssn = Client.createSession(0); + ssn.queueDelete("queue1"); + QueueQueryResult result = (QueueQueryResult) ssn.queueQuery("queue1").Result; + Assert.IsNull(result.getQueue()); + ssn.queueDeclare("queue1", null, null); + ssn.exchangeBind("queue1", "amq.direct", "queue1", null); + for (int i = 0; i < 10; i++) + { + ssn.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, + new Header(new DeliveryProperties().setRoutingKey("queue1"), + new MessageProperties().setMessageId(UUID.randomUUID())), + Encoding.UTF8.GetBytes("test: " + i)); + } + ssn.sync(); + result = (QueueQueryResult) ssn.queueQuery("queue1").Result; + Assert.IsTrue(result.getMessageCount() == 10); + ssn.queuePurge("queue1"); + ssn.sync(); + result = (QueueQueryResult) ssn.queueQuery("queue1").Result; + Assert.IsTrue(result.getMessageCount() == 0); + } + + [Test] + public void sendAndReceiveSmallMessages() + { + _log.debug("Running: sendAndReceiveSmallMessages"); + byte[] smallMessage = Encoding.UTF8.GetBytes("test"); + sendAndReceive(smallMessage, 100); + } + + [Test] + public void sendAndReceiveLargeMessages() + { + _log.debug("Running: sendAndReceiveSmallMessages"); + byte[] largeMessage = new byte[100 * 1024]; + Random random = new Random(); + random.NextBytes(largeMessage); + sendAndReceive(largeMessage, 10); + } + + [Test] + public void sendAndReceiveVeryLargeMessages() + { + _log.debug("Running: sendAndReceiveSmallMessages"); + byte[] verylargeMessage = new byte[1000 * 1024]; + Random random = new Random(); + random.NextBytes(verylargeMessage); + sendAndReceive(verylargeMessage, 2); + } + + private void sendAndReceive(byte[] messageBody, int count) + { + ClientSession ssn = Client.createSession(0); + ssn.sync(); + ssn.queueDeclare("queue1", null, null); + ssn.queueDelete("queue1"); + QueueQueryResult result = (QueueQueryResult) ssn.queueQuery("queue1").Result; + Assert.IsNull(result.getQueue()); + ssn.queueDeclare("queue1", null, null); + ssn.exchangeBind("queue1", "amq.direct", "queue1", null); + Object myLock = new Object(); + MyListener myListener = new MyListener(myLock, count); + ssn.attachMessageListener(myListener, "myDest"); + + ssn.messageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, + 0, null); + + + // issue credits + ssn.messageSetFlowMode("myDest", MessageFlowMode.WINDOW); + ssn.messageFlow("myDest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + ssn.messageFlow("myDest", MessageCreditUnit.MESSAGE, 10000); + ssn.sync(); + + for (int i = 0; i < count; i++) + { + ssn.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, + new Header(new DeliveryProperties().setRoutingKey("queue1"), + new MessageProperties().setMessageId(UUID.randomUUID())), + messageBody); + } + ssn.sync(); + + lock (myLock) + { + if (myListener.Count != 0) + { + Monitor.Wait(myLock, 10000000); + } + } + Assert.IsTrue(myListener.Count == 0); + ssn.messageAccept(myListener.UnAck); + ssn.sync(); + // the queue should be empty + result = (QueueQueryResult)ssn.queueQuery("queue1").Result; + Assert.IsTrue(result.getMessageCount() == 0); + ssn.close(); + } + + + + private class MyListener : IMessageListener + { + private static readonly Logger _log = Logger.get(typeof (MyListener)); + private readonly Object _wl; + private int _count; + private RangeSet _rs = new RangeSet(); + + public MyListener(Object wl, int count) + { + _wl = wl; + _count = count; + } + + public void messageTransfer(IMessage m) + { + byte[] body = new byte[m.Body.Length - m.Body.Position]; + _log.debug("Got a message of size: " + body.Length + " count = " + _count); + _rs.add(m.Id); + lock (_wl) + { + _count--; + if (_count == 0) + { + Monitor.PulseAll(_wl); + } + } + } + + public int Count + { + get { return _count; } + } + + public RangeSet UnAck + { + get { return _rs; } + } + } + } +} diff --git a/qpid/dotnet/client-010/test/interop/TestCase.cs b/qpid/dotnet/client-010/test/interop/TestCase.cs index 8877de50cb..8e3f2a3085 100644 --- a/qpid/dotnet/client-010/test/interop/TestCase.cs +++ b/qpid/dotnet/client-010/test/interop/TestCase.cs @@ -1,117 +1,117 @@ -/*
-*
-* 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.IO;
-using System.Threading;
-using System.Xml;
-using common.org.apache.qpid.transport.util;
-using log4net.Config;
-using NUnit.Framework;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace test.interop
-{
- [TestFixture]
-
- public class TestCase
- {
- private readonly Dictionary<string,string> _properties = new Dictionary<string, string>();
- private Client _client;
-
- [TestFixtureSetUp]
- public void Init()
- {
- XmlConfigurator.Configure(new FileInfo("/log.xml"));
- // populate default properties
- _properties.Add("UserName", "guest");
- _properties.Add("Password", "guest");
- _properties.Add("Host", "localhost");
- _properties.Add("Port", "5672");
- _properties.Add("VirtualHost", "test");
- //Read the test config file
- XmlTextReader reader = new XmlTextReader(Environment.CurrentDirectory + "/test.config");
- while (reader.Read())
- {
- // if node type is an element
- if (reader.NodeType == XmlNodeType.Element && reader.Name.Equals("add"))
- {
- if (_properties.ContainsKey(reader.GetAttribute("key")))
- {
- _properties[reader.GetAttribute("key")] = reader.GetAttribute("value");
- }
- else
- {
- _properties.Add(reader.GetAttribute("key"), reader.GetAttribute("value"));
- }
-
- }
- }
- // create a client and connect to the broker
- _client = new Client();
- _client.connect(Properties["Host"], Convert.ToInt16(Properties["Port"]), Properties["VirtualHost"],
- Properties["UserName"], Properties["Password"]);
-
- }
-
- [TestFixtureTearDown]
- public void Cleanup()
- {
- _client.close();
- }
-
- public Client Client
- {
- get{ return _client;}
- }
-
- public Dictionary<string,string> Properties
- {
- get { return _properties; }
- }
-
-
- public class SyncListener : IMessageListener
- {
- private static readonly Logger _log = Logger.get(typeof(SyncListener));
- private readonly CircularBuffer<IMessage> _buffer;
- private readonly RangeSet _range = new RangeSet();
- private readonly ClientSession _session;
-
- public SyncListener(ClientSession session, CircularBuffer<IMessage> buffer)
- {
- _buffer = buffer;
- _session = session;
- }
-
- public void messageTransfer(IMessage m)
- {
- _range.clear();
- _range.add(m.Id);
- _session.messageAccept(_range);
- _buffer.Enqueue(m);
- }
- }
- }
-}
+/* +* +* 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.IO; +using System.Threading; +using System.Xml; +using common.org.apache.qpid.transport.util; +using log4net.Config; +using NUnit.Framework; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace test.interop +{ + [TestFixture] + + public class TestCase + { + private readonly Dictionary<string,string> _properties = new Dictionary<string, string>(); + private Client _client; + + [TestFixtureSetUp] + public void Init() + { + XmlConfigurator.Configure(new FileInfo("/log.xml")); + // populate default properties + _properties.Add("UserName", "guest"); + _properties.Add("Password", "guest"); + _properties.Add("Host", "localhost"); + _properties.Add("Port", "5672"); + _properties.Add("VirtualHost", "test"); + //Read the test config file + XmlTextReader reader = new XmlTextReader(Environment.CurrentDirectory + "/test.config"); + while (reader.Read()) + { + // if node type is an element + if (reader.NodeType == XmlNodeType.Element && reader.Name.Equals("add")) + { + if (_properties.ContainsKey(reader.GetAttribute("key"))) + { + _properties[reader.GetAttribute("key")] = reader.GetAttribute("value"); + } + else + { + _properties.Add(reader.GetAttribute("key"), reader.GetAttribute("value")); + } + + } + } + // create a client and connect to the broker + _client = new Client(); + _client.connect(Properties["Host"], Convert.ToInt16(Properties["Port"]), Properties["VirtualHost"], + Properties["UserName"], Properties["Password"]); + + } + + [TestFixtureTearDown] + public void Cleanup() + { + _client.close(); + } + + public Client Client + { + get{ return _client;} + } + + public Dictionary<string,string> Properties + { + get { return _properties; } + } + + + public class SyncListener : IMessageListener + { + private static readonly Logger _log = Logger.get(typeof(SyncListener)); + private readonly CircularBuffer<IMessage> _buffer; + private readonly RangeSet _range = new RangeSet(); + private readonly ClientSession _session; + + public SyncListener(ClientSession session, CircularBuffer<IMessage> buffer) + { + _buffer = buffer; + _session = session; + } + + public void messageTransfer(IMessage m) + { + _range.clear(); + _range.add(m.Id); + _session.messageAccept(_range); + _buffer.Enqueue(m); + } + } + } +} diff --git a/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs b/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs index 383970ec79..a92741143d 100644 --- a/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs @@ -1,106 +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.
-*
-*/
-using System;
-using NUnit.Framework;
-using org.apache.qpid.transport.util;
-
-
-namespace test.transport.util
-{
- [TestFixture]
-
- public class ByteEncoderTest
- {
- private static readonly Logger _log = Logger.get(typeof(ByteEncoderTest));
-
- [Test]
- public void GetBigEndianInt32()
- {
- _log.debug("Running: GetBigEndianInt32");
- const int anInt = -12345;
- Int32 aNewInt = ByteEncoder.GetBigEndian(anInt);
- Assert.IsTrue( anInt == ByteEncoder.GetBigEndian(aNewInt) );
- }
-
- [Test]
- public void GetBigEndianUInt16()
- {
- _log.debug("Running: GetBigEndianUInt16");
- const UInt16 anInt = 123;
- UInt16 aNewInt = ByteEncoder.GetBigEndian(anInt);
- Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt));
- }
-
- [Test]
- public void GetBigEndianUInt32()
- {
- _log.debug("Running: GetBigEndianUInt32");
- const UInt32 anInt = 12345;
- UInt32 aNewInt = ByteEncoder.GetBigEndian(anInt);
- Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt));
- }
-
- [Test]
- public void GetBigEndianlong()
- {
- _log.debug("Running: GetBigEndianlong");
- const long anInt = 123456660700770;
- long aNewInt = ByteEncoder.GetBigEndian(anInt);
- Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt));
- }
-
- [Test]
- public void GetLittleEndianInt32()
- {
- _log.debug("Running: GetBigEndianInt32");
- const int anInt = -12345;
- Int32 aNewInt = ByteEncoder.GetLittleEndian(anInt);
- Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt));
- }
-
- [Test]
- public void GetLittleEndianUInt16()
- {
- _log.debug("Running: GetLittleEndianUInt16");
- const UInt16 anInt = 123;
- UInt16 aNewInt = ByteEncoder.GetLittleEndian(anInt);
- Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt));
- }
-
- [Test]
- public void GetLittleEndianUInt32()
- {
- _log.debug("Running: GetLittleEndianUInt32");
- const UInt32 anInt = 12345;
- UInt32 aNewInt = ByteEncoder.GetLittleEndian(anInt);
- Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt));
- }
-
- [Test]
- public void GetLittleEndianlong()
- {
- _log.debug("Running: GetLittleEndianlong");
- const long anInt = 123456660700770;
- long aNewInt = ByteEncoder.GetLittleEndian(anInt);
- Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt));
- }
- }
-}
+/* +* +* 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 NUnit.Framework; +using org.apache.qpid.transport.util; + + +namespace test.transport.util +{ + [TestFixture] + + public class ByteEncoderTest + { + private static readonly Logger _log = Logger.get(typeof(ByteEncoderTest)); + + [Test] + public void GetBigEndianInt32() + { + _log.debug("Running: GetBigEndianInt32"); + const int anInt = -12345; + Int32 aNewInt = ByteEncoder.GetBigEndian(anInt); + Assert.IsTrue( anInt == ByteEncoder.GetBigEndian(aNewInt) ); + } + + [Test] + public void GetBigEndianUInt16() + { + _log.debug("Running: GetBigEndianUInt16"); + const UInt16 anInt = 123; + UInt16 aNewInt = ByteEncoder.GetBigEndian(anInt); + Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt)); + } + + [Test] + public void GetBigEndianUInt32() + { + _log.debug("Running: GetBigEndianUInt32"); + const UInt32 anInt = 12345; + UInt32 aNewInt = ByteEncoder.GetBigEndian(anInt); + Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt)); + } + + [Test] + public void GetBigEndianlong() + { + _log.debug("Running: GetBigEndianlong"); + const long anInt = 123456660700770; + long aNewInt = ByteEncoder.GetBigEndian(anInt); + Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt)); + } + + [Test] + public void GetLittleEndianInt32() + { + _log.debug("Running: GetBigEndianInt32"); + const int anInt = -12345; + Int32 aNewInt = ByteEncoder.GetLittleEndian(anInt); + Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt)); + } + + [Test] + public void GetLittleEndianUInt16() + { + _log.debug("Running: GetLittleEndianUInt16"); + const UInt16 anInt = 123; + UInt16 aNewInt = ByteEncoder.GetLittleEndian(anInt); + Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt)); + } + + [Test] + public void GetLittleEndianUInt32() + { + _log.debug("Running: GetLittleEndianUInt32"); + const UInt32 anInt = 12345; + UInt32 aNewInt = ByteEncoder.GetLittleEndian(anInt); + Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt)); + } + + [Test] + public void GetLittleEndianlong() + { + _log.debug("Running: GetLittleEndianlong"); + const long anInt = 123456660700770; + long aNewInt = ByteEncoder.GetLittleEndian(anInt); + Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt)); + } + } +} diff --git a/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs b/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs index 03ac7831c1..3e61af2cd1 100644 --- a/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs @@ -1,89 +1,89 @@ -/*
-*
-* 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.Threading;
-using common.org.apache.qpid.transport.util;
-using NUnit.Framework;
-using org.apache.qpid.transport.util;
-
-namespace test.transport.util
-{
- [TestFixture]
-
- public class CircularBufferTest
- {
- private CircularBuffer<Object> _buf;
- private static readonly Logger _log = Logger.get(typeof(CircularBufferTest));
-
- [Test]
- public void BlockingEnqueue()
- {
- _log.debug("Running: BlockingEnqueue");
- const int size = 10;
- _buf = new CircularBuffer<Object>(size);
- // add size element anc check that the size +1 add blocks
- for (int i = 1; i < size; i++ )
- {
- _buf.Enqueue(new object());
- }
- // check tha the buffer is now full
- Thread t = new Thread(Go);
- t.Start();
- Thread.Sleep(100);
- // the trhead t should block until an element is dequeued
- Assert.IsTrue(t.ThreadState == ThreadState.WaitSleepJoin);
- _buf.Dequeue();
- // t should now be stopped
- Thread.Sleep(100);
- Assert.IsTrue(t.ThreadState == ThreadState.Stopped);
- }
-
- [Test]
- public void Close()
- {
- _log.debug("Running: BlockingEnqueue");
- const int size = 10;
- _buf = new CircularBuffer<Object>(size);
- // add size element anc check that the size +1 add blocks
- for (int i = 1; i < size; i++)
- {
- _buf.Enqueue(new object());
- }
- // check tha the buffer is now full
- Thread t = new Thread(Go);
- t.Start();
- Thread.Sleep(1000);
- // the trhead t should block until the buffer is closed
- Assert.IsTrue(t.ThreadState == ThreadState.WaitSleepJoin);
- _buf.close();
- Thread.Sleep(100);
- // t should now be stopped
- Assert.IsTrue(t.ThreadState == ThreadState.Stopped);
- }
-
- void Go()
- {
- _buf.Enqueue(new object());
- }
-
- }
-}
+/* +* +* 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.Threading; +using common.org.apache.qpid.transport.util; +using NUnit.Framework; +using org.apache.qpid.transport.util; + +namespace test.transport.util +{ + [TestFixture] + + public class CircularBufferTest + { + private CircularBuffer<Object> _buf; + private static readonly Logger _log = Logger.get(typeof(CircularBufferTest)); + + [Test] + public void BlockingEnqueue() + { + _log.debug("Running: BlockingEnqueue"); + const int size = 10; + _buf = new CircularBuffer<Object>(size); + // add size element anc check that the size +1 add blocks + for (int i = 1; i < size; i++ ) + { + _buf.Enqueue(new object()); + } + // check tha the buffer is now full + Thread t = new Thread(Go); + t.Start(); + Thread.Sleep(100); + // the trhead t should block until an element is dequeued + Assert.IsTrue(t.ThreadState == ThreadState.WaitSleepJoin); + _buf.Dequeue(); + // t should now be stopped + Thread.Sleep(100); + Assert.IsTrue(t.ThreadState == ThreadState.Stopped); + } + + [Test] + public void Close() + { + _log.debug("Running: BlockingEnqueue"); + const int size = 10; + _buf = new CircularBuffer<Object>(size); + // add size element anc check that the size +1 add blocks + for (int i = 1; i < size; i++) + { + _buf.Enqueue(new object()); + } + // check tha the buffer is now full + Thread t = new Thread(Go); + t.Start(); + Thread.Sleep(1000); + // the trhead t should block until the buffer is closed + Assert.IsTrue(t.ThreadState == ThreadState.WaitSleepJoin); + _buf.close(); + Thread.Sleep(100); + // t should now be stopped + Assert.IsTrue(t.ThreadState == ThreadState.Stopped); + } + + void Go() + { + _buf.Enqueue(new object()); + } + + } +} diff --git a/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs b/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs index 6b6397168f..2dae4b318e 100644 --- a/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs @@ -1,103 +1,103 @@ -/*
-*
-* 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.Threading;
-using common.org.apache.qpid.transport.util;
-using NUnit.Framework;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.codec;
-using org.apache.qpid.transport.util;
-
-
-namespace test.transport.util
-{
- [TestFixture]
- public class ResultFutureTest
- {
- private static readonly Logger _log = Logger.get(typeof (ByteEncoderTest));
- private static ResultFuture _future;
-
- [Test]
- public void getFutureTimeout()
- {
- _log.debug("Running: getFutureTimeout");
- _future = new ResultFuture();
- _future.Session = new Session(new byte[1]);
- DateTime start = DateTime.Now;
- Struct result = _future.get(1000);
- Assert.IsTrue(DateTime.Now.Subtract(start).TotalMilliseconds >= 1000);
- Assert.IsNull(result);
- }
-
- [Test]
- public void getFuture()
- {
- _log.debug("Running: getFuture");
- _future = new ResultFuture();
- _future.Session = new Session(new byte[1]);
- Thread t = new Thread(Go);
- t.Start();
- Struct result = _future.get(2000);
- Assert.IsNotNull(result);
- }
-
-
- void Go()
- {
- Thread.Sleep(500);
- _future.Result = new myStruct();
- }
- }
-
- public class myStruct:Struct
- {
- public override int getStructType()
- {
- throw new System.NotImplementedException();
- }
-
- public override int getSizeWidth()
- {
- throw new System.NotImplementedException();
- }
-
- public override int getPackWidth()
- {
- throw new System.NotImplementedException();
- }
-
- public override void read(Decoder dec)
- {
- throw new System.NotImplementedException();
- }
-
- public override void write(Encoder enc)
- {
- throw new System.NotImplementedException();
- }
-
- public override Dictionary<string, object> Fields
- {
- get { throw new System.NotImplementedException(); }
- }
- }
-}
+/* +* +* 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.Threading; +using common.org.apache.qpid.transport.util; +using NUnit.Framework; +using org.apache.qpid.transport; +using org.apache.qpid.transport.codec; +using org.apache.qpid.transport.util; + + +namespace test.transport.util +{ + [TestFixture] + public class ResultFutureTest + { + private static readonly Logger _log = Logger.get(typeof (ByteEncoderTest)); + private static ResultFuture _future; + + [Test] + public void getFutureTimeout() + { + _log.debug("Running: getFutureTimeout"); + _future = new ResultFuture(); + _future.Session = new Session(new byte[1]); + DateTime start = DateTime.Now; + Struct result = _future.get(1000); + Assert.IsTrue(DateTime.Now.Subtract(start).TotalMilliseconds >= 1000); + Assert.IsNull(result); + } + + [Test] + public void getFuture() + { + _log.debug("Running: getFuture"); + _future = new ResultFuture(); + _future.Session = new Session(new byte[1]); + Thread t = new Thread(Go); + t.Start(); + Struct result = _future.get(2000); + Assert.IsNotNull(result); + } + + + void Go() + { + Thread.Sleep(500); + _future.Result = new myStruct(); + } + } + + public class myStruct:Struct + { + public override int getStructType() + { + throw new System.NotImplementedException(); + } + + public override int getSizeWidth() + { + throw new System.NotImplementedException(); + } + + public override int getPackWidth() + { + throw new System.NotImplementedException(); + } + + public override void read(Decoder dec) + { + throw new System.NotImplementedException(); + } + + public override void write(Encoder enc) + { + throw new System.NotImplementedException(); + } + + public override Dictionary<string, object> Fields + { + get { throw new System.NotImplementedException(); } + } + } +} diff --git a/qpid/dotnet/client-010/test/transport/util/SerialTest.cs b/qpid/dotnet/client-010/test/transport/util/SerialTest.cs index 04a838c13b..21a1209b00 100644 --- a/qpid/dotnet/client-010/test/transport/util/SerialTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/SerialTest.cs @@ -1,75 +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 NUnit.Framework;
-using org.apache.qpid.transport.util;
-
-namespace test.transport.util
-{
- [TestFixture]
- public class SerialTest
- {
- private static readonly Logger _log = Logger.get(typeof (SerialTest));
-
- [Test]
- ///
- /// Test the key boundaries where wraparound occurs.
- ///
- public void testBoundaries()
- {
- Assert.IsTrue(Serial.gt(1, 0));
- Assert.IsTrue(Serial.lt(0, 1));
-
- Assert.IsTrue(Serial.gt(int.MaxValue, int.MaxValue - 1));
- Assert.IsTrue(Serial.lt(int.MaxValue - 1, int.MaxValue));
- }
-
- ///
- /// Test the first Corollary of RFC 1982
- /// For any sequence number s and any integer n such that addition of n
- /// to s is well defined, (s + n) >= s. Further (s + n) == s only when
- /// n == 0, in all other defined cases, (s + n) > s.
- ///
- public void testCorollary1()
- {
- int wrapcount = 0;
-
- int s = 0;
-
- for (int i = 0; i < 67108664; i++)
- {
- for (int n = 1; n < 4096; n += 512)
- {
- Assert.IsTrue(Serial.gt(s + n, s));
- Assert.IsTrue(Serial.lt(s, s + n));
- }
-
- s += 1024;
-
- if (s == 0)
- {
- wrapcount += 1;
- }
- }
-
- Assert.IsTrue(wrapcount > 0);
- }
- }
-}
+/* +* +* 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 NUnit.Framework; +using org.apache.qpid.transport.util; + +namespace test.transport.util +{ + [TestFixture] + public class SerialTest + { + private static readonly Logger _log = Logger.get(typeof (SerialTest)); + + [Test] + /// + /// Test the key boundaries where wraparound occurs. + /// + public void testBoundaries() + { + Assert.IsTrue(Serial.gt(1, 0)); + Assert.IsTrue(Serial.lt(0, 1)); + + Assert.IsTrue(Serial.gt(int.MaxValue, int.MaxValue - 1)); + Assert.IsTrue(Serial.lt(int.MaxValue - 1, int.MaxValue)); + } + + /// + /// Test the first Corollary of RFC 1982 + /// For any sequence number s and any integer n such that addition of n + /// to s is well defined, (s + n) >= s. Further (s + n) == s only when + /// n == 0, in all other defined cases, (s + n) > s. + /// + public void testCorollary1() + { + int wrapcount = 0; + + int s = 0; + + for (int i = 0; i < 67108664; i++) + { + for (int n = 1; n < 4096; n += 512) + { + Assert.IsTrue(Serial.gt(s + n, s)); + Assert.IsTrue(Serial.lt(s, s + n)); + } + + s += 1024; + + if (s == 0) + { + wrapcount += 1; + } + } + + Assert.IsTrue(wrapcount > 0); + } + } +} diff --git a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs index 83faec49f8..c1d460c59f 100644 --- a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs @@ -1,62 +1,62 @@ -/*
-*
-* 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 NUnit.Framework;
-using org.apache.qpid.transport.util;
-
-namespace test.transport.util
-{
- [TestFixture]
-
- public class UUIDTest
- {
- [Test]
- public void createUUID()
- {
- UUID uuid = UUID.randomUUID();
- String uuidStr = uuid.ToString();
- Assert.IsNotNull(uuid);
- UUID uuid2 = UUID.randomUUID();
- Assert.AreNotSame(uuid, uuid2);
- }
-
- [Test]
- public void ToString_should_override_and_not_hide_base()
- {
- UUID uuid = UUID.randomUUID();
-
- string uuidStr = uuid.ToString();
- string uuidConcat = "Test." + uuid;
-
- Assert.AreEqual("Test." + uuidStr, uuidConcat);
- }
-
- [Test]
- public void two_uuid_with_same_value_should_have_same_hash_code()
- {
- UUID uuid = UUID.randomUUID();
- UUID uuid2 = new UUID(uuid.MostSignificantBits, uuid.LeastSignificantBits);
-
- Assert.AreEqual(uuid, uuid2);
- Assert.AreEqual(uuid.GetHashCode(), uuid2.GetHashCode());
- }
- }
-}
+/* +* +* 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 NUnit.Framework; +using org.apache.qpid.transport.util; + +namespace test.transport.util +{ + [TestFixture] + + public class UUIDTest + { + [Test] + public void createUUID() + { + UUID uuid = UUID.randomUUID(); + String uuidStr = uuid.ToString(); + Assert.IsNotNull(uuid); + UUID uuid2 = UUID.randomUUID(); + Assert.AreNotSame(uuid, uuid2); + } + + [Test] + public void ToString_should_override_and_not_hide_base() + { + UUID uuid = UUID.randomUUID(); + + string uuidStr = uuid.ToString(); + string uuidConcat = "Test." + uuid; + + Assert.AreEqual("Test." + uuidStr, uuidConcat); + } + + [Test] + public void two_uuid_with_same_value_should_have_same_hash_code() + { + UUID uuid = UUID.randomUUID(); + UUID uuid2 = new UUID(uuid.MostSignificantBits, uuid.LeastSignificantBits); + + Assert.AreEqual(uuid, uuid2); + Assert.AreEqual(uuid.GetHashCode(), uuid2.GetHashCode()); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs index 86a2f6b774..89205bd6bd 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs @@ -1,96 +1,96 @@ -/*
- *
- * 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.ServiceModel;
-using System.Windows.Forms;
-using org.apache.qpid.wcf.demo;
-using org.apache.qpid.wcf.model;
-using org.apache.qpid.wcf.demo.bookingServer;
-
-namespace WindowsFormsBooking
-{
- public partial class Form1 : Form
- {
- private ChannelFactory<IBooking> _fac;
- private readonly Order _order = new Order();
- private IBooking _calc;
-
- public Form1()
- {
- InitializeComponent();
- _calc = StartClient(new QpidBinding("192.168.1.14", 5673));
- _order.Type = "Default";
- _order.Price = 0;
- }
-
- public IBooking StartClient(System.ServiceModel.Channels.Binding binding)
- {
- IBooking res = null;
- try
- {
- Console.WriteLine(" Starting Client...");
- _fac = new ChannelFactory<IBooking>(binding, "soap.amqp:///Booking");
- _fac.Open();
- res = _fac.CreateChannel();
- Console.WriteLine("[DONE]");
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- return res;
- }
-
- public void StopClient(IBooking client)
- {
- Console.WriteLine(" Stopping Client...");
- ((System.ServiceModel.Channels.IChannel)client).Close();
- _fac.Close();
- Console.WriteLine("[DONE]");
- }
-
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- _order.Type = ((ComboBox) sender).SelectedItem.ToString();
- }
-
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- _order.Price = (double) ((NumericUpDown) sender).Value;
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- _calc.Add(_order);
- }
-
- private void button2_Click(object sender, EventArgs e)
- {
- Receipt r = _calc.Checkout();
- richTextBox1.Text = r.Summary + "\n" + "Total Price = " + r.Price;
- // reset
- _calc = StartClient(new QpidBinding("192.168.1.14", 5673));
- }
-
-
- }
-}
+/* + * + * 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.ServiceModel; +using System.Windows.Forms; +using org.apache.qpid.wcf.demo; +using org.apache.qpid.wcf.model; +using org.apache.qpid.wcf.demo.bookingServer; + +namespace WindowsFormsBooking +{ + public partial class Form1 : Form + { + private ChannelFactory<IBooking> _fac; + private readonly Order _order = new Order(); + private IBooking _calc; + + public Form1() + { + InitializeComponent(); + _calc = StartClient(new QpidBinding("192.168.1.14", 5673)); + _order.Type = "Default"; + _order.Price = 0; + } + + public IBooking StartClient(System.ServiceModel.Channels.Binding binding) + { + IBooking res = null; + try + { + Console.WriteLine(" Starting Client..."); + _fac = new ChannelFactory<IBooking>(binding, "soap.amqp:///Booking"); + _fac.Open(); + res = _fac.CreateChannel(); + Console.WriteLine("[DONE]"); + } + catch (Exception e) + { + Console.WriteLine(e); + } + return res; + } + + public void StopClient(IBooking client) + { + Console.WriteLine(" Stopping Client..."); + ((System.ServiceModel.Channels.IChannel)client).Close(); + _fac.Close(); + Console.WriteLine("[DONE]"); + } + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + _order.Type = ((ComboBox) sender).SelectedItem.ToString(); + } + + private void numericUpDown1_ValueChanged(object sender, EventArgs e) + { + _order.Price = (double) ((NumericUpDown) sender).Value; + } + + private void button1_Click(object sender, EventArgs e) + { + _calc.Add(_order); + } + + private void button2_Click(object sender, EventArgs e) + { + Receipt r = _calc.Checkout(); + richTextBox1.Text = r.Summary + "\n" + "Total Price = " + r.Price; + // reset + _calc = StartClient(new QpidBinding("192.168.1.14", 5673)); + } + + + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx index 925d12594b..360ccecbfe 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx @@ -1,123 +1,123 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
- <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" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </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" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </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>
- <metadata name="richTextBox1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>True</value>
- </metadata>
+<?xml version="1.0" encoding="utf-8"?> +<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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" /> + <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" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </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" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </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> + <metadata name="richTextBox1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> </root>
\ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.resx b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.resx index ffecec851a..af7dbebbac 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.resx +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.resx @@ -1,117 +1,117 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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>
+<?xml version="1.0" encoding="utf-8"?> +<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>
\ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.settings b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.settings index abf36c5d3d..39645652af 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.settings +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.settings @@ -1,7 +1,7 @@ -<?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
- <Profiles>
- <Profile Name="(Default)" />
- </Profiles>
- <Settings />
-</SettingsFile>
+<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile> diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj index 1e096db9d1..dbf12d376c 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj @@ -1,103 +1,103 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{4086B3FE-F745-4DCC-952A-682CAE01F4C9}</ProjectGuid>
- <OutputType>WinExe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>WindowsFormsBooking</RootNamespace>
- <AssemblyName>Booking 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>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.ServiceModel">
- <RequiredTargetFramework>3.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Deployment" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Form1.cs">
- <SubType>Form</SubType>
- </Compile>
- <Compile Include="Form1.Designer.cs">
- <DependentUpon>Form1.cs</DependentUpon>
- </Compile>
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <EmbeddedResource Include="Form1.resx">
- <DependentUpon>Form1.cs</DependentUpon>
- <SubType>Designer</SubType>
- </EmbeddedResource>
- <EmbeddedResource Include="Properties\Resources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Resources.Designer.cs</LastGenOutput>
- <SubType>Designer</SubType>
- </EmbeddedResource>
- <Compile Include="Properties\Resources.Designer.cs">
- <AutoGen>True</AutoGen>
- <DependentUpon>Resources.resx</DependentUpon>
- </Compile>
- <None Include="Properties\Settings.settings">
- <Generator>SettingsSingleFileGenerator</Generator>
- <LastGenOutput>Settings.Designer.cs</LastGenOutput>
- </None>
- <Compile Include="Properties\Settings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DependentUpon>Settings.settings</DependentUpon>
- <DesignTimeSharedInput>True</DesignTimeSharedInput>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\wcf.csproj">
- <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project>
- <Name>wcf</Name>
- </ProjectReference>
- <ProjectReference Include="..\wcfBookingServer\wcfBookingServer.csproj">
- <Project>{B34E21C4-A742-4886-8569-1A89490E093E}</Project>
- <Name>wcfBookingServer</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<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.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{4086B3FE-F745-4DCC-952A-682CAE01F4C9}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>WindowsFormsBooking</RootNamespace> + <AssemblyName>Booking 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>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.ServiceModel"> + <RequiredTargetFramework>3.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Deployment" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Form1.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Form1.Designer.cs"> + <DependentUpon>Form1.cs</DependentUpon> + </Compile> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <EmbeddedResource Include="Form1.resx"> + <DependentUpon>Form1.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + <SubType>Designer</SubType> + </EmbeddedResource> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\wcf.csproj"> + <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project> + <Name>wcf</Name> + </ProjectReference> + <ProjectReference Include="..\wcfBookingServer\wcfBookingServer.csproj"> + <Project>{B34E21C4-A742-4886-8569-1A89490E093E}</Project> + <Name>wcfBookingServer</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/dotnet/client-010/wcf/demo/wcfBookingServer/Booking.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Booking.cs index 3f0d37cbe8..7c0fbb39b4 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Booking.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Booking.cs @@ -1,62 +1,62 @@ -/*
-*
-* 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.ServiceModel;
-
-
-namespace org.apache.qpid.wcf.demo.bookingServer
-{
- [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
- public class Booking : IBooking
- {
- private Guid _id;
- private List<Order> _orders;
-
- public Booking()
- {
- _id = Guid.NewGuid();
- _orders = new List<Order>();
- }
-
- public void Add(Order order)
- {
- _orders.Add(order);
- }
-
- public Receipt Checkout()
- {
- var r = new Receipt();
- foreach (Order order in _orders)
- {
- r.Price += order.Price;
- r.Summary = r.Summary + " \n " + order.Type + " Price: " + order.Price;
- }
- return r;
- }
-
- public Guid Id
- {
- get { return _id; }
- }
- }
-}
+/* +* +* 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.ServiceModel; + + +namespace org.apache.qpid.wcf.demo.bookingServer +{ + [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] + public class Booking : IBooking + { + private Guid _id; + private List<Order> _orders; + + public Booking() + { + _id = Guid.NewGuid(); + _orders = new List<Order>(); + } + + public void Add(Order order) + { + _orders.Add(order); + } + + public Receipt Checkout() + { + var r = new Receipt(); + foreach (Order order in _orders) + { + r.Price += order.Price; + r.Summary = r.Summary + " \n " + order.Type + " Price: " + order.Price; + } + return r; + } + + public Guid Id + { + get { return _id; } + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs index 34b6caa1c6..cead4d0471 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs @@ -1,43 +1,43 @@ -/*
-*
-* 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.ServiceModel;
-
-namespace org.apache.qpid.wcf.demo.bookingServer
-{
- [ServiceContract(SessionMode=SessionMode.Required)]
- public interface IBooking
- {
- [OperationContract]
- void Add(Order order);
-
- [OperationContract]
- Receipt Checkout();
-
- Guid Id
- {
- [OperationContract]
- get;
- }
- }
-
-}
+/* +* +* 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.ServiceModel; + +namespace org.apache.qpid.wcf.demo.bookingServer +{ + [ServiceContract(SessionMode=SessionMode.Required)] + public interface IBooking + { + [OperationContract] + void Add(Order order); + + [OperationContract] + Receipt Checkout(); + + Guid Id + { + [OperationContract] + get; + } + } + +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Order.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Order.cs index 79dfdefdb3..aa52908692 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Order.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Order.cs @@ -1,45 +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.
-*
-*/
-using System.Runtime.Serialization;
-
-namespace org.apache.qpid.wcf.demo.bookingServer
-{
- [DataContract]
- public sealed class Order
- {
- private double _price;
- private string _type;
-
- [DataMember]
- public double Price
- {
- get { return _price; }
- set { _price = value; }
- }
-
- [DataMember]
- public string Type
- {
- get { return _type; }
- set { _type = value; }
- }
- }
-}
+/* +* +* 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.Runtime.Serialization; + +namespace org.apache.qpid.wcf.demo.bookingServer +{ + [DataContract] + public sealed class Order + { + private double _price; + private string _type; + + [DataMember] + public double Price + { + get { return _price; } + set { _price = value; } + } + + [DataMember] + public string Type + { + get { return _type; } + set { _type = value; } + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs index cead7edb8c..ebb75308cf 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs @@ -1,98 +1,98 @@ -/*
-*
-* 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.ServiceModel;
-using System.ServiceModel.Channels;
-using System.Threading;
-using org.apache.qpid.wcf.model;
-
-
-namespace org.apache.qpid.wcf.demo.bookingServer
-{
- internal class Program
- {
- private ServiceHost _service;
- private ChannelFactory<IBooking> fac;
-
- public void StartService(Binding binding)
- {
- try
- {
- Console.WriteLine(" Binding Service...");
- _service = new ServiceHost(typeof(Booking), new Uri("soap.amqp:///"));
- _service.AddServiceEndpoint(typeof(IBooking), binding, "Booking");
- _service.Open();
- Thread.Sleep(500);
- Console.WriteLine("[DONE]");
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- }
-
- public void StopService()
- {
- Console.WriteLine(" Stopping Service...");
- _service.Close();
- Console.WriteLine("[DONE]");
- }
-
- public IBooking StartClient(Binding binding)
- {
- IBooking res = null;
- try
- {
- Console.WriteLine(" Starting Client...");
- fac = new ChannelFactory<IBooking>(binding, "soap.amqp:///Booking");
- fac.Open();
- res = fac.CreateChannel();
- Console.WriteLine("[DONE]");
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- return res;
- }
-
- public void StopClient(IBooking client)
- {
- Console.WriteLine(" Stopping Client...");
- ((IChannel)client).Close();
- fac.Close();
- Console.WriteLine("[DONE]");
- }
-
- private static void Main(string[] args)
- {
- var p = new Program();
-
- Binding binding = new QpidBinding("192.168.1.14", 5673);
- p.StartService(binding);
-
- Console.ReadLine();
-
- p.StopService();
- }
- }
-}
+/* +* +* 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.ServiceModel; +using System.ServiceModel.Channels; +using System.Threading; +using org.apache.qpid.wcf.model; + + +namespace org.apache.qpid.wcf.demo.bookingServer +{ + internal class Program + { + private ServiceHost _service; + private ChannelFactory<IBooking> fac; + + public void StartService(Binding binding) + { + try + { + Console.WriteLine(" Binding Service..."); + _service = new ServiceHost(typeof(Booking), new Uri("soap.amqp:///")); + _service.AddServiceEndpoint(typeof(IBooking), binding, "Booking"); + _service.Open(); + Thread.Sleep(500); + Console.WriteLine("[DONE]"); + } + catch (Exception e) + { + Console.WriteLine(e); + } + } + + public void StopService() + { + Console.WriteLine(" Stopping Service..."); + _service.Close(); + Console.WriteLine("[DONE]"); + } + + public IBooking StartClient(Binding binding) + { + IBooking res = null; + try + { + Console.WriteLine(" Starting Client..."); + fac = new ChannelFactory<IBooking>(binding, "soap.amqp:///Booking"); + fac.Open(); + res = fac.CreateChannel(); + Console.WriteLine("[DONE]"); + } + catch (Exception e) + { + Console.WriteLine(e); + } + return res; + } + + public void StopClient(IBooking client) + { + Console.WriteLine(" Stopping Client..."); + ((IChannel)client).Close(); + fac.Close(); + Console.WriteLine("[DONE]"); + } + + private static void Main(string[] args) + { + var p = new Program(); + + Binding binding = new QpidBinding("192.168.1.14", 5673); + p.StartService(binding); + + Console.ReadLine(); + + p.StopService(); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs index 655c26a26e..d5ab0f3eb3 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs @@ -1,46 +1,46 @@ -/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System.Runtime.Serialization;
-
-namespace org.apache.qpid.wcf.demo.bookingServer
-{
- [DataContract]
- public sealed class Receipt
- {
- private double _price;
- private string _summary;
-
- [DataMember]
- public double Price
- {
- get { return _price; }
- set { _price = value; }
- }
-
- [DataMember]
- public string Summary
- {
- get { return _summary; }
- set { _summary = value; }
- }
- }
-}
+/* +* +* 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.Runtime.Serialization; + +namespace org.apache.qpid.wcf.demo.bookingServer +{ + [DataContract] + public sealed class Receipt + { + private double _price; + private string _summary; + + [DataMember] + public double Price + { + get { return _price; } + set { _price = value; } + } + + [DataMember] + public string Summary + { + get { return _summary; } + set { _summary = value; } + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj index eae7b2eaa6..84e8bd5a06 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj @@ -1,77 +1,77 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{B34E21C4-A742-4886-8569-1A89490E093E}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>wcfSession</RootNamespace>
- <AssemblyName>Booking 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>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Drawing" />
- <Reference Include="System.Runtime.Serialization">
- <RequiredTargetFramework>3.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.ServiceModel">
- <RequiredTargetFramework>3.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Booking.cs" />
- <Compile Include="Receipt.cs" />
- <Compile Include="IBooking.cs" />
- <Compile Include="Order.cs" />
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\wcf.csproj">
- <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project>
- <Name>wcf</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<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.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{B34E21C4-A742-4886-8569-1A89490E093E}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>wcfSession</RootNamespace> + <AssemblyName>Booking 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>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Drawing" /> + <Reference Include="System.Runtime.Serialization"> + <RequiredTargetFramework>3.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.ServiceModel"> + <RequiredTargetFramework>3.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Booking.cs" /> + <Compile Include="Receipt.cs" /> + <Compile Include="IBooking.cs" /> + <Compile Include="Order.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\wcf.csproj"> + <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project> + <Name>wcf</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/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs index 39889ba28c..31743c62cf 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs @@ -1,36 +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.
-*
-*/
-
-using System.ServiceModel;
-
-namespace org.apache.qpid.wcf.demo.helloClient
-{
- public class HelloClient : ClientBase<IHelloContract>, IHelloContract
- {
- public HelloClient(string configurationName)
- : base(configurationName) { }
-
- public void Hello(string name)
- {
- Channel.Hello(name);
- }
- }
-}
+/* +* +* 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.ServiceModel; + +namespace org.apache.qpid.wcf.demo.helloClient +{ + public class HelloClient : ClientBase<IHelloContract>, IHelloContract + { + public HelloClient(string configurationName) + : base(configurationName) { } + + public void Hello(string name) + { + Channel.Hello(name); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs index 70667c1396..d3b9a354ba 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs @@ -1,33 +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.
-*
-*/
-
-using System.ServiceModel;
-
-namespace org.apache.qpid.wcf.demo.helloClient
-{
- [ServiceContract]
- public interface IHelloContract
- {
- [OperationContract(IsOneWay=true)]
- void Hello(string name);
- }
-
-}
+/* +* +* 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.ServiceModel; + +namespace org.apache.qpid.wcf.demo.helloClient +{ + [ServiceContract] + public interface IHelloContract + { + [OperationContract(IsOneWay=true)] + void Hello(string name); + } + +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs index 0c722708ac..fc68d2556a 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs @@ -1,48 +1,48 @@ -/*
-*
-* 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;
-
-namespace org.apache.qpid.wcf.demo.helloClient
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.Title = "Hello Service Client";
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("Hello Service Client");
- Console.ForegroundColor = ConsoleColor.Gray;
- Console.WriteLine();
- // create a client using the configuration file App.config
- var client = new HelloClient("HelloService");
- Console.WriteLine("Client Saying Hello to Qpid");
- client.Hello("Qpid");
- Console.WriteLine("Client Saying Hello to AMQP");
- client.Hello("AMQP");
- // closing the client service
- client.ChannelFactory.Close();
- Console.WriteLine();
- Console.Write("Press Enter to Exit...");
- Console.ReadLine();
- }
- }
-}
+/* +* +* 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; + +namespace org.apache.qpid.wcf.demo.helloClient +{ + class Program + { + static void Main(string[] args) + { + Console.Title = "Hello Service Client"; + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine("Hello Service Client"); + Console.ForegroundColor = ConsoleColor.Gray; + Console.WriteLine(); + // create a client using the configuration file App.config + var client = new HelloClient("HelloService"); + Console.WriteLine("Client Saying Hello to Qpid"); + client.Hello("Qpid"); + Console.WriteLine("Client Saying Hello to AMQP"); + client.Hello("AMQP"); + // closing the client service + client.ChannelFactory.Close(); + Console.WriteLine(); + Console.Write("Press Enter to Exit..."); + Console.ReadLine(); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj index 1f3271f32b..5ad1e9624e 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj @@ -1,65 +1,65 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{A24E27DB-A38D-40C9-9879-8390B68C2F06}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>wcfHelloClient</RootNamespace>
- <AssemblyName>Qpid WCF Hello 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>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.configuration" />
- <Reference Include="System.ServiceModel">
- <RequiredTargetFramework>3.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="HelloClient.cs" />
- <Compile Include="IHelloService.cs" />
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\wcf.csproj">
- <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project>
- <Name>wcf</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<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.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{A24E27DB-A38D-40C9-9879-8390B68C2F06}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>wcfHelloClient</RootNamespace> + <AssemblyName>Qpid WCF Hello 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>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.configuration" /> + <Reference Include="System.ServiceModel"> + <RequiredTargetFramework>3.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="HelloClient.cs" /> + <Compile Include="IHelloService.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\wcf.csproj"> + <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project> + <Name>wcf</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/dotnet/client-010/wcf/demo/wcfHelloServer/HelloService.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/HelloService.cs index 3a4affdc0c..3b7df01ece 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/HelloService.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/HelloService.cs @@ -1,34 +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.
-*
-*/
-
-using System;
-
-namespace org.apache.qpid.wcf.demo.helloServer
-{
- public class HelloService : IHelloContract
- {
- public void Hello(string name)
- {
- Console.WriteLine("Hello {0}!", name);
-
- }
- }
-}
+/* +* +* 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; + +namespace org.apache.qpid.wcf.demo.helloServer +{ + public class HelloService : IHelloContract + { + public void Hello(string name) + { + Console.WriteLine("Hello {0}!", name); + + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs index 860eef3c4a..1609439b94 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs @@ -1,32 +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.
-*
-*/
-using System.ServiceModel;
-
-namespace org.apache.qpid.wcf.demo.helloServer
-{
- [ServiceContract]
- public interface IHelloContract
- {
- [OperationContract(IsOneWay=true)]
- void Hello(string name);
- }
-
-}
+/* +* +* 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.ServiceModel; + +namespace org.apache.qpid.wcf.demo.helloServer +{ + [ServiceContract] + public interface IHelloContract + { + [OperationContract(IsOneWay=true)] + void Hello(string name); + } + +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs index 7a5319fe66..1b8b8947ee 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs @@ -1,47 +1,47 @@ -/*
-*
-* 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.ServiceModel;
-
-namespace org.apache.qpid.wcf.demo.helloServer
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.Title = "Hello Service Server";
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("Hello Service Server");
- Console.ForegroundColor = ConsoleColor.Gray;
- Console.WriteLine();
-
- var host = new ServiceHost(typeof(HelloService));
- host.Open();
-
- Console.WriteLine("Service Ready");
- Console.WriteLine("Press Enter to Exit...");
- Console.ReadLine();
-
- host.Close();
- }
- }
-}
+/* +* +* 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.ServiceModel; + +namespace org.apache.qpid.wcf.demo.helloServer +{ + class Program + { + static void Main(string[] args) + { + Console.Title = "Hello Service Server"; + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine("Hello Service Server"); + Console.ForegroundColor = ConsoleColor.Gray; + Console.WriteLine(); + + var host = new ServiceHost(typeof(HelloService)); + host.Open(); + + Console.WriteLine("Service Ready"); + Console.WriteLine("Press Enter to Exit..."); + Console.ReadLine(); + + host.Close(); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj index fa727e00fd..b32c353c18 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj @@ -1,67 +1,67 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>wcfHelloServer</RootNamespace>
- <AssemblyName>Qpid WCF Hello 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>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.ServiceModel">
- <RequiredTargetFramework>3.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="HelloService.cs" />
- <Compile Include="IHelloService.cs" />
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<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.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>wcfHelloServer</RootNamespace> + <AssemblyName>Qpid WCF Hello 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>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.ServiceModel"> + <RequiredTargetFramework>3.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="HelloService.cs" /> + <Compile Include="IHelloService.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </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/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs index 607a165bdc..668450948d 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs @@ -1,31 +1,31 @@ -/*
-*
-* 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.ServiceModel;
-
-namespace org.apache.qpid.wcf.demo.rpc
-{
- [ServiceContract]
- public interface IUpperCase
- {
- [OperationContract]
- string ToUpperCase(string message);
- }
-}
+/* +* +* 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.ServiceModel; + +namespace org.apache.qpid.wcf.demo.rpc +{ + [ServiceContract] + public interface IUpperCase + { + [OperationContract] + string ToUpperCase(string message); + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs index 810175df4d..e2b54a0f61 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs @@ -1,113 +1,113 @@ -/*
-*
-* 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.ServiceModel;
-using System.ServiceModel.Channels;
-using System.Threading;
-using org.apache.qpid.wcf.model;
-
-
-namespace org.apache.qpid.wcf.demo.rpc
-{
- internal class Program
- {
- private ServiceHost _service;
- private ChannelFactory<IUpperCase> fac;
-
- public void StartService(Binding binding)
- {
- try
- {
- Console.WriteLine(" Binding Service...");
- _service = new ServiceHost(typeof (UpperCase), new Uri("soap.amqp:///"));
- _service.AddServiceEndpoint(typeof(IUpperCase), binding, "UpperCase");
- _service.Open();
- Thread.Sleep(500);
- Console.WriteLine("[DONE]");
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- }
-
- public void StopService()
- {
- Console.WriteLine(" Stopping Service...");
- _service.Close();
- Console.WriteLine("[DONE]");
- }
-
- public IUpperCase StartClient(Binding binding)
- {
- IUpperCase res = null;
- try
- {
- Console.WriteLine(" Starting Client...");
- fac = new ChannelFactory<IUpperCase>(binding, "soap.amqp:///UpperCase");
- fac.Open();
- res = fac.CreateChannel();
- Console.WriteLine("[DONE]");
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- return res;
- }
-
- public void StopClient(IUpperCase client)
- {
- Console.WriteLine(" Stopping Client...");
- ((IChannel) client).Close();
- fac.Close();
- Console.WriteLine("[DONE]");
- }
-
- private static void Main(string[] args)
- {
- var p = new Program();
-
- Binding binding = new QpidBinding("192.168.1.14", 5673);
- p.StartService(binding);
-
-
- IUpperCase calc = p.StartClient(new QpidBinding("192.168.1.14", 5673));
-
- string[] messages = {"Twas brillig, and the slithy toves",
- "Did gire and gymble in the wabe. ",
- "All mimsy were the borogroves, ",
- "And the mome raths outgrabe. "};
- foreach (string m in messages)
- {
- Console.Write(m + " --UperCase--> " );
- Console.Write(calc.ToUpperCase(m));
- Console.WriteLine();
- }
-
- Console.ReadLine();
-
- p.StopClient(calc);
- p.StopService();
- }
- }
-}
+/* +* +* 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.ServiceModel; +using System.ServiceModel.Channels; +using System.Threading; +using org.apache.qpid.wcf.model; + + +namespace org.apache.qpid.wcf.demo.rpc +{ + internal class Program + { + private ServiceHost _service; + private ChannelFactory<IUpperCase> fac; + + public void StartService(Binding binding) + { + try + { + Console.WriteLine(" Binding Service..."); + _service = new ServiceHost(typeof (UpperCase), new Uri("soap.amqp:///")); + _service.AddServiceEndpoint(typeof(IUpperCase), binding, "UpperCase"); + _service.Open(); + Thread.Sleep(500); + Console.WriteLine("[DONE]"); + } + catch (Exception e) + { + Console.WriteLine(e); + } + } + + public void StopService() + { + Console.WriteLine(" Stopping Service..."); + _service.Close(); + Console.WriteLine("[DONE]"); + } + + public IUpperCase StartClient(Binding binding) + { + IUpperCase res = null; + try + { + Console.WriteLine(" Starting Client..."); + fac = new ChannelFactory<IUpperCase>(binding, "soap.amqp:///UpperCase"); + fac.Open(); + res = fac.CreateChannel(); + Console.WriteLine("[DONE]"); + } + catch (Exception e) + { + Console.WriteLine(e); + } + return res; + } + + public void StopClient(IUpperCase client) + { + Console.WriteLine(" Stopping Client..."); + ((IChannel) client).Close(); + fac.Close(); + Console.WriteLine("[DONE]"); + } + + private static void Main(string[] args) + { + var p = new Program(); + + Binding binding = new QpidBinding("192.168.1.14", 5673); + p.StartService(binding); + + + IUpperCase calc = p.StartClient(new QpidBinding("192.168.1.14", 5673)); + + string[] messages = {"Twas brillig, and the slithy toves", + "Did gire and gymble in the wabe. ", + "All mimsy were the borogroves, ", + "And the mome raths outgrabe. "}; + foreach (string m in messages) + { + Console.Write(m + " --UperCase--> " ); + Console.Write(calc.ToUpperCase(m)); + Console.WriteLine(); + } + + Console.ReadLine(); + + p.StopClient(calc); + p.StopService(); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs index 470fe49734..1d12868497 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs @@ -1,205 +1,205 @@ -/*
-*
-* 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.Reflection;
-using System.ServiceModel.Channels;
-using System.ServiceModel.Configuration;
-using System.Configuration;
-
-namespace org.apache.qpid.wcf.model
-{
-
- /// <remarks>
- /// This configuration element should be imported into the client
- /// and server configuration files to provide declarative configuration
- /// of a AMQP bound service.
- /// </remarks>
- public sealed class QpidBindingConfigurationElement : StandardBindingElement
- {
- /// <summary>
- /// Creates a new instance of the QpidBindingConfigurationElement
- /// Class initialized with values from the specified configuration.
- /// </summary>
- /// <param name="configurationName"></param>
- public QpidBindingConfigurationElement(string configurationName)
- : base(configurationName)
- {
- }
-
- /// <summary>
- /// Creates a new instance of the RabbitMQBindingConfigurationElement Class.
- /// </summary>
- public QpidBindingConfigurationElement()
- : this(null)
- {
- }
-
-
- protected override void InitializeFrom(Binding binding)
- {
- base.InitializeFrom(binding);
- QpidBinding qpidbinding = binding as QpidBinding;
- if (qpidbinding != null)
- {
- Host = qpidbinding.Host;
- OneWayOnly = qpidbinding.OneWayOnly;
- TransactionFlowEnabled = qpidbinding.TransactionFlow;
- VirtualHost = qpidbinding.VirtualHost;
- PortNumber = qpidbinding.PortNumber;
- UserName = qpidbinding.UserName;
- Password = qpidbinding.Password;
- }
- }
-
- protected override void OnApplyConfiguration(Binding binding)
- {
- if (binding == null)
- throw new ArgumentNullException("binding");
-
- var qpidbinding = binding as QpidBinding;
- if (qpidbinding == null)
- {
- throw new ArgumentException(
- string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
- typeof(QpidBinding).AssemblyQualifiedName,
- binding.GetType().AssemblyQualifiedName));
- }
-
- qpidbinding.Host = Host;
- qpidbinding.OneWayOnly = OneWayOnly;
- qpidbinding.TransactionFlow = TransactionFlowEnabled;
- qpidbinding.Password = Password;
- qpidbinding.UserName = UserName;
- qpidbinding.VirtualHost = VirtualHost;
- qpidbinding.PortNumber = PortNumber;
- }
-
-
- /// <summary>
- /// Specifies the host that the binding should connect to.
- /// </summary>
- [ConfigurationProperty("host", DefaultValue = "localhost")]
- public string Host
- {
- get { return ((string) base["host"]); }
- set { base["host"] = value; }
- }
-
- /// <summary>
- /// Specifies the broker port number that the binding should connect to.
- /// </summary>
- [ConfigurationProperty("port", DefaultValue = "5672")]
- public int PortNumber
- {
- get { return (Convert.ToInt16(base["port"])); }
- set { base["port"] = value; }
- }
-
-
- /// <summary>
- /// Specifies whether or not the CompositeDuplex and ReliableSession
- /// binding elements are added to the channel stack.
- /// </summary>
- [ConfigurationProperty("oneWay", DefaultValue = false)]
- public bool OneWayOnly
- {
- get { return ((bool)base["oneWay"]); }
- set { base["oneWay"] = value; }
- }
-
- /// <summary>
- /// Password to use when authenticating with the broker
- /// </summary>
- [ConfigurationProperty("password", DefaultValue = "guest")]
- public string Password
- {
- get { return ((string)base["password"]); }
- set { base["password"] = value; }
- }
-
- /// <summary>
- /// Specifies whether or not WS-AtomicTransactions are supported by the binding
- /// </summary>
- [ConfigurationProperty("transactionFlow", DefaultValue = false)]
- public bool TransactionFlowEnabled
- {
- get { return ((bool)base["transactionFlow"]); }
- set { base["transactionFlow"] = value; }
- }
-
- /// <summary>
- /// The username to use when authenticating with the broker
- /// </summary>
- [ConfigurationProperty("username", DefaultValue = "guest")]
- public string UserName
- {
- get { return ((string)base["username"]); }
- set { base["username"] = value; }
- }
-
-
-
-
- /// <summary>
- /// The virtual host to access.
- /// </summary>
- [ConfigurationProperty("virtualHost", DefaultValue = "test")]
- public string VirtualHost
- {
- get { return ((string)base["virtualHost"]); }
- set { base["virtualHost"] = value; }
- }
-
- ///<summary>The security realm to use when calling IModel.AccessRequest</summary>
- [ConfigurationProperty("realm", DefaultValue = "plain")]
- public string Realm
- {
- get { return ((string)base["realm"]); }
- set { base["realm"] = value; }
- }
-
- protected override Type BindingElementType
- {
- get { return typeof(QpidBinding); }
- }
-
- protected override ConfigurationPropertyCollection Properties
- {
- get
- {
- ConfigurationPropertyCollection configProperties = base.Properties;
- foreach (PropertyInfo prop in this.GetType().GetProperties(BindingFlags.DeclaredOnly
- | BindingFlags.Public
- | BindingFlags.Instance))
- {
- foreach (ConfigurationPropertyAttribute attr in prop.GetCustomAttributes(typeof(ConfigurationPropertyAttribute), false))
- {
- configProperties.Add(
- new ConfigurationProperty(attr.Name, prop.PropertyType, attr.DefaultValue));
- }
- }
-
- return configProperties;
- }
- }
- }
-}
+/* +* +* 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.Reflection; +using System.ServiceModel.Channels; +using System.ServiceModel.Configuration; +using System.Configuration; + +namespace org.apache.qpid.wcf.model +{ + + /// <remarks> + /// This configuration element should be imported into the client + /// and server configuration files to provide declarative configuration + /// of a AMQP bound service. + /// </remarks> + public sealed class QpidBindingConfigurationElement : StandardBindingElement + { + /// <summary> + /// Creates a new instance of the QpidBindingConfigurationElement + /// Class initialized with values from the specified configuration. + /// </summary> + /// <param name="configurationName"></param> + public QpidBindingConfigurationElement(string configurationName) + : base(configurationName) + { + } + + /// <summary> + /// Creates a new instance of the RabbitMQBindingConfigurationElement Class. + /// </summary> + public QpidBindingConfigurationElement() + : this(null) + { + } + + + protected override void InitializeFrom(Binding binding) + { + base.InitializeFrom(binding); + QpidBinding qpidbinding = binding as QpidBinding; + if (qpidbinding != null) + { + Host = qpidbinding.Host; + OneWayOnly = qpidbinding.OneWayOnly; + TransactionFlowEnabled = qpidbinding.TransactionFlow; + VirtualHost = qpidbinding.VirtualHost; + PortNumber = qpidbinding.PortNumber; + UserName = qpidbinding.UserName; + Password = qpidbinding.Password; + } + } + + protected override void OnApplyConfiguration(Binding binding) + { + if (binding == null) + throw new ArgumentNullException("binding"); + + var qpidbinding = binding as QpidBinding; + if (qpidbinding == null) + { + throw new ArgumentException( + string.Format("Invalid type for binding. Expected {0}, Passed: {1}", + typeof(QpidBinding).AssemblyQualifiedName, + binding.GetType().AssemblyQualifiedName)); + } + + qpidbinding.Host = Host; + qpidbinding.OneWayOnly = OneWayOnly; + qpidbinding.TransactionFlow = TransactionFlowEnabled; + qpidbinding.Password = Password; + qpidbinding.UserName = UserName; + qpidbinding.VirtualHost = VirtualHost; + qpidbinding.PortNumber = PortNumber; + } + + + /// <summary> + /// Specifies the host that the binding should connect to. + /// </summary> + [ConfigurationProperty("host", DefaultValue = "localhost")] + public string Host + { + get { return ((string) base["host"]); } + set { base["host"] = value; } + } + + /// <summary> + /// Specifies the broker port number that the binding should connect to. + /// </summary> + [ConfigurationProperty("port", DefaultValue = "5672")] + public int PortNumber + { + get { return (Convert.ToInt16(base["port"])); } + set { base["port"] = value; } + } + + + /// <summary> + /// Specifies whether or not the CompositeDuplex and ReliableSession + /// binding elements are added to the channel stack. + /// </summary> + [ConfigurationProperty("oneWay", DefaultValue = false)] + public bool OneWayOnly + { + get { return ((bool)base["oneWay"]); } + set { base["oneWay"] = value; } + } + + /// <summary> + /// Password to use when authenticating with the broker + /// </summary> + [ConfigurationProperty("password", DefaultValue = "guest")] + public string Password + { + get { return ((string)base["password"]); } + set { base["password"] = value; } + } + + /// <summary> + /// Specifies whether or not WS-AtomicTransactions are supported by the binding + /// </summary> + [ConfigurationProperty("transactionFlow", DefaultValue = false)] + public bool TransactionFlowEnabled + { + get { return ((bool)base["transactionFlow"]); } + set { base["transactionFlow"] = value; } + } + + /// <summary> + /// The username to use when authenticating with the broker + /// </summary> + [ConfigurationProperty("username", DefaultValue = "guest")] + public string UserName + { + get { return ((string)base["username"]); } + set { base["username"] = value; } + } + + + + + /// <summary> + /// The virtual host to access. + /// </summary> + [ConfigurationProperty("virtualHost", DefaultValue = "test")] + public string VirtualHost + { + get { return ((string)base["virtualHost"]); } + set { base["virtualHost"] = value; } + } + + ///<summary>The security realm to use when calling IModel.AccessRequest</summary> + [ConfigurationProperty("realm", DefaultValue = "plain")] + public string Realm + { + get { return ((string)base["realm"]); } + set { base["realm"] = value; } + } + + protected override Type BindingElementType + { + get { return typeof(QpidBinding); } + } + + protected override ConfigurationPropertyCollection Properties + { + get + { + ConfigurationPropertyCollection configProperties = base.Properties; + foreach (PropertyInfo prop in this.GetType().GetProperties(BindingFlags.DeclaredOnly + | BindingFlags.Public + | BindingFlags.Instance)) + { + foreach (ConfigurationPropertyAttribute attr in prop.GetCustomAttributes(typeof(ConfigurationPropertyAttribute), false)) + { + configProperties.Add( + new ConfigurationProperty(attr.Name, prop.PropertyType, attr.DefaultValue)); + } + } + + return configProperties; + } + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs index f65296fa03..3e10926be4 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs @@ -1,33 +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.
-*
-*/
-using System.ServiceModel;
-
-namespace org.apache.qpid.wcf.demo.rpc
-{
- [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
- public sealed class UpperCase : IUpperCase
- {
- public string ToUpperCase(string message)
- {
- return message.ToUpper();
- }
- }
-}
+/* +* +* 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.ServiceModel; + +namespace org.apache.qpid.wcf.demo.rpc +{ + [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] + public sealed class UpperCase : IUpperCase + { + public string ToUpperCase(string message) + { + return message.ToUpper(); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj index 00efe7a6b9..c45dea2d39 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj @@ -1,73 +1,73 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{C988F456-1025-486F-9BCD-49C0F83B91DB}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>wcfRPC</RootNamespace>
- <AssemblyName>Qpid WCF UpperCase</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>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.configuration" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Drawing" />
- <Reference Include="System.ServiceModel">
- <RequiredTargetFramework>3.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="IUpperCase.cs" />
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="UpperCase.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\wcf.csproj">
- <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project>
- <Name>wcf</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?> +<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.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{C988F456-1025-486F-9BCD-49C0F83B91DB}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>wcfRPC</RootNamespace> + <AssemblyName>Qpid WCF UpperCase</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>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.configuration" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Drawing" /> + <Reference Include="System.ServiceModel"> + <RequiredTargetFramework>3.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="IUpperCase.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="UpperCase.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\wcf.csproj"> + <Project>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</Project> + <Name>wcf</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/dotnet/client-010/wcf/model/CommunicationOperation.cs b/qpid/dotnet/client-010/wcf/model/CommunicationOperation.cs index d32f3b3f40..3506d6729c 100644 --- a/qpid/dotnet/client-010/wcf/model/CommunicationOperation.cs +++ b/qpid/dotnet/client-010/wcf/model/CommunicationOperation.cs @@ -1,31 +1,31 @@ -/*
-*
-* 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.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
- internal delegate void CommunicationOperation(TimeSpan timeout);
- internal delegate TResult CommunicationOperation<TResult>(TimeSpan timeout);
- internal delegate TResult CommunicationOperation<TResult, TArg>(TimeSpan timeout, out TArg arg0);
- internal delegate void SendOperation(Message message, TimeSpan timeout);
-}
+/* +* +* 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.ServiceModel.Channels; + +namespace org.apache.qpid.wcf.model +{ + internal delegate void CommunicationOperation(TimeSpan timeout); + internal delegate TResult CommunicationOperation<TResult>(TimeSpan timeout); + internal delegate TResult CommunicationOperation<TResult, TArg>(TimeSpan timeout, out TArg arg0); + internal delegate void SendOperation(Message message, TimeSpan timeout); +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidBinding.cs b/qpid/dotnet/client-010/wcf/model/QpidBinding.cs index 73b7b92845..8f4684c1a1 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidBinding.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidBinding.cs @@ -1,185 +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.
-*
-*/
-
-using System.Configuration;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
- public sealed class QpidBinding : Binding
- {
- private string _host;
- private int _port;
- private string _username;
- private string _password;
- private string _virtuaHost;
- private readonly CompositeDuplexBindingElement _compositeDuplex;
- private readonly MessageEncodingBindingElement _encoding;
- private bool _oneWayOnly;
- private readonly ReliableSessionBindingElement _session;
- private readonly TransactionFlowBindingElement _transactionFlow;
- private bool _transactionsEnabled;
- private readonly QpidTransportBindingElement _transport;
-
-
-
- public QpidBinding() : this("localhost", 5672, "guest", "guest", "test")
- {
- }
-
-
- public QpidBinding(string host, int port ) : this (host, port, "guest", "guest", "test")
- {
- }
-
- public QpidBinding(string host, int port, string username, string password, string virtualhost)
- {
- Host = host;
- PortNumber = port;
- UserName = username;
- Password = password;
- VirtualHost = virtualhost;
- _transport = new QpidTransportBindingElement();
- _transport.Host = host;
- _transport.PortNumber = port;
- _transport.Password = password;
- _transport.UserName = username;
- _transport.VirtualHost = virtualhost;
- _encoding = new TextMessageEncodingBindingElement();
- _session = new ReliableSessionBindingElement();
- _compositeDuplex = new CompositeDuplexBindingElement();
- _transactionFlow = new TransactionFlowBindingElement();
- }
-
- public override BindingElementCollection CreateBindingElements()
- {
- var elements = new BindingElementCollection();
-
- if (_transactionsEnabled)
- {
- elements.Add(_transactionFlow);
- }
- if (!OneWayOnly)
- {
- elements.Add(_session);
- elements.Add(_compositeDuplex);
- }
- elements.Add(_encoding);
- elements.Add(_transport);
-
- return elements;
- }
-
-
-
- /// <summary>
- /// Gets the scheme used by the binding, soap.amqp
- /// </summary>
- public override string Scheme
- {
- get { return "soap.amqp"; }
- }
-
- /// <summary>
- /// Specifies the broker host
- /// </summary>
- [ConfigurationProperty("host")]
- public string Host
- {
- get { return _host; }
- set { _host = value; }
- }
-
- /// <summary>
- /// Specifies the broker port
- /// </summary>
- public int PortNumber
- {
- get { return _port; }
- set { _port = value; }
- }
-
- /// <summary>
- /// Specifies the username
- /// </summary>
- public string UserName
- {
- get { return _username; }
- set { _username = value; }
- }
-
- /// <summary>
- /// Specifies the password
- /// </summary>
- public string Password
- {
- get { return _password; }
- set { _password = value; }
- }
-
- /// <summary>
- /// Specifies the virtualhost
- /// </summary>
- public string VirtualHost
- {
- get { return _virtuaHost; }
- set { _virtuaHost = value; }
- }
-
-
- /// <summary>
- /// Gets the AMQP _transport binding element
- /// </summary>
- public QpidTransportBindingElement Transport
- {
- get { return _transport; }
- }
-
- /// <summary>
- /// Gets the reliable _session parameters for this binding instance
- /// </summary>
- public ReliableSession ReliableSession
- {
- get { return new ReliableSession(_session); }
- }
-
- /// <summary>
- /// Determines whether or not the TransactionFlowBindingElement will
- /// be added to the channel stack
- /// </summary>
- public bool TransactionFlow
- {
- get { return _transactionsEnabled; }
- set { _transactionsEnabled = value; }
- }
-
- /// <summary>
- /// Specifies whether or not the CompositeDuplex and ReliableSession
- /// binding elements are added to the channel stack.
- /// </summary>
- public bool OneWayOnly
- {
- get { return _oneWayOnly; }
- set { _oneWayOnly = value; }
- }
- }
+/* +* +* 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.Configuration; +using System.ServiceModel; +using System.ServiceModel.Channels; + +namespace org.apache.qpid.wcf.model +{ + public sealed class QpidBinding : Binding + { + private string _host; + private int _port; + private string _username; + private string _password; + private string _virtuaHost; + private readonly CompositeDuplexBindingElement _compositeDuplex; + private readonly MessageEncodingBindingElement _encoding; + private bool _oneWayOnly; + private readonly ReliableSessionBindingElement _session; + private readonly TransactionFlowBindingElement _transactionFlow; + private bool _transactionsEnabled; + private readonly QpidTransportBindingElement _transport; + + + + public QpidBinding() : this("localhost", 5672, "guest", "guest", "test") + { + } + + + public QpidBinding(string host, int port ) : this (host, port, "guest", "guest", "test") + { + } + + public QpidBinding(string host, int port, string username, string password, string virtualhost) + { + Host = host; + PortNumber = port; + UserName = username; + Password = password; + VirtualHost = virtualhost; + _transport = new QpidTransportBindingElement(); + _transport.Host = host; + _transport.PortNumber = port; + _transport.Password = password; + _transport.UserName = username; + _transport.VirtualHost = virtualhost; + _encoding = new TextMessageEncodingBindingElement(); + _session = new ReliableSessionBindingElement(); + _compositeDuplex = new CompositeDuplexBindingElement(); + _transactionFlow = new TransactionFlowBindingElement(); + } + + public override BindingElementCollection CreateBindingElements() + { + var elements = new BindingElementCollection(); + + if (_transactionsEnabled) + { + elements.Add(_transactionFlow); + } + if (!OneWayOnly) + { + elements.Add(_session); + elements.Add(_compositeDuplex); + } + elements.Add(_encoding); + elements.Add(_transport); + + return elements; + } + + + + /// <summary> + /// Gets the scheme used by the binding, soap.amqp + /// </summary> + public override string Scheme + { + get { return "soap.amqp"; } + } + + /// <summary> + /// Specifies the broker host + /// </summary> + [ConfigurationProperty("host")] + public string Host + { + get { return _host; } + set { _host = value; } + } + + /// <summary> + /// Specifies the broker port + /// </summary> + public int PortNumber + { + get { return _port; } + set { _port = value; } + } + + /// <summary> + /// Specifies the username + /// </summary> + public string UserName + { + get { return _username; } + set { _username = value; } + } + + /// <summary> + /// Specifies the password + /// </summary> + public string Password + { + get { return _password; } + set { _password = value; } + } + + /// <summary> + /// Specifies the virtualhost + /// </summary> + public string VirtualHost + { + get { return _virtuaHost; } + set { _virtuaHost = value; } + } + + + /// <summary> + /// Gets the AMQP _transport binding element + /// </summary> + public QpidTransportBindingElement Transport + { + get { return _transport; } + } + + /// <summary> + /// Gets the reliable _session parameters for this binding instance + /// </summary> + public ReliableSession ReliableSession + { + get { return new ReliableSession(_session); } + } + + /// <summary> + /// Determines whether or not the TransactionFlowBindingElement will + /// be added to the channel stack + /// </summary> + public bool TransactionFlow + { + get { return _transactionsEnabled; } + set { _transactionsEnabled = value; } + } + + /// <summary> + /// Specifies whether or not the CompositeDuplex and ReliableSession + /// binding elements are added to the channel stack. + /// </summary> + public bool OneWayOnly + { + get { return _oneWayOnly; } + set { _oneWayOnly = value; } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs b/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs index 25789a7955..174c28e108 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs @@ -1,167 +1,167 @@ -/*
-*
-* 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.ServiceModel;
-using System.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
- internal abstract class QpidChannelBase : IChannel
- {
- private readonly CommunicationOperation _closeMethod;
- private readonly BindingContext _context;
- private readonly CommunicationOperation _openMethod;
- private CommunicationState _state;
-
- private QpidChannelBase()
- {
- _state = CommunicationState.Created;
- _closeMethod = Close;
- _openMethod = Open;
- }
-
- protected QpidChannelBase(BindingContext context)
- : this()
- {
- _context = context;
- }
-
- public abstract void Close(TimeSpan timeout);
-
- public abstract void Open(TimeSpan timeout);
-
- public virtual void Abort()
- {
- Close();
- }
-
- public virtual void Close()
- {
- Close(_context.Binding.CloseTimeout);
- }
-
- public virtual T GetProperty<T>() where T : class
- {
- return default(T);
- }
-
- public virtual void Open()
- {
- Open(_context.Binding.OpenTimeout);
- }
-
- #region Async Methods
-
- public virtual IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _closeMethod.BeginInvoke(timeout, callback, state);
- }
-
- public virtual IAsyncResult BeginClose(AsyncCallback callback, object state)
- {
- return _closeMethod.BeginInvoke(_context.Binding.CloseTimeout, callback, state);
- }
-
- public virtual IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _openMethod.BeginInvoke(timeout, callback, state);
- }
-
- public virtual IAsyncResult BeginOpen(AsyncCallback callback, object state)
- {
- return _openMethod.BeginInvoke(_context.Binding.OpenTimeout, callback, state);
- }
-
- public virtual void EndClose(IAsyncResult result)
- {
- _closeMethod.EndInvoke(result);
- }
-
- public virtual void EndOpen(IAsyncResult result)
- {
- _openMethod.EndInvoke(result);
- }
-
- #endregion
-
- #region Event Raising Methods
-
- protected void OnOpening()
- {
- _state = CommunicationState.Opening;
- if (Opening != null)
- Opening(this, null);
- }
-
- protected void OnOpened()
- {
- _state = CommunicationState.Opened;
- if (Opened != null)
- Opened(this, null);
- }
-
- protected void OnClosing()
- {
- _state = CommunicationState.Closing;
- if (Closing != null)
- Closing(this, null);
- }
-
- protected void OnClosed()
- {
- _state = CommunicationState.Closed;
- if (Closed != null)
- Closed(this, null);
- }
-
- protected void OnFaulted()
- {
- _state = CommunicationState.Faulted;
- if (Faulted != null)
- Faulted(this, null);
- }
-
- #endregion
-
-
- public CommunicationState State
- {
- get { return _state; }
- }
-
- protected BindingContext Context
- {
- get { return _context; }
- }
-
-
- public event EventHandler Closed;
-
- public event EventHandler Closing;
-
- public event EventHandler Faulted;
-
- public event EventHandler Opened;
-
- public event EventHandler Opening;
- }
-}
+/* +* +* 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.ServiceModel; +using System.ServiceModel.Channels; + +namespace org.apache.qpid.wcf.model +{ + internal abstract class QpidChannelBase : IChannel + { + private readonly CommunicationOperation _closeMethod; + private readonly BindingContext _context; + private readonly CommunicationOperation _openMethod; + private CommunicationState _state; + + private QpidChannelBase() + { + _state = CommunicationState.Created; + _closeMethod = Close; + _openMethod = Open; + } + + protected QpidChannelBase(BindingContext context) + : this() + { + _context = context; + } + + public abstract void Close(TimeSpan timeout); + + public abstract void Open(TimeSpan timeout); + + public virtual void Abort() + { + Close(); + } + + public virtual void Close() + { + Close(_context.Binding.CloseTimeout); + } + + public virtual T GetProperty<T>() where T : class + { + return default(T); + } + + public virtual void Open() + { + Open(_context.Binding.OpenTimeout); + } + + #region Async Methods + + public virtual IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state) + { + return _closeMethod.BeginInvoke(timeout, callback, state); + } + + public virtual IAsyncResult BeginClose(AsyncCallback callback, object state) + { + return _closeMethod.BeginInvoke(_context.Binding.CloseTimeout, callback, state); + } + + public virtual IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state) + { + return _openMethod.BeginInvoke(timeout, callback, state); + } + + public virtual IAsyncResult BeginOpen(AsyncCallback callback, object state) + { + return _openMethod.BeginInvoke(_context.Binding.OpenTimeout, callback, state); + } + + public virtual void EndClose(IAsyncResult result) + { + _closeMethod.EndInvoke(result); + } + + public virtual void EndOpen(IAsyncResult result) + { + _openMethod.EndInvoke(result); + } + + #endregion + + #region Event Raising Methods + + protected void OnOpening() + { + _state = CommunicationState.Opening; + if (Opening != null) + Opening(this, null); + } + + protected void OnOpened() + { + _state = CommunicationState.Opened; + if (Opened != null) + Opened(this, null); + } + + protected void OnClosing() + { + _state = CommunicationState.Closing; + if (Closing != null) + Closing(this, null); + } + + protected void OnClosed() + { + _state = CommunicationState.Closed; + if (Closed != null) + Closed(this, null); + } + + protected void OnFaulted() + { + _state = CommunicationState.Faulted; + if (Faulted != null) + Faulted(this, null); + } + + #endregion + + + public CommunicationState State + { + get { return _state; } + } + + protected BindingContext Context + { + get { return _context; } + } + + + public event EventHandler Closed; + + public event EventHandler Closing; + + public event EventHandler Faulted; + + public event EventHandler Opened; + + public event EventHandler Opening; + } +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs b/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs index fd26cbed99..84518cb1c3 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs @@ -1,74 +1,74 @@ -/*
-*
-* 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.ServiceModel;
-using System.ServiceModel.Channels;
-using org.apache.qpid.client;
-
-namespace org.apache.qpid.wcf.model
-{
- public class QpidChannelFactory : ChannelFactoryBase<IOutputChannel>
- {
- private readonly BindingContext _context;
- private readonly CommunicationOperation _openMethod;
- private readonly QpidTransportBindingElement _bindingElement;
- private ClientSession _session;
-
- public QpidChannelFactory(BindingContext context)
- {
- _context = context;
- _openMethod = Open;
- _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();
- }
-
- protected override IOutputChannel OnCreateChannel(EndpointAddress address, Uri via)
- {
- return new QpidOutputChannel(_context, _session, address);
- }
-
- protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _openMethod.BeginInvoke(timeout, callback, state);
- }
-
- protected override void OnEndOpen(IAsyncResult result)
- {
- _openMethod.EndInvoke(result);
- }
-
- protected override void OnOpen(TimeSpan timeout)
- {
- _session = _bindingElement.Open(timeout.Milliseconds);
- }
-
- protected override void OnClose(TimeSpan timeout)
- {
- _bindingElement.Close();
- }
-
- protected override void OnAbort()
- {
- base.OnAbort();
- OnClose(_context.Binding.CloseTimeout);
- }
- }
-}
+/* +* +* 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.ServiceModel; +using System.ServiceModel.Channels; +using org.apache.qpid.client; + +namespace org.apache.qpid.wcf.model +{ + public class QpidChannelFactory : ChannelFactoryBase<IOutputChannel> + { + private readonly BindingContext _context; + private readonly CommunicationOperation _openMethod; + private readonly QpidTransportBindingElement _bindingElement; + private ClientSession _session; + + public QpidChannelFactory(BindingContext context) + { + _context = context; + _openMethod = Open; + _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>(); + } + + protected override IOutputChannel OnCreateChannel(EndpointAddress address, Uri via) + { + return new QpidOutputChannel(_context, _session, address); + } + + protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state) + { + return _openMethod.BeginInvoke(timeout, callback, state); + } + + protected override void OnEndOpen(IAsyncResult result) + { + _openMethod.EndInvoke(result); + } + + protected override void OnOpen(TimeSpan timeout) + { + _session = _bindingElement.Open(timeout.Milliseconds); + } + + protected override void OnClose(TimeSpan timeout) + { + _bindingElement.Close(); + } + + protected override void OnAbort() + { + base.OnAbort(); + OnClose(_context.Binding.CloseTimeout); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs b/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs index ea795775b4..f776fce9a5 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs @@ -1,79 +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 System.ServiceModel;
-using System.ServiceModel.Channels;
-using org.apache.qpid.client;
-
-namespace org.apache.qpid.wcf.model
-{
- public sealed class QpidChannelListener : QpidChannelListenerBase<IInputChannel>
- {
-
- private IInputChannel _channel;
- private ClientSession _session;
-
- public QpidChannelListener(BindingContext context)
- : base(context)
- {
- _channel = null;
- _session = null;
- }
-
- protected override IInputChannel OnAcceptChannel(TimeSpan timeout)
- {
- // Since only one connection to a broker is required (even for communication
- // with multiple exchanges
- if (_channel != null)
- return null;
-
- _channel = new QpidInputChannel(Context, _session, new EndpointAddress(Uri.ToString()));
- _channel.Closed += ListenChannelClosed;
- return _channel;
- }
-
- protected override bool OnWaitForChannel(TimeSpan timeout)
- {
- return false;
- }
-
- protected override void OnOpen(TimeSpan timeout)
- {
- _session = _bindingElement.Open(timeout.Milliseconds);
- }
-
- protected override void OnClose(TimeSpan timeout)
- {
- if (_channel != null)
- {
- _channel.Close();
- _channel = null;
- }
- _bindingElement.Close();
- }
-
- private void ListenChannelClosed(object sender, EventArgs args)
- {
- Close();
- }
-}
-}
+/* +* +* 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.ServiceModel; +using System.ServiceModel.Channels; +using org.apache.qpid.client; + +namespace org.apache.qpid.wcf.model +{ + public sealed class QpidChannelListener : QpidChannelListenerBase<IInputChannel> + { + + private IInputChannel _channel; + private ClientSession _session; + + public QpidChannelListener(BindingContext context) + : base(context) + { + _channel = null; + _session = null; + } + + protected override IInputChannel OnAcceptChannel(TimeSpan timeout) + { + // Since only one connection to a broker is required (even for communication + // with multiple exchanges + if (_channel != null) + return null; + + _channel = new QpidInputChannel(Context, _session, new EndpointAddress(Uri.ToString())); + _channel.Closed += ListenChannelClosed; + return _channel; + } + + protected override bool OnWaitForChannel(TimeSpan timeout) + { + return false; + } + + protected override void OnOpen(TimeSpan timeout) + { + _session = _bindingElement.Open(timeout.Milliseconds); + } + + protected override void OnClose(TimeSpan timeout) + { + if (_channel != null) + { + _channel.Close(); + _channel = null; + } + _bindingElement.Close(); + } + + private void ListenChannelClosed(object sender, EventArgs args) + { + Close(); + } +} +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs b/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs index f2bba9316a..bdecb38c9d 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs @@ -1,111 +1,111 @@ -/*
-*
-* 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.ServiceModel.Channels;
-using System.ServiceModel.Description;
-
-namespace org.apache.qpid.wcf.model
-{
- public abstract class QpidChannelListenerBase<TChannel> : ChannelListenerBase<TChannel> where TChannel: class, IChannel
- {
- private readonly Uri _listenUri;
- private readonly BindingContext _context;
- protected QpidTransportBindingElement _bindingElement;
- private readonly CommunicationOperation _closeMethod;
- private readonly CommunicationOperation _openMethod;
- private readonly CommunicationOperation<TChannel> _acceptChannelMethod;
- private readonly CommunicationOperation<bool> _waitForChannelMethod;
-
- protected QpidChannelListenerBase(BindingContext context)
- {
- _context = context;
- _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();
- _closeMethod = OnClose;
- _openMethod = OnOpen;
- _waitForChannelMethod = OnWaitForChannel;
- _acceptChannelMethod = OnAcceptChannel;
- if (context.ListenUriMode == ListenUriMode.Explicit && context.ListenUriBaseAddress != null)
- {
- _listenUri = new Uri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
- }
- else
- {
- _listenUri = new Uri(new Uri("soap.amqp:///"), Guid.NewGuid().ToString());
- }
- }
-
- protected override void OnAbort()
- {
- OnClose(_context.Binding.CloseTimeout);
- }
-
- protected override IAsyncResult OnBeginAcceptChannel(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _acceptChannelMethod.BeginInvoke(timeout, callback, state);
- }
-
- protected override TChannel OnEndAcceptChannel(IAsyncResult result)
- {
- return _acceptChannelMethod.EndInvoke(result);
- }
-
- protected override IAsyncResult OnBeginWaitForChannel(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _waitForChannelMethod.BeginInvoke(timeout, callback, state);
- }
-
- protected override bool OnEndWaitForChannel(IAsyncResult result)
- {
- return _waitForChannelMethod.EndInvoke(result);
- }
-
- protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _closeMethod.BeginInvoke(timeout, callback, state);
- }
-
- protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _openMethod.BeginInvoke(timeout, callback, state);
- }
-
- protected override void OnEndClose(IAsyncResult result)
- {
- _closeMethod.EndInvoke(result);
- }
-
- protected override void OnEndOpen(IAsyncResult result)
- {
- _openMethod.EndInvoke(result);
- }
-
- public override Uri Uri
- {
- get { return _listenUri; }
- }
-
- protected BindingContext Context
- {
- get { return _context; }
- }
- }
-}
+/* +* +* 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.ServiceModel.Channels; +using System.ServiceModel.Description; + +namespace org.apache.qpid.wcf.model +{ + public abstract class QpidChannelListenerBase<TChannel> : ChannelListenerBase<TChannel> where TChannel: class, IChannel + { + private readonly Uri _listenUri; + private readonly BindingContext _context; + protected QpidTransportBindingElement _bindingElement; + private readonly CommunicationOperation _closeMethod; + private readonly CommunicationOperation _openMethod; + private readonly CommunicationOperation<TChannel> _acceptChannelMethod; + private readonly CommunicationOperation<bool> _waitForChannelMethod; + + protected QpidChannelListenerBase(BindingContext context) + { + _context = context; + _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>(); + _closeMethod = OnClose; + _openMethod = OnOpen; + _waitForChannelMethod = OnWaitForChannel; + _acceptChannelMethod = OnAcceptChannel; + if (context.ListenUriMode == ListenUriMode.Explicit && context.ListenUriBaseAddress != null) + { + _listenUri = new Uri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress); + } + else + { + _listenUri = new Uri(new Uri("soap.amqp:///"), Guid.NewGuid().ToString()); + } + } + + protected override void OnAbort() + { + OnClose(_context.Binding.CloseTimeout); + } + + protected override IAsyncResult OnBeginAcceptChannel(TimeSpan timeout, AsyncCallback callback, object state) + { + return _acceptChannelMethod.BeginInvoke(timeout, callback, state); + } + + protected override TChannel OnEndAcceptChannel(IAsyncResult result) + { + return _acceptChannelMethod.EndInvoke(result); + } + + protected override IAsyncResult OnBeginWaitForChannel(TimeSpan timeout, AsyncCallback callback, object state) + { + return _waitForChannelMethod.BeginInvoke(timeout, callback, state); + } + + protected override bool OnEndWaitForChannel(IAsyncResult result) + { + return _waitForChannelMethod.EndInvoke(result); + } + + protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state) + { + return _closeMethod.BeginInvoke(timeout, callback, state); + } + + protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state) + { + return _openMethod.BeginInvoke(timeout, callback, state); + } + + protected override void OnEndClose(IAsyncResult result) + { + _closeMethod.EndInvoke(result); + } + + protected override void OnEndOpen(IAsyncResult result) + { + _openMethod.EndInvoke(result); + } + + public override Uri Uri + { + get { return _listenUri; } + } + + protected BindingContext Context + { + get { return _context; } + } + } +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs b/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs index 3e257a7744..7a05153df9 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs @@ -1,218 +1,218 @@ -/*
-*
-* 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.IO;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.wcf.model
-{
- internal sealed class QpidInputChannel : QpidInputChannelBase
- {
- private static readonly Logger _log = Logger.get(typeof (QpidInputChannel));
-
- private readonly QpidTransportBindingElement _bindingElement;
- private readonly MessageEncoder _encoder;
- private readonly ClientSession _session;
- private readonly string _queueName;
- private BlockingQueue _queue;
- private bool _closed = false;
-
- public QpidInputChannel(BindingContext context, ClientSession session, EndpointAddress address)
- : base(context, address)
- {
- _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();
- var encoderElem = context.BindingParameters.Find<MessageEncodingBindingElement>();
- if (encoderElem != null)
- {
- _encoder = encoderElem.CreateMessageEncoderFactory().Encoder;
- }
- _session = session;
- _queueName = address.Uri.ToString();
- _queue = new BlockingQueue();
- }
-
-
- public override System.ServiceModel.Channels.Message Receive(TimeSpan timeout)
- {
- _session.messageFlow("myDest", MessageCreditUnit.MESSAGE, 1);
- _session.sync();
- IMessage m = _queue.Dequeue();
- System.ServiceModel.Channels.Message result = null;
- if (m != null)
- {
- var reader = new BinaryReader(m.Body, Encoding.UTF8);
- var body = new byte[m.Body.Length - m.Body.Position];
- reader.Read(body, 0, body.Length);
- try
- {
- result = _encoder.ReadMessage(new MemoryStream(body),
- (int) _bindingElement.MaxReceivedMessageSize);
- }
- catch(Exception e)
- {
- Console.WriteLine(e.StackTrace);
- }
- result.Headers.To = LocalAddress.Uri;
-
- var ack = new RangeSet();
- // ack this message
- ack.add(m.Id);
- _session.messageAccept(ack);
- _session.sync();
- }
- else
- {
- if(! _closed )
- {
- return Receive(timeout);
- }
- }
- return result;
- }
-
- public override bool TryReceive(TimeSpan timeout, out System.ServiceModel.Channels.Message message)
- {
- message = Receive(timeout);
- return message != null;
- }
-
- public override bool WaitForMessage(TimeSpan timeout)
- {
- throw new NotImplementedException();
- }
-
- public override void Close(TimeSpan timeout)
- {
- _closed = true;
- _queue = null;
- }
-
- public override void Open(TimeSpan timeout)
- {
- if (State != CommunicationState.Created && State != CommunicationState.Closed)
- throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", State));
-
- OnOpening();
-
- var qr = (QueueQueryResult) _session.queueQuery(_queueName).Result;
- if (qr.getQueue() == null)
- {
- // create the queue
- _session.queueDeclare(_queueName, null, null);
- }
- // bind the queue
- _session.exchangeBind(_queueName, "amq.direct", _queueName, null);
- var myListener = new WCFListener(_queue);
- _session.attachMessageListener(myListener, "myDest");
- _session.messageSubscribe(_queueName, "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED,
- null,
- 0, null);
- // issue credits
- _session.messageSetFlowMode("myDest", MessageFlowMode.WINDOW);
- _session.messageFlow("myDest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES);
- _session.sync();
-
- OnOpened();
- }
- }
-
- internal class WCFListener : IMessageListener
- {
- private static readonly Logger _log = Logger.get(typeof (WCFListener));
- private readonly BlockingQueue _q;
-
- public WCFListener(BlockingQueue q)
- {
- _q = q;
- }
-
- public void messageTransfer(IMessage m)
- {
- _log.debug("message received by listener");
- _q.Enqueue(m);
- }
- }
-
- internal class BlockingQueue
- {
- private int _count;
- private readonly Queue<IMessage> _queue = new Queue<IMessage>();
-
- public IMessage Dequeue(TimeSpan timeout)
- {
- lock (_queue)
- {
- DateTime start = DateTime.Now;
- long elapsed = 0;
- while (_count <= 0 && elapsed < timeout.Milliseconds)
- {
- Monitor.Wait(_queue, new TimeSpan(timeout.Milliseconds - elapsed));
- elapsed = DateTime.Now.Subtract(start).Milliseconds;
- }
- if (_count > 0)
- {
- _count--;
- return _queue.Dequeue();
- }
- return null;
- }
- }
-
- public IMessage Dequeue()
- {
- lock (_queue)
- {
- while (_count <= 0)
- {
- Monitor.Wait(_queue);
- }
- if (_count > 0)
- {
- _count--;
- return _queue.Dequeue();
- }
- return null;
- }
- }
-
- public void Enqueue(IMessage data)
- {
- if (data != null)
- {
- lock (_queue)
- {
- _queue.Enqueue(data);
- _count++;
- Monitor.Pulse(_queue);
- }
- }
- }
- }
-}
-
+/* +* +* 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.IO; +using System.ServiceModel; +using System.ServiceModel.Channels; +using System.Text; +using System.Threading; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.wcf.model +{ + internal sealed class QpidInputChannel : QpidInputChannelBase + { + private static readonly Logger _log = Logger.get(typeof (QpidInputChannel)); + + private readonly QpidTransportBindingElement _bindingElement; + private readonly MessageEncoder _encoder; + private readonly ClientSession _session; + private readonly string _queueName; + private BlockingQueue _queue; + private bool _closed = false; + + public QpidInputChannel(BindingContext context, ClientSession session, EndpointAddress address) + : base(context, address) + { + _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>(); + var encoderElem = context.BindingParameters.Find<MessageEncodingBindingElement>(); + if (encoderElem != null) + { + _encoder = encoderElem.CreateMessageEncoderFactory().Encoder; + } + _session = session; + _queueName = address.Uri.ToString(); + _queue = new BlockingQueue(); + } + + + public override System.ServiceModel.Channels.Message Receive(TimeSpan timeout) + { + _session.messageFlow("myDest", MessageCreditUnit.MESSAGE, 1); + _session.sync(); + IMessage m = _queue.Dequeue(); + System.ServiceModel.Channels.Message result = null; + if (m != null) + { + var reader = new BinaryReader(m.Body, Encoding.UTF8); + var body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + try + { + result = _encoder.ReadMessage(new MemoryStream(body), + (int) _bindingElement.MaxReceivedMessageSize); + } + catch(Exception e) + { + Console.WriteLine(e.StackTrace); + } + result.Headers.To = LocalAddress.Uri; + + var ack = new RangeSet(); + // ack this message + ack.add(m.Id); + _session.messageAccept(ack); + _session.sync(); + } + else + { + if(! _closed ) + { + return Receive(timeout); + } + } + return result; + } + + public override bool TryReceive(TimeSpan timeout, out System.ServiceModel.Channels.Message message) + { + message = Receive(timeout); + return message != null; + } + + public override bool WaitForMessage(TimeSpan timeout) + { + throw new NotImplementedException(); + } + + public override void Close(TimeSpan timeout) + { + _closed = true; + _queue = null; + } + + public override void Open(TimeSpan timeout) + { + if (State != CommunicationState.Created && State != CommunicationState.Closed) + throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", State)); + + OnOpening(); + + var qr = (QueueQueryResult) _session.queueQuery(_queueName).Result; + if (qr.getQueue() == null) + { + // create the queue + _session.queueDeclare(_queueName, null, null); + } + // bind the queue + _session.exchangeBind(_queueName, "amq.direct", _queueName, null); + var myListener = new WCFListener(_queue); + _session.attachMessageListener(myListener, "myDest"); + _session.messageSubscribe(_queueName, "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, + null, + 0, null); + // issue credits + _session.messageSetFlowMode("myDest", MessageFlowMode.WINDOW); + _session.messageFlow("myDest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + _session.sync(); + + OnOpened(); + } + } + + internal class WCFListener : IMessageListener + { + private static readonly Logger _log = Logger.get(typeof (WCFListener)); + private readonly BlockingQueue _q; + + public WCFListener(BlockingQueue q) + { + _q = q; + } + + public void messageTransfer(IMessage m) + { + _log.debug("message received by listener"); + _q.Enqueue(m); + } + } + + internal class BlockingQueue + { + private int _count; + private readonly Queue<IMessage> _queue = new Queue<IMessage>(); + + public IMessage Dequeue(TimeSpan timeout) + { + lock (_queue) + { + DateTime start = DateTime.Now; + long elapsed = 0; + while (_count <= 0 && elapsed < timeout.Milliseconds) + { + Monitor.Wait(_queue, new TimeSpan(timeout.Milliseconds - elapsed)); + elapsed = DateTime.Now.Subtract(start).Milliseconds; + } + if (_count > 0) + { + _count--; + return _queue.Dequeue(); + } + return null; + } + } + + public IMessage Dequeue() + { + lock (_queue) + { + while (_count <= 0) + { + Monitor.Wait(_queue); + } + if (_count > 0) + { + _count--; + return _queue.Dequeue(); + } + return null; + } + } + + public void Enqueue(IMessage data) + { + if (data != null) + { + lock (_queue) + { + _queue.Enqueue(data); + _count++; + Monitor.Pulse(_queue); + } + } + } + } +} + diff --git a/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs b/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs index 94aa459eab..0bd9e85c0a 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs @@ -1,101 +1,101 @@ -/*
-*
-* 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.ServiceModel;
-using System.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
- internal abstract class QpidInputChannelBase : QpidChannelBase, IInputChannel
- {
- private readonly EndpointAddress _localAddress;
- private readonly CommunicationOperation<Message> _receiveMethod;
- private readonly CommunicationOperation<bool, Message> _tryReceiveMethod;
- private readonly CommunicationOperation<bool> _waitForMessage;
-
-
- protected QpidInputChannelBase(BindingContext context, EndpointAddress localAddress)
- :base(context)
- {
- _localAddress = localAddress;
- _receiveMethod = Receive;
- _tryReceiveMethod = TryReceive;
- _waitForMessage = WaitForMessage;
- }
-
-
- #region Async Methods
- public virtual IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _receiveMethod.BeginInvoke(timeout, callback, state);
- }
-
- public virtual IAsyncResult BeginReceive(AsyncCallback callback, object state)
- {
- return _receiveMethod.BeginInvoke(Context.Binding.ReceiveTimeout, callback, state);
- }
-
- public virtual IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
- {
- Message message;
- return _tryReceiveMethod.BeginInvoke(timeout, out message, callback, state);
- }
-
- public virtual IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _waitForMessage.BeginInvoke(timeout, callback, state);
- }
-
- public virtual Message EndReceive(IAsyncResult result)
- {
- return _receiveMethod.EndInvoke(result);
- }
-
- public virtual bool EndTryReceive(IAsyncResult result, out Message message)
- {
- return _tryReceiveMethod.EndInvoke(out message, result);
- }
-
- public virtual bool EndWaitForMessage(IAsyncResult result)
- {
- return _waitForMessage.EndInvoke(result);
- }
- #endregion
-
- public abstract Message Receive(TimeSpan timeout);
-
- public abstract bool TryReceive(TimeSpan timeout, out Message message);
-
- public abstract bool WaitForMessage(TimeSpan timeout);
-
- public virtual Message Receive()
- {
- return Receive(Context.Binding.ReceiveTimeout);
- }
-
-
- public EndpointAddress LocalAddress
- {
- get { return _localAddress; }
- }
- }
-}
+/* +* +* 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.ServiceModel; +using System.ServiceModel.Channels; + +namespace org.apache.qpid.wcf.model +{ + internal abstract class QpidInputChannelBase : QpidChannelBase, IInputChannel + { + private readonly EndpointAddress _localAddress; + private readonly CommunicationOperation<Message> _receiveMethod; + private readonly CommunicationOperation<bool, Message> _tryReceiveMethod; + private readonly CommunicationOperation<bool> _waitForMessage; + + + protected QpidInputChannelBase(BindingContext context, EndpointAddress localAddress) + :base(context) + { + _localAddress = localAddress; + _receiveMethod = Receive; + _tryReceiveMethod = TryReceive; + _waitForMessage = WaitForMessage; + } + + + #region Async Methods + public virtual IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state) + { + return _receiveMethod.BeginInvoke(timeout, callback, state); + } + + public virtual IAsyncResult BeginReceive(AsyncCallback callback, object state) + { + return _receiveMethod.BeginInvoke(Context.Binding.ReceiveTimeout, callback, state); + } + + public virtual IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state) + { + Message message; + return _tryReceiveMethod.BeginInvoke(timeout, out message, callback, state); + } + + public virtual IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state) + { + return _waitForMessage.BeginInvoke(timeout, callback, state); + } + + public virtual Message EndReceive(IAsyncResult result) + { + return _receiveMethod.EndInvoke(result); + } + + public virtual bool EndTryReceive(IAsyncResult result, out Message message) + { + return _tryReceiveMethod.EndInvoke(out message, result); + } + + public virtual bool EndWaitForMessage(IAsyncResult result) + { + return _waitForMessage.EndInvoke(result); + } + #endregion + + public abstract Message Receive(TimeSpan timeout); + + public abstract bool TryReceive(TimeSpan timeout, out Message message); + + public abstract bool WaitForMessage(TimeSpan timeout); + + public virtual Message Receive() + { + return Receive(Context.Binding.ReceiveTimeout); + } + + + public EndpointAddress LocalAddress + { + get { return _localAddress; } + } + } +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs b/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs index cd580d4ce5..f53ed9b9b8 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs @@ -1,89 +1,89 @@ -/*
-*
-* 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.IO;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.wcf.model
-{
- internal sealed class QpidOutputChannel : QpidOutputChannelBase
- {
- private readonly MessageEncoder _encoder;
- private readonly ClientSession _session;
- private readonly string _queueName;
-
- public QpidOutputChannel(BindingContext context, ClientSession session, EndpointAddress address)
- : base(context, address)
- {
- var encoderElement = context.Binding.Elements.Find<MessageEncodingBindingElement>();
- if (encoderElement != null)
- {
- _encoder = encoderElement.CreateMessageEncoderFactory().Encoder;
- }
- _queueName = address.Uri.ToString();
- _session = session;
- }
-
- public override void Send(System.ServiceModel.Channels.Message message, TimeSpan timeout)
- {
- if (message.State != MessageState.Closed)
- {
- byte[] body;
- using (var str = new MemoryStream())
- {
- _encoder.WriteMessage(message, str);
- body = str.ToArray();
- }
- _session.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- new Header(new DeliveryProperties().setRoutingKey(_queueName),
- new transport.MessageProperties().setMessageId(UUID.randomUUID())),
- body);
- }
- }
-
- public override void Close(TimeSpan timeout)
- {
- if (State == CommunicationState.Closed || State == CommunicationState.Closing)
- return; // Ignore the call, we're already closing.
- OnClosing();
- OnClosed();
- }
-
- public override void Open(TimeSpan timeout)
- {
- if (State != CommunicationState.Created && State != CommunicationState.Closed)
- throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", State));
- OnOpening();
- var qr = (QueueQueryResult) _session.queueQuery(_queueName).Result;
- if (qr.getQueue() == null)
- {
- // create the queue
- _session.queueDeclare(_queueName, null, null);
- }
- OnOpened();
- }
- }
-}
+/* +* +* 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.IO; +using System.ServiceModel; +using System.ServiceModel.Channels; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.wcf.model +{ + internal sealed class QpidOutputChannel : QpidOutputChannelBase + { + private readonly MessageEncoder _encoder; + private readonly ClientSession _session; + private readonly string _queueName; + + public QpidOutputChannel(BindingContext context, ClientSession session, EndpointAddress address) + : base(context, address) + { + var encoderElement = context.Binding.Elements.Find<MessageEncodingBindingElement>(); + if (encoderElement != null) + { + _encoder = encoderElement.CreateMessageEncoderFactory().Encoder; + } + _queueName = address.Uri.ToString(); + _session = session; + } + + public override void Send(System.ServiceModel.Channels.Message message, TimeSpan timeout) + { + if (message.State != MessageState.Closed) + { + byte[] body; + using (var str = new MemoryStream()) + { + _encoder.WriteMessage(message, str); + body = str.ToArray(); + } + _session.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, + new Header(new DeliveryProperties().setRoutingKey(_queueName), + new transport.MessageProperties().setMessageId(UUID.randomUUID())), + body); + } + } + + public override void Close(TimeSpan timeout) + { + if (State == CommunicationState.Closed || State == CommunicationState.Closing) + return; // Ignore the call, we're already closing. + OnClosing(); + OnClosed(); + } + + public override void Open(TimeSpan timeout) + { + if (State != CommunicationState.Created && State != CommunicationState.Closed) + throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", State)); + OnOpening(); + var qr = (QueueQueryResult) _session.queueQuery(_queueName).Result; + if (qr.getQueue() == null) + { + // create the queue + _session.queueDeclare(_queueName, null, null); + } + OnOpened(); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs b/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs index bcf6b4b6b8..a3cd9020ff 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs @@ -1,77 +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.
-*
-*/
-
-using System;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
- internal abstract class QpidOutputChannelBase : QpidChannelBase, IOutputChannel
- {
-
- private readonly SendOperation _sendMethod;
- private readonly EndpointAddress _address;
-
- protected QpidOutputChannelBase(BindingContext context, EndpointAddress address)
- : base(context)
- {
- _address = address;
- _sendMethod = Send;
- }
-
- #region Async Methods
-
- public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
- {
- return _sendMethod.BeginInvoke(message, timeout, callback, state);
- }
-
- public IAsyncResult BeginSend(Message message, AsyncCallback callback, object state)
- {
- return _sendMethod.BeginInvoke(message, Context.Binding.SendTimeout, callback, state);
- }
-
- public void EndSend(IAsyncResult result)
- {
- _sendMethod.EndInvoke(result);
- }
-
- #endregion
-
- public abstract void Send(Message message, TimeSpan timeout);
-
- public virtual void Send(Message message)
- {
- Send(message, Context.Binding.SendTimeout);
- }
-
- public EndpointAddress RemoteAddress
- {
- get { return _address; }
- }
-
- public Uri Via
- {
- get { throw new NotImplementedException(); }
- }
- }
-}
+/* +* +* 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.ServiceModel; +using System.ServiceModel.Channels; + +namespace org.apache.qpid.wcf.model +{ + internal abstract class QpidOutputChannelBase : QpidChannelBase, IOutputChannel + { + + private readonly SendOperation _sendMethod; + private readonly EndpointAddress _address; + + protected QpidOutputChannelBase(BindingContext context, EndpointAddress address) + : base(context) + { + _address = address; + _sendMethod = Send; + } + + #region Async Methods + + public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state) + { + return _sendMethod.BeginInvoke(message, timeout, callback, state); + } + + public IAsyncResult BeginSend(Message message, AsyncCallback callback, object state) + { + return _sendMethod.BeginInvoke(message, Context.Binding.SendTimeout, callback, state); + } + + public void EndSend(IAsyncResult result) + { + _sendMethod.EndInvoke(result); + } + + #endregion + + public abstract void Send(Message message, TimeSpan timeout); + + public virtual void Send(Message message) + { + Send(message, Context.Binding.SendTimeout); + } + + public EndpointAddress RemoteAddress + { + get { return _address; } + } + + public Uri Via + { + get { throw new NotImplementedException(); } + } + } +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidTransportBindingElement.cs b/qpid/dotnet/client-010/wcf/model/QpidTransportBindingElement.cs index 1c37de45d8..50cc80422a 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidTransportBindingElement.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidTransportBindingElement.cs @@ -1,186 +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.
-*
-*/
-
-using System;
-using System.Configuration;
-using System.ServiceModel.Channels;
-using org.apache.qpid.client;
-
-namespace org.apache.qpid.wcf.model
-{
- public sealed class QpidTransportBindingElement : TransportBindingElement
- {
- private Client _connection;
- private string _host;
- private int _port;
- private string _username;
- private string _password;
- private string _virtuaHost;
-
- /// <summary>
- /// Creates a new instance of the QpidTransportBindingElement Class
- /// </summary>
- public QpidTransportBindingElement()
- {
- _host = "localhost";
- _port = 5672;
- _username = "guest";
- _password = "guest";
- _virtuaHost = "test";
- }
-
- private QpidTransportBindingElement(QpidTransportBindingElement other)
- : this()
- {
- Connection = other.Connection;
- Host = other.Host;
- PortNumber = other.PortNumber;
- UserName = other.UserName;
- Password = other.Password;
- }
-
-
- public override IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingContext context)
- {
- if (Host == null)
- throw new InvalidOperationException("No broker was specified.");
- return (IChannelFactory<TChannel>) new QpidChannelFactory(context);
- }
-
- public override IChannelListener<TChannel> BuildChannelListener<TChannel>(BindingContext context)
- {
- if (Host == null)
- throw new InvalidOperationException("No broker was specified.");
-
- return (IChannelListener<TChannel>) ((object) new QpidChannelListener(context));
- }
-
- public override bool CanBuildChannelFactory<TChannel>(BindingContext context)
- {
- return typeof (TChannel) == typeof (IOutputChannel);
- }
-
- public override bool CanBuildChannelListener<TChannel>(BindingContext context)
- {
- return typeof (TChannel) == typeof (IInputChannel);
- }
-
- public override BindingElement Clone()
- {
- return new QpidTransportBindingElement(this);
- }
-
- public override T GetProperty<T>(BindingContext context)
- {
- return context.GetInnerProperty<T>();
- }
-
- /// <summary>
- /// Gets the scheme used by the binding, this is 0.10 as default for now.
- /// </summary>
- public override string Scheme
- {
- get { return "soap.amqp"; }
- }
-
-
- /// <summary>
- /// Specifies the broker host
- /// </summary>
- [ConfigurationProperty("host")]
- public string Host
- {
- get { return _host; }
- set { _host = value; }
- }
-
- /// <summary>
- /// Specifies the broker port
- /// </summary>
- public int PortNumber
- {
- get { return _port; }
- set { _port = value; }
- }
-
- /// <summary>
- /// Specifies the username
- /// </summary>
- public string UserName
- {
- get { return _username; }
- set { _username = value; }
- }
-
- /// <summary>
- /// Specifies the password
- /// </summary>
- public string Password
- {
- get { return _password; }
- set { _password = value; }
- }
-
- /// <summary>
- /// Specifies the virtualhost
- /// </summary>
- public string VirtualHost
- {
- get { return _virtuaHost; }
- set { _virtuaHost = value; }
- }
-
- /// <summary>
- /// Specifies the connection
- /// </summary>
- public Client Connection
- {
- get { return _connection; }
- set { _connection = value; }
- }
-
-
- internal ClientSession Open(long timeout)
- {
- if (Connection == null)
- {
- Connection = new Client();
- }
- Connection.connect(Host, PortNumber, VirtualHost, UserName, Password);
- return Connection.createSession(timeout);
- }
-
- internal void Close()
- {
- if (Connection != null)
- {
- try
- {
- Connection.close();
- }
- catch (Exception e)
- {
- // todo log it
- }
- }
- }
- }
-}
+/* +* +* 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.Configuration; +using System.ServiceModel.Channels; +using org.apache.qpid.client; + +namespace org.apache.qpid.wcf.model +{ + public sealed class QpidTransportBindingElement : TransportBindingElement + { + private Client _connection; + private string _host; + private int _port; + private string _username; + private string _password; + private string _virtuaHost; + + /// <summary> + /// Creates a new instance of the QpidTransportBindingElement Class + /// </summary> + public QpidTransportBindingElement() + { + _host = "localhost"; + _port = 5672; + _username = "guest"; + _password = "guest"; + _virtuaHost = "test"; + } + + private QpidTransportBindingElement(QpidTransportBindingElement other) + : this() + { + Connection = other.Connection; + Host = other.Host; + PortNumber = other.PortNumber; + UserName = other.UserName; + Password = other.Password; + } + + + public override IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingContext context) + { + if (Host == null) + throw new InvalidOperationException("No broker was specified."); + return (IChannelFactory<TChannel>) new QpidChannelFactory(context); + } + + public override IChannelListener<TChannel> BuildChannelListener<TChannel>(BindingContext context) + { + if (Host == null) + throw new InvalidOperationException("No broker was specified."); + + return (IChannelListener<TChannel>) ((object) new QpidChannelListener(context)); + } + + public override bool CanBuildChannelFactory<TChannel>(BindingContext context) + { + return typeof (TChannel) == typeof (IOutputChannel); + } + + public override bool CanBuildChannelListener<TChannel>(BindingContext context) + { + return typeof (TChannel) == typeof (IInputChannel); + } + + public override BindingElement Clone() + { + return new QpidTransportBindingElement(this); + } + + public override T GetProperty<T>(BindingContext context) + { + return context.GetInnerProperty<T>(); + } + + /// <summary> + /// Gets the scheme used by the binding, this is 0.10 as default for now. + /// </summary> + public override string Scheme + { + get { return "soap.amqp"; } + } + + + /// <summary> + /// Specifies the broker host + /// </summary> + [ConfigurationProperty("host")] + public string Host + { + get { return _host; } + set { _host = value; } + } + + /// <summary> + /// Specifies the broker port + /// </summary> + public int PortNumber + { + get { return _port; } + set { _port = value; } + } + + /// <summary> + /// Specifies the username + /// </summary> + public string UserName + { + get { return _username; } + set { _username = value; } + } + + /// <summary> + /// Specifies the password + /// </summary> + public string Password + { + get { return _password; } + set { _password = value; } + } + + /// <summary> + /// Specifies the virtualhost + /// </summary> + public string VirtualHost + { + get { return _virtuaHost; } + set { _virtuaHost = value; } + } + + /// <summary> + /// Specifies the connection + /// </summary> + public Client Connection + { + get { return _connection; } + set { _connection = value; } + } + + + internal ClientSession Open(long timeout) + { + if (Connection == null) + { + Connection = new Client(); + } + Connection.connect(Host, PortNumber, VirtualHost, UserName, Password); + return Connection.createSession(timeout); + } + + internal void Close() + { + if (Connection != null) + { + try + { + Connection.close(); + } + catch (Exception e) + { + // todo log it + } + } + } + } +} diff --git a/qpid/dotnet/client-010/wcf/model/QpidTransportElement.cs b/qpid/dotnet/client-010/wcf/model/QpidTransportElement.cs index 8a829e5b13..f531186148 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidTransportElement.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidTransportElement.cs @@ -1,183 +1,183 @@ -/*
-*
-* 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.Configuration;
-using System.Reflection;
-using System.ServiceModel.Channels;
-using System.ServiceModel.Configuration;
-
-namespace org.apache.qpid.wcf.model
-{
- public sealed class QpidTransportElement : TransportElement
- {
-
- public override void ApplyConfiguration(BindingElement bindingElement)
- {
- base.ApplyConfiguration(bindingElement);
- if (bindingElement == null)
- throw new ArgumentNullException("bindingElement");
-
- var bindind = bindingElement as QpidTransportBindingElement;
- if (bindind == null)
- {
- throw new ArgumentException(
- string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
- typeof(QpidTransportBindingElement).AssemblyQualifiedName,
- bindingElement.GetType().AssemblyQualifiedName));
- }
-
- bindind.Host = Host;
- bindind.Password = Password;
- bindind.UserName = UserName;
- bindind.VirtualHost = VirtualHost;
- bindind.PortNumber = PortNumber;
- }
-
- public override void CopyFrom(ServiceModelExtensionElement from)
- {
- base.CopyFrom(from);
- var element = from as QpidTransportElement;
- if (element != null)
- {
- Host = element.Host;
- PortNumber = element.PortNumber;
- Password = element.Password;
- UserName = element.UserName;
- VirtualHost = element.VirtualHost;
- }
- }
-
- protected override BindingElement CreateBindingElement()
- {
- TransportBindingElement element = CreateDefaultBindingElement();
- ApplyConfiguration(element);
- return element;
- }
-
- protected override TransportBindingElement CreateDefaultBindingElement()
- {
- return new QpidTransportBindingElement();
- }
-
- protected override void InitializeFrom(BindingElement bindingElement)
- {
- base.InitializeFrom(bindingElement);
-
- if (bindingElement == null)
- throw new ArgumentNullException("bindingElement");
-
- var binding = bindingElement as QpidTransportBindingElement;
- if (binding == null)
- {
- throw new ArgumentException(
- string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
- typeof(QpidTransportBindingElement).AssemblyQualifiedName,
- bindingElement.GetType().AssemblyQualifiedName));
- }
-
- Host = binding.Host;
- PortNumber = binding.PortNumber;
- Password = binding.Password;
- UserName = binding.UserName;
- VirtualHost = binding.VirtualHost;
- }
-
- public override Type BindingElementType
- {
- get { return typeof(QpidTransportElement); }
- }
-
-
-
- /// <summary>
- /// Specifies the broker host name that the binding should connect to.
- /// </summary>
- [ConfigurationProperty("host", DefaultValue = "localhost")]
- public string Host
- {
- get { return ((string) base["host"]); }
- set { base["host"] = value; }
- }
-
- /// <summary>
- /// Specifies the broker port number that the binding should connect to.
- /// </summary>
- [ConfigurationProperty("port", DefaultValue = "5672")]
- public int PortNumber
- {
- get { return (Convert.ToInt16(base["port"])); }
- set { base["port"] = value; }
- }
-
- /// <summary>
- /// Password to use when authenticating with the broker
- /// </summary>
- [ConfigurationProperty("password", DefaultValue = "guest")]
- public string Password
- {
- get { return ((string)base["password"]); }
- set { base["password"] = value; }
- }
-
- /// <summary>
- /// The username to use when authenticating with the broker
- /// </summary>
- [ConfigurationProperty("username", DefaultValue = "guest")]
- public string UserName
- {
- get { return ((string)base["username"]); }
- set { base["username"] = value; }
- }
-
-
- /// <summary>
- /// The virtual host to access.
- /// </summary>
- [ConfigurationProperty("virtualHost", DefaultValue = "test")]
- public string VirtualHost
- {
- get { return ((string)base["virtualHost"]); }
- set { base["virtualHost"] = value; }
- }
-
-
- protected override ConfigurationPropertyCollection Properties
- {
- get
- {
- ConfigurationPropertyCollection configProperties = base.Properties;
- foreach (PropertyInfo prop in GetType().GetProperties(BindingFlags.DeclaredOnly
- | BindingFlags.Public
- | BindingFlags.Instance))
- {
- foreach (ConfigurationPropertyAttribute attr in prop.GetCustomAttributes(typeof(ConfigurationPropertyAttribute), false))
- {
- configProperties.Add(
- new ConfigurationProperty(attr.Name, prop.PropertyType, attr.DefaultValue));
- }
- }
-
- return configProperties;
- }
- }
- }
+/* +* +* 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.Configuration; +using System.Reflection; +using System.ServiceModel.Channels; +using System.ServiceModel.Configuration; + +namespace org.apache.qpid.wcf.model +{ + public sealed class QpidTransportElement : TransportElement + { + + public override void ApplyConfiguration(BindingElement bindingElement) + { + base.ApplyConfiguration(bindingElement); + if (bindingElement == null) + throw new ArgumentNullException("bindingElement"); + + var bindind = bindingElement as QpidTransportBindingElement; + if (bindind == null) + { + throw new ArgumentException( + string.Format("Invalid type for binding. Expected {0}, Passed: {1}", + typeof(QpidTransportBindingElement).AssemblyQualifiedName, + bindingElement.GetType().AssemblyQualifiedName)); + } + + bindind.Host = Host; + bindind.Password = Password; + bindind.UserName = UserName; + bindind.VirtualHost = VirtualHost; + bindind.PortNumber = PortNumber; + } + + public override void CopyFrom(ServiceModelExtensionElement from) + { + base.CopyFrom(from); + var element = from as QpidTransportElement; + if (element != null) + { + Host = element.Host; + PortNumber = element.PortNumber; + Password = element.Password; + UserName = element.UserName; + VirtualHost = element.VirtualHost; + } + } + + protected override BindingElement CreateBindingElement() + { + TransportBindingElement element = CreateDefaultBindingElement(); + ApplyConfiguration(element); + return element; + } + + protected override TransportBindingElement CreateDefaultBindingElement() + { + return new QpidTransportBindingElement(); + } + + protected override void InitializeFrom(BindingElement bindingElement) + { + base.InitializeFrom(bindingElement); + + if (bindingElement == null) + throw new ArgumentNullException("bindingElement"); + + var binding = bindingElement as QpidTransportBindingElement; + if (binding == null) + { + throw new ArgumentException( + string.Format("Invalid type for binding. Expected {0}, Passed: {1}", + typeof(QpidTransportBindingElement).AssemblyQualifiedName, + bindingElement.GetType().AssemblyQualifiedName)); + } + + Host = binding.Host; + PortNumber = binding.PortNumber; + Password = binding.Password; + UserName = binding.UserName; + VirtualHost = binding.VirtualHost; + } + + public override Type BindingElementType + { + get { return typeof(QpidTransportElement); } + } + + + + /// <summary> + /// Specifies the broker host name that the binding should connect to. + /// </summary> + [ConfigurationProperty("host", DefaultValue = "localhost")] + public string Host + { + get { return ((string) base["host"]); } + set { base["host"] = value; } + } + + /// <summary> + /// Specifies the broker port number that the binding should connect to. + /// </summary> + [ConfigurationProperty("port", DefaultValue = "5672")] + public int PortNumber + { + get { return (Convert.ToInt16(base["port"])); } + set { base["port"] = value; } + } + + /// <summary> + /// Password to use when authenticating with the broker + /// </summary> + [ConfigurationProperty("password", DefaultValue = "guest")] + public string Password + { + get { return ((string)base["password"]); } + set { base["password"] = value; } + } + + /// <summary> + /// The username to use when authenticating with the broker + /// </summary> + [ConfigurationProperty("username", DefaultValue = "guest")] + public string UserName + { + get { return ((string)base["username"]); } + set { base["username"] = value; } + } + + + /// <summary> + /// The virtual host to access. + /// </summary> + [ConfigurationProperty("virtualHost", DefaultValue = "test")] + public string VirtualHost + { + get { return ((string)base["virtualHost"]); } + set { base["virtualHost"] = value; } + } + + + protected override ConfigurationPropertyCollection Properties + { + get + { + ConfigurationPropertyCollection configProperties = base.Properties; + foreach (PropertyInfo prop in GetType().GetProperties(BindingFlags.DeclaredOnly + | BindingFlags.Public + | BindingFlags.Instance)) + { + foreach (ConfigurationPropertyAttribute attr in prop.GetCustomAttributes(typeof(ConfigurationPropertyAttribute), false)) + { + configProperties.Add( + new ConfigurationProperty(attr.Name, prop.PropertyType, attr.DefaultValue)); + } + } + + return configProperties; + } + } + } }
\ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/wcf.csproj b/qpid/dotnet/client-010/wcf/wcf.csproj index ace42dabd9..d04fefbfc2 100644 --- a/qpid/dotnet/client-010/wcf/wcf.csproj +++ b/qpid/dotnet/client-010/wcf/wcf.csproj @@ -1,59 +1,59 @@ -<?xml version="1.0" encoding="utf-8"?>
-<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.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>WCF</RootNamespace>
- <AssemblyName>qpidWCFModel</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>bin\Debug\</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>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Qpid Client, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\client\bin\Debug\Qpid Client.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.configuration" />
- <Reference Include="System.ServiceModel">
- <RequiredTargetFramework>3.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="model\*.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>
- -->
+<?xml version="1.0" encoding="utf-8"?> +<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.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>WCF</RootNamespace> + <AssemblyName>qpidWCFModel</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>bin\Debug\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Qpid Client, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\client\bin\Debug\Qpid Client.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.configuration" /> + <Reference Include="System.ServiceModel"> + <RequiredTargetFramework>3.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="model\*.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>
\ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/wcf.sln b/qpid/dotnet/client-010/wcf/wcf.sln index b978f28250..f65368bd66 100644 --- a/qpid/dotnet/client-010/wcf/wcf.sln +++ b/qpid/dotnet/client-010/wcf/wcf.sln @@ -1,50 +1,50 @@ -
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcfHelloClient", "demo\wcfHelloClient\wcfHelloClient.csproj", "{A24E27DB-A38D-40C9-9879-8390B68C2F06}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcfHelloServer", "demo\wcfHelloServer\wcfHelloServer.csproj", "{3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcfRPC", "demo\wcfRPC\wcfRPC.csproj", "{C988F456-1025-486F-9BCD-49C0F83B91DB}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcBookingClient", "demo\wcfBookingClient\wcBookingClient.csproj", "{4086B3FE-F745-4DCC-952A-682CAE01F4C9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcfBookingServer", "demo\wcfBookingServer\wcfBookingServer.csproj", "{B34E21C4-A742-4886-8569-1A89490E093E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcf", "wcf.csproj", "{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A24E27DB-A38D-40C9-9879-8390B68C2F06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A24E27DB-A38D-40C9-9879-8390B68C2F06}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A24E27DB-A38D-40C9-9879-8390B68C2F06}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A24E27DB-A38D-40C9-9879-8390B68C2F06}.Release|Any CPU.Build.0 = Release|Any CPU
- {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}.Release|Any CPU.Build.0 = Release|Any CPU
- {C988F456-1025-486F-9BCD-49C0F83B91DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C988F456-1025-486F-9BCD-49C0F83B91DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C988F456-1025-486F-9BCD-49C0F83B91DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C988F456-1025-486F-9BCD-49C0F83B91DB}.Release|Any CPU.Build.0 = Release|Any CPU
- {4086B3FE-F745-4DCC-952A-682CAE01F4C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4086B3FE-F745-4DCC-952A-682CAE01F4C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4086B3FE-F745-4DCC-952A-682CAE01F4C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4086B3FE-F745-4DCC-952A-682CAE01F4C9}.Release|Any CPU.Build.0 = Release|Any CPU
- {B34E21C4-A742-4886-8569-1A89490E093E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B34E21C4-A742-4886-8569-1A89490E093E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B34E21C4-A742-4886-8569-1A89490E093E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B34E21C4-A742-4886-8569-1A89490E093E}.Release|Any CPU.Build.0 = Release|Any CPU
- {F1D80D9D-FE22-4213-A760-BFFDE7D131DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F1D80D9D-FE22-4213-A760-BFFDE7D131DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F1D80D9D-FE22-4213-A760-BFFDE7D131DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F1D80D9D-FE22-4213-A760-BFFDE7D131DD}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcfHelloClient", "demo\wcfHelloClient\wcfHelloClient.csproj", "{A24E27DB-A38D-40C9-9879-8390B68C2F06}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcfHelloServer", "demo\wcfHelloServer\wcfHelloServer.csproj", "{3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcfRPC", "demo\wcfRPC\wcfRPC.csproj", "{C988F456-1025-486F-9BCD-49C0F83B91DB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcBookingClient", "demo\wcfBookingClient\wcBookingClient.csproj", "{4086B3FE-F745-4DCC-952A-682CAE01F4C9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcfBookingServer", "demo\wcfBookingServer\wcfBookingServer.csproj", "{B34E21C4-A742-4886-8569-1A89490E093E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcf", "wcf.csproj", "{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A24E27DB-A38D-40C9-9879-8390B68C2F06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A24E27DB-A38D-40C9-9879-8390B68C2F06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A24E27DB-A38D-40C9-9879-8390B68C2F06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A24E27DB-A38D-40C9-9879-8390B68C2F06}.Release|Any CPU.Build.0 = Release|Any CPU + {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A}.Release|Any CPU.Build.0 = Release|Any CPU + {C988F456-1025-486F-9BCD-49C0F83B91DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C988F456-1025-486F-9BCD-49C0F83B91DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C988F456-1025-486F-9BCD-49C0F83B91DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C988F456-1025-486F-9BCD-49C0F83B91DB}.Release|Any CPU.Build.0 = Release|Any CPU + {4086B3FE-F745-4DCC-952A-682CAE01F4C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4086B3FE-F745-4DCC-952A-682CAE01F4C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4086B3FE-F745-4DCC-952A-682CAE01F4C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4086B3FE-F745-4DCC-952A-682CAE01F4C9}.Release|Any CPU.Build.0 = Release|Any CPU + {B34E21C4-A742-4886-8569-1A89490E093E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B34E21C4-A742-4886-8569-1A89490E093E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B34E21C4-A742-4886-8569-1A89490E093E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B34E21C4-A742-4886-8569-1A89490E093E}.Release|Any CPU.Build.0 = Release|Any CPU + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal |